Class: Skyfall::Jetstream::IdentityMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/skyfall/jetstream/identity_message.rb

Overview

Jetstream message sent when a new DID is created or when the details of someone’s DID document are changed (usually either a handle change or a migration to a different PDS). The message should include currently assigned handle (though the field is not required).

Note: the message is originally emitted from the account’s PDS and is passed as is by relays, which means you can’t fully trust that the handle is actually correctly assigned to the DID and verified by DNS or well-known. To confirm that, use DID.resolve_handle from [DIDKit](ruby.sdk.blue/didkit/).

Instance Attribute Summary

Attributes inherited from Message

#did, #json, #time_us, #type

Instance Method Summary collapse

Methods inherited from Message

new, #operation, #operations, #time, #unknown?

Constructor Details

#initialize(json) ⇒ IdentityMessage

Returns a new instance of IdentityMessage.

Parameters:

  • json (Hash)

    message JSON decoded from the websocket message

Raises:

  • (DecodeError)

    if the message doesn’t include required data



26
27
28
29
# File 'lib/skyfall/jetstream/identity_message.rb', line 26

def initialize(json)
  raise DecodeError.new("Missing event details (identity)") if json['identity'].nil?
  super
end

Instance Method Details

#handleString?

Returns current handle assigned to the DID.

Returns:

  • (String, nil)

    current handle assigned to the DID



32
33
34
# File 'lib/skyfall/jetstream/identity_message.rb', line 32

def handle
  @json['identity']['handle']
end