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 `__bytes__` accessor stays internal-only (`double_underscore` convention) so production code paths can’t read the raw bytes.
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
-
#__bytes__ ⇒ Object
Test / internal seam — production callers should not reach in.
- #__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.
368 369 370 371 372 373 374 375 |
# File 'lib/dommy/crypto.rb', line 368 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.
366 367 368 |
# File 'lib/dommy/crypto.rb', line 366 def algorithm_name @algorithm_name end |
#extractable ⇒ Object (readonly)
Returns the value of attribute extractable.
366 367 368 |
# File 'lib/dommy/crypto.rb', line 366 def extractable @extractable end |
#hash_name ⇒ Object (readonly)
Returns the value of attribute hash_name.
366 367 368 |
# File 'lib/dommy/crypto.rb', line 366 def hash_name @hash_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
366 367 368 |
# File 'lib/dommy/crypto.rb', line 366 def type @type end |
#usages ⇒ Object (readonly)
Returns the value of attribute usages.
366 367 368 |
# File 'lib/dommy/crypto.rb', line 366 def usages @usages end |
Instance Method Details
#__bytes__ ⇒ Object
Test / internal seam — production callers should not reach in.
378 379 380 |
# File 'lib/dommy/crypto.rb', line 378 def __bytes__ @bytes end |
#__js_get__(key) ⇒ Object
382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/dommy/crypto.rb', line 382 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 end end |