Class: SingletonBeacon ​
Defined in: packages/method/src/core/beacon/singleton.ts:27
Implements 5.1 Singleton Beacon.
A Singleton Beacon enables a single entity to independently post a DID Update Payload in a Beacon Signal. Its is a Beacon that can be used to publish a single DID Update Payload targeting a single DID document. The serviceEndpoint for this Beacon Type is a Bitcoin address represented as a URI following the BIP21 scheme. It is recommended that this Bitcoin address be under the sole control of the DID controller. How the Bitcoin address and the cryptographic material that controls it are generated is left to the implementation.
SingletonBeacon
Extends ​
Constructors ​
Constructor ​
new SingletonBeacon(
service,sidecar?):SingletonBeacon
Defined in: packages/method/src/core/beacon/singleton.ts:34
Creates an instance of SingletonBeacon.
Parameters ​
service ​
The Beacon service.
sidecar? ​
Optional sidecar data.
Returns ​
SingletonBeacon
Overrides ​
Properties ​
id ​
id:
string
Defined in: packages/method/src/interfaces/beacon.ts:106
A unique identifier for the Beacon
Inherited from ​
serviceEndpoint ​
serviceEndpoint:
DidServiceEndpoint
Defined in: packages/method/src/interfaces/beacon.ts:108
The service endpoint of the Beacon
Inherited from ​
sidecar? ​
optionalsidecar:SidecarData
Defined in: packages/method/src/interfaces/beacon.ts:109
Inherited from ​
type ​
type:
string
Defined in: packages/method/src/interfaces/beacon.ts:107
The type of the Beacon
Inherited from ​
Accessors ​
service ​
Get Signature ​
get service():
BeaconService
Defined in: packages/method/src/core/beacon/singleton.ts:43
Get the Beacon service.
Returns ​
Returns the Beacon Service object
Overrides ​
Methods ​
broadcastSignal() ​
broadcastSignal(
didUpdatePayload):Promise<SignalsMetadata>
Defined in: packages/method/src/core/beacon/singleton.ts:180
Implements 5.1.2 Broadcast Singleton Beacon Signal.
The Broadcast Singleton Beacon Signal algorithm is called by the Announce DID Update algorithm as part of the Update operation, if the Beacon being used is of the type SingletonBeacon. It takes as input a Beacon service and a secured didUpdatePayload. The algorithm constructs a Bitcoin transaction that spends from the Beacon address identified in the service and contains a transaction output of the format [OP_RETURN, OP_PUSH32, <hashBytes>], where hashBytes is the SHA256 hash of the canonical didUpdatePayload. The Bitcoin transaction is then signed and broadcast to the Bitcoin network, thereby publicly announcing a DID update in a Beacon Signal. It returns a signalMetadata object mapping the Bitcoin transaction identifier of the Beacon Signal to the necessary data needed to verify the signal announces a specific DID Update Payload.
TODO: Design and implement a way to construct, sign and send via RPC
Parameters ​
didUpdatePayload ​
The verificationMethod object to be used for signing.
Returns ​
Promise<SignalsMetadata>
Successful output of a bitcoin transaction.
Throws ​
if the bitcoin address is invalid or unfunded.
Overrides ​
generateSignal() ​
generateSignal(
didUpdatePayload):BeaconSignal
Defined in: packages/method/src/core/beacon/singleton.ts:77
TODO: Figure out if this is necessary or not.
Parameters ​
didUpdatePayload ​
string
The DID Update Payload to generate the signal for.
Returns ​
The generated signal.
Throws ​
if the signal is invalid.
Overrides ​
processSignal() ​
processSignal(
signal,signalsMetadata):Promise<DidUpdatePayload|undefined>
Defined in: packages/method/src/core/beacon/singleton.ts:97
TODO: Finish implementation per spec
Implements 5.1.3 Process Singleton Beacon Signal. See Abstract Beacon Interface Method processSignal for more details.
The Process Singleton Beacon Signal algorithm is called by the Process Beacon Signals algorithm as part of the Read operation. It takes a Bitcoin transaction representing a Beacon Signal and optional signalSidecarData containing any sidecar data provided to the resolver for the Beacon Signal identified by the Bitcoin transaction identifier. It returns the DID Update payload announced by the Beacon Signal or throws an error.
Parameters ​
signal ​
Bitcoin transaction representing a Beacon Signal.
RawTransactionV2 | RawTransactionRest
signalsMetadata ​
Returns ​
Promise<DidUpdatePayload | undefined>
The DID Update payload announced by the Beacon Signal.
Throws ​
if the signalTx is invalid or the signalSidecarData is invalid.
Overrides ​
establish() ​
staticestablish(service,sidecar):SingletonBeacon
Defined in: packages/method/src/core/beacon/singleton.ts:67
Implements 5.1.1 Establish Singleton Beacon.
Static, convenience method for establishing a Beacon object.
A Singleton Beacon is a Beacon that can be used to publish a single DID Update Payload targeting a single DID document. The serviceEndpoint for this Beacon Type is a Bitcoin address represented as a URI following the BIP21 scheme. It is RECOMMENDED that this Bitcoin address be under the sole control of the DID controller. How the Bitcoin address and the cryptographic material that controls it are generated is left to the implementation. The Establish Singleton Beacon algorithm takes in a Bitcoin address and a serviceId and returns a Singleton Beacon service. It returns a SignletonBeacon object with the given id, type, and serviceEndpoint.
Parameters ​
service ​
The Beacon service.
sidecar ​
The sidecar data.
Returns ​
SingletonBeacon
The Singleton Beacon.