Class: SelfSDK::Key
- Inherits:
-
Object
- Object
- SelfSDK::Key
- Defined in:
- lib/signature_graph.rb
Instance Attribute Summary collapse
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#did ⇒ Object
readonly
Returns the value of attribute did.
-
#incoming ⇒ Object
readonly
Returns the value of attribute incoming.
-
#kid ⇒ Object
readonly
Returns the value of attribute kid.
-
#outgoing ⇒ Object
readonly
Returns the value of attribute outgoing.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
-
#raw_public_key ⇒ Object
readonly
Returns the value of attribute raw_public_key.
-
#revoked ⇒ Object
readonly
Returns the value of attribute revoked.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #child_keys ⇒ Object
-
#initialize(action) ⇒ Key
constructor
A new instance of Key.
- #revoke(at) ⇒ Object
- #revoked? ⇒ Boolean
- #valid_at(at) ⇒ Object
Constructor Details
permalink #initialize(action) ⇒ Key
Returns a new instance of Key.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/signature_graph.rb', line 60 def initialize(action) @kid = action[:kid] @did = action[:did] @type = action[:type] @created = action[:from] @revoked = 0 @raw_public_key = action[:key] @public_key = Ed25519::VerifyKey.new(Base64.urlsafe_decode64(@raw_public_key)) @incoming = Array.new @outgoing = Array.new end |
Instance Attribute Details
permalink #created ⇒ Object (readonly)
Returns the value of attribute created.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def created @created end |
permalink #did ⇒ Object (readonly)
Returns the value of attribute did.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def did @did end |
permalink #incoming ⇒ Object (readonly)
Returns the value of attribute incoming.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def incoming @incoming end |
permalink #kid ⇒ Object (readonly)
Returns the value of attribute kid.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def kid @kid end |
permalink #outgoing ⇒ Object (readonly)
Returns the value of attribute outgoing.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def outgoing @outgoing end |
permalink #public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def public_key @public_key end |
permalink #raw_public_key ⇒ Object (readonly)
Returns the value of attribute raw_public_key.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def raw_public_key @raw_public_key end |
permalink #revoked ⇒ Object (readonly)
Returns the value of attribute revoked.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def revoked @revoked end |
permalink #type ⇒ Object (readonly)
Returns the value of attribute type.
58 59 60 |
# File 'lib/signature_graph.rb', line 58 def type @type end |
Instance Method Details
permalink #child_keys ⇒ Object
[View source]
86 87 88 89 90 91 92 93 94 |
# File 'lib/signature_graph.rb', line 86 def child_keys keys = @outgoing.dup @outgoing.each do |k| keys.concat k.child_keys end keys end |
permalink #revoke(at) ⇒ Object
[View source]
78 79 80 |
# File 'lib/signature_graph.rb', line 78 def revoke(at) @revoked = at end |
permalink #revoked? ⇒ Boolean
82 83 84 |
# File 'lib/signature_graph.rb', line 82 def revoked? @revoked > 0 end |
permalink #valid_at(at) ⇒ Object
[View source]
74 75 76 |
# File 'lib/signature_graph.rb', line 74 def valid_at(at) created <= at && revoked == 0 || created <= at && revoked > at end |