Class: SelfSDK::Messages::FactIssue
- Defined in:
- lib/messages/fact_issue.rb
Constant Summary collapse
- MSG_TYPE =
"identities.facts.issue"
- DEFAULT_EXP_TIMEOUT =
900
Instance Attribute Summary
Attributes inherited from Base
#description, #exp_timeout, #expires, #fields, #from, #from_device, #id, #input, #intermediary, #payload, #status, #sub, #to, #to_device, #typ
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(messaging) ⇒ FactIssue
constructor
A new instance of FactIssue.
- #populate(selfid, facts, opts) ⇒ Object
Methods inherited from Base
#accepted?, #encrypt_message, #errored?, #rejected?, #request, #send_message, #unauthorized?, #validate!
Constructor Details
Instance Method Details
#body ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/messages/fact_issue.rb', line 30 def body b = { typ: MSG_TYPE, iss: @jwt.id, aud: @to, sub: @to, iat: SelfSDK::Time.now.strftime('%FT%TZ'), exp: (SelfSDK::Time.now + @exp_timeout).strftime('%FT%TZ'), cid: @id, jti: SecureRandom.uuid, status: 'verified', attestations: @attestations } # viewers b[:viewers] = @viewers unless @viewers.nil? b end |
#populate(selfid, facts, opts) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/messages/fact_issue.rb', line 20 def populate(selfid, facts, opts) @id = opts.fetch(:cid, SecureRandom.uuid) @exp_timeout = opts.fetch(:exp_timeout, DEFAULT_EXP_TIMEOUT) @viewers = opts.fetch(:viewers, nil) @from = @jwt.id @to = selfid @attestations = build_attestations!(facts) end |