Class: Virgil::SDK::Cryptography::Keys::StorageItem
- Inherits:
-
Struct
- Object
- Struct
- Virgil::SDK::Cryptography::Keys::StorageItem
- Defined in:
- lib/virgil/sdk/cryptography/keys/storage_item.rb
Overview
StorageItem class represents a key pair storage entry.
Instance Attribute Summary collapse
-
#data ⇒ Crypto::Bytes
key pair in bytes.
-
#meta ⇒ Hash
the meta data associated with key pair.
-
#name ⇒ String
Gets or sets the name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Crypto::Bytes
key pair in bytes
45 46 47 |
# File 'lib/virgil/sdk/cryptography/keys/storage_item.rb', line 45 def data @data end |
#meta ⇒ Hash
the meta data associated with key pair.
45 46 47 |
# File 'lib/virgil/sdk/cryptography/keys/storage_item.rb', line 45 def @meta end |
#name ⇒ String
Gets or sets the name.
45 46 47 |
# File 'lib/virgil/sdk/cryptography/keys/storage_item.rb', line 45 def name @name end |
Class Method Details
.restore_from_json(name, str_json) ⇒ Object
56 57 58 59 |
# File 'lib/virgil/sdk/cryptography/keys/storage_item.rb', line 56 def self.restore_from_json(name, str_json) model = JSON.parse(str_json) new(name, HighLevel::VirgilBuffer.from_base64(model['data']).bytes, model['meta']) end |
Instance Method Details
#to_json ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/virgil/sdk/cryptography/keys/storage_item.rb', line 47 def to_json model = { 'data': HighLevel::VirgilBuffer.new(data).to_base64, 'meta': } model.to_json end |