Class: Dommy::CryptoKey
- Inherits:
-
Object
- Object
- Dommy::CryptoKey
- Defined in:
- lib/dommy/crypto.rb
Overview
CryptoKey — opaque key handle returned by SubtleCrypto.
extractable: false keys reject export attempts; the raw bytes are
reachable only through the __dommy_bytes__ ecosystem accessor, never
the public (Web-mirroring) API.
Instance Attribute Summary collapse
-
#algorithm_name ⇒ Object
readonly
Returns the value of attribute algorithm_name.
-
#extractable ⇒ Object
readonly
Returns the value of attribute extractable.
-
#hash_name ⇒ Object
readonly
Returns the value of attribute hash_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#usages ⇒ Object
readonly
Returns the value of attribute usages.
Instance Method Summary collapse
-
#__dommy_bytes__ ⇒ Object
Low-level ecosystem accessor (see _dommy convention) — the public Web API never exposes raw key bytes.
- #__js_get__(key) ⇒ Object
-
#initialize(type, algorithm_name, hash_name, bytes, extractable: true, usages: []) ⇒ CryptoKey
constructor
A new instance of CryptoKey.
Constructor Details
#initialize(type, algorithm_name, hash_name, bytes, extractable: true, usages: []) ⇒ CryptoKey
Returns a new instance of CryptoKey.
376 377 378 379 380 381 382 383 |
# File 'lib/dommy/crypto.rb', line 376 def initialize(type, algorithm_name, hash_name, bytes, extractable: true, usages: []) @type = type @algorithm_name = algorithm_name @hash_name = hash_name @bytes = bytes @extractable = extractable @usages = usages.map(&:to_s).freeze end |
Instance Attribute Details
#algorithm_name ⇒ Object (readonly)
Returns the value of attribute algorithm_name.
374 375 376 |
# File 'lib/dommy/crypto.rb', line 374 def algorithm_name @algorithm_name end |
#extractable ⇒ Object (readonly)
Returns the value of attribute extractable.
374 375 376 |
# File 'lib/dommy/crypto.rb', line 374 def extractable @extractable end |
#hash_name ⇒ Object (readonly)
Returns the value of attribute hash_name.
374 375 376 |
# File 'lib/dommy/crypto.rb', line 374 def hash_name @hash_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
374 375 376 |
# File 'lib/dommy/crypto.rb', line 374 def type @type end |
#usages ⇒ Object (readonly)
Returns the value of attribute usages.
374 375 376 |
# File 'lib/dommy/crypto.rb', line 374 def usages @usages end |
Instance Method Details
#__dommy_bytes__ ⇒ Object
Low-level ecosystem accessor (see _dommy convention) — the public Web API never exposes raw key bytes.
387 388 389 |
# File 'lib/dommy/crypto.rb', line 387 def __dommy_bytes__ @bytes end |
#__js_get__(key) ⇒ Object
391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/dommy/crypto.rb', line 391 def __js_get__(key) case key when "type" @type.to_s when "extractable" @extractable when "algorithm" {"name" => @algorithm_name, "hash" => {"name" => @hash_name}} when "usages" @usages else Bridge::ABSENT end end |