class SelfSDK::Key

Attributes

created[R]
did[R]
incoming[R]
kid[R]
outgoing[R]
public_key[R]
raw_public_key[R]
revoked[R]
type[R]

Public Class Methods

new(action) click to toggle source
# File lib/signature_graph.rb, line 62
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

Public Instance Methods

child_keys() click to toggle source
# File lib/signature_graph.rb, line 88
def child_keys
  keys = @outgoing.dup

  @outgoing.each do |k|
    keys.concat k.child_keys
  end

  keys
end
revoke(at) click to toggle source
# File lib/signature_graph.rb, line 80
def revoke(at)
  @revoked = at
end
revoked?() click to toggle source
# File lib/signature_graph.rb, line 84
def revoked?
  @revoked > 0
end
valid_at(at) click to toggle source
# File lib/signature_graph.rb, line 76
def valid_at(at)
  created <= at && revoked == 0 || created <= at && revoked > at
end