@did-btc1/method
    Preparing search index...

    Class BeaconUtils

    Static class of utility functions for the Beacon Service BeaconUtils

    Index

    Constructors

    Methods

    • Generate beacon services.

      Parameters

      • params: { beaconType: string; network: string; publicKey: Bytes }

        Required parameters for generating Beacon Services.

        • beaconType: string

          Optional beacon type to use (default: SingletonBeacon).

        • network: string

          The name of the Bitcoin network to use.

        • publicKey: Bytes

          Byte array representation of a public key used to generate a new btc1 key-id-type.

      Returns BeaconService[]

      Array of DidService objects.

    • Generate a set of Beacon Services for a given public key.

      Parameters

      • params: { network: Network; publicKey: Bytes }

        Required parameters for generating Beacon Services.

        • network: Network

          Bitcoin network interface from bitcoinlib-js.

        • publicKey: Bytes

          Public key bytes used to generate the beacon object serviceEndpoint.

      Returns string[][]

      2D Array of bitcoin addresses (p2pkh, p2wpkh, p2tr).

      if the bitcoin address is invalid.

    • Extracts the services from a given DID Document

      Parameters

      • didDocument: { didDocument: DidDocument }

        The DID Document to extract the services from

      Returns BeaconService[]

      An array of DidService objects

      if the didDocument is not provided

    • Validates that the given object is a Beacon Service

      Parameters

      • obj: any

        The object to validate

      Returns boolean

      A boolean indicating whether the object is a Beacon Service

    • Converts a BIP21 Bitcoin URI to a Bitcoin address

      Parameters

      • uri: string

        The BIP21 Bitcoin URI to convert

      Returns string

      The Bitcoin address extracted from the URI

      if the URI is not a valid Bitcoin URI