AuthProvider defines the interface your custom authProvider must must implement. The properties network, id, name, image are all required.

AuthProvider is expected to handle just one address. One could use #withAddress to instantiate AuthProvider with another address.

Hierarchy

  • AuthProvider

Implemented by

Properties

isAuthProvider: true

Methods

  • (Required) Authenticate function consumes both a message (human readable string) and accountId (often a hex address). It is strictly required that for any given set of {message, accountId} this function deterministically returns a unique 32 - 64 byte hex string of entropy. This will allow this external account to continue to access 3ID in the future and for it be added as an auth method.

    For most implementations this will be signing the message with an account/wallet from your blockchain account provider and returning a fixed length string of the signature by hashing it. This function does not need to consume accountId/address if your provider knows that value at later point of the interaction. But should still map to a unique output for any given message and accountId pair.

    For your given network/blockchain you should be able to find an authenticate function in https://github.com/ceramicnetwork/js-3id-blockchain-utils, if you are using the standard account signing interface in your network/blockchain. If you are using a standard interface and it doesn't exist in js-3id-blockchain-utils, please open an issue there, so we can add shared support for your network.

    Returns

    A 32-64 bytes hex string

    Parameters

    • message: string

      A human readable string

    Returns Promise<string>