Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JolocomSDK

Hierarchy

  • JolocomSDK

Index

Constructors

constructor

Properties

didMethods

didMethods: DidMethodKeeper = new DidMethodKeeper()

resolver

resolver: IResolver

The toplevel resolver which simply invokes resolve

see

resolve

storage

storage: IStorage

transports

transports: TransportKeeper = new TransportKeeper()

Agent Methods

_makeAgent

  • Create an Agent instance without any identity

    Parameters

    • Optional passOrStore: string | IPasswordStore

      A password as string or IPasswordStore

    • Optional didMethodName: undefined | string

      The name of a DID method registered on this Agent's SDK instance

    Returns Agent

createAgent

  • createAgent(passOrStore?: string | IPasswordStore, didMethodName?: undefined | string): Promise<Agent>
  • Create an Agent instance with a newly registered Identity, and persist it to storage

    Parameters

    • Optional passOrStore: string | IPasswordStore

      A password as string or IPasswordStore

    • Optional didMethodName: undefined | string

      The name of a DID method registered on this Agent's SDK instance

    Returns Promise<Agent>

createAgentFromMnemonic

  • createAgentFromMnemonic(mnemonic: string, shouldOverwrite?: boolean, passOrStore?: string | IPasswordStore, didMethodName?: undefined | string): Promise<Agent>
  • Create an Agent instance with a newly registered Identity based on entropy from a BIP39 mnemonic, and persist it to storage

    Parameters

    • mnemonic: string

      A BIP39 phrase

    • Default value shouldOverwrite: boolean = false

      if true, overwrite any pre-existing identity in storage (default false)

    • Optional passOrStore: string | IPasswordStore

      A password as string or IPasswordStore

    • Optional didMethodName: undefined | string

      DID Method to use, or otherwise {@link default | setDefaultDidMethod}

    Returns Promise<Agent>

initAgent

  • initAgent(__namedParameters: { auto: undefined | false | true; did: undefined | string; password: undefined | string; passwordStore: undefined | IPasswordStore }): Promise<Agent>
  • Create an Agent instance with an Identity loaded from storage or create a new Identity if not found.

    Note that if the identity is not found a new one will be created ignoring the passed in did parameter.

    Parameters

    • __namedParameters: { auto: undefined | false | true; did: undefined | string; password: undefined | string; passwordStore: undefined | IPasswordStore }
      • auto: undefined | false | true

        whether or not to create a new identity if not found (default: true)

      • did: undefined | string

        The DID of the Agent Identity to try to load

      • password: undefined | string
      • passwordStore: undefined | IPasswordStore

    Returns Promise<Agent>

loadAgent

  • Create an Agent instance with an Identity loaded from storage

    Parameters

    • Optional passOrStore: string | IPasswordStore

      A password as string or IPasswordStore

    • Optional did: undefined | string

      The DID of the Agent Identity to load

    Returns Promise<Agent>

loadAgentFromMnemonic

  • loadAgentFromMnemonic(mnemonic: string, passOrStore?: string | IPasswordStore, didMethodName?: undefined | string): Promise<Agent>
  • Create an Agent instance with an Identity loaded from a mnemonic phrase

    Parameters

    • mnemonic: string

      A BIP39 phrase

    • Optional passOrStore: string | IPasswordStore

      A password as string or IPasswordStore

    • Optional didMethodName: undefined | string

      DID Method to use, or otherwise {@link default | setDefaultDidMethod}

    Returns Promise<Agent>

DID Method Methods

setDefaultDidMethod

  • setDefaultDidMethod(methodName: string): void
  • Set the default DID method to use for creating/loading agents. Note that it must already have been registered with sdk.didMethods.register

    Parameters

    • methodName: string

    Returns void

Other Methods

resolve

  • resolve(did: string): Promise<Identity>
  • Resolve a DID string such as did:method:123456789abcdef0 to an Identity, looking through storage cache first, then using the appropriate DIDMethod of the DidMethodKeeper

    Parameters

    • did: string

      string the did to resolve

    Returns Promise<Identity>

    the resolved identity

storeIdentityData

  • storeIdentityData(id: Identity, skp: SoftwareKeyProvider): Promise<void>
  • Stores a DID Document and its corrosponding Key Provider

    Parameters

    • id: Identity

      Identity being Stored

    • skp: SoftwareKeyProvider

      Key Provider for the Identity

    Returns Promise<void>

    void

usePlugins

  • Attach a plugin to the SDK

    note

    this is for internal use only currently

    Parameters

    Returns Promise<void>

Generated using TypeDoc