Skip to content

Commit

Permalink
expose cid property on PLCOperation
Browse files Browse the repository at this point in the history
  • Loading branch information
mackuba committed Aug 19, 2024
1 parent 456b481 commit 3ee0c43
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/didkit/plc_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ class FormatError < StandardError
include AtHandles
include Services

attr_reader :json, :did, :created_at, :type, :handles, :services
attr_reader :json, :did, :cid, :created_at, :type, :handles, :services

def initialize(json)
@json = json
@did = json['did']
raise FormatError, "Missing DID: #{json}" if @did.nil?
raise FormatError, "Invalid DID: #{@did}" unless @did.is_a?(String) && @did.start_with?('did:')

@cid = json['cid']
raise FormatError, "Missing CID: #{json}" if @cid.nil?
raise FormatError, "Invalid CID: #{@cid}" unless @cid.is_a?(String)

timestamp = json['createdAt']
raise FormatError, "Missing createdAt: #{json}" if timestamp.nil?
raise FormatError, "Invalid createdAt: #{timestamp.inspect}" unless timestamp.is_a?(String)
Expand Down

0 comments on commit 3ee0c43

Please sign in to comment.