Class: Cryptosphere::Identity
- Inherits:
-
Object
- Object
- Cryptosphere::Identity
- Extended by:
- Forwardable
- Defined in:
- lib/cryptosphere/identity.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(private_key) ⇒ Identity
constructor
A new instance of Identity.
- #to_s ⇒ Object
Constructor Details
#initialize(private_key) ⇒ Identity
Returns a new instance of Identity.
12 13 14 15 |
# File 'lib/cryptosphere/identity.rb', line 12 def initialize(private_key) @cipher = AsymmetricCipher.new(private_key) @id = @cipher.public_key_fingerprint end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/cryptosphere/identity.rb', line 3 def id @id end |
Class Method Details
.generate ⇒ Object
8 9 10 |
# File 'lib/cryptosphere/identity.rb', line 8 def self.generate new AsymmetricCipher.generate_key end |
Instance Method Details
#to_s ⇒ Object
17 18 19 |
# File 'lib/cryptosphere/identity.rb', line 17 def to_s "#<Cryptosphere::Identity:#{id}>" end |