Options
All
  • Public
  • Public/Protected
  • All
Menu

A private Ed25519 signing key and its corresponding public key.

Hierarchy

  • KeyPair

Index

Constructors

  • new KeyPair(privateKey: Uint8Array, publicKey: Uint8Array): KeyPair
  • Create a new KeyPair object from raw key byte buffers.

    See create for key generation, and fromExportedKey to load previously generated keys.

    Parameters

    • privateKey: Uint8Array

      private key bytes

    • publicKey: Uint8Array

      public key bytes

    Returns KeyPair

Properties

privateKey: Uint8Array
pubStr: undefined | string
publicKey: Uint8Array

Methods

  • did(): string
  • Create did from public key

    Returns string

    the public key, encoded into a did:key: DID string.

  • export(): string
  • Export the private key (e.g. to save to disk). If saving to disk, MUST be stored securely! See fromExportedKey for loading a KeyPair from an exported key.

    Returns string

    the encoded private key string

  • publicKeyStr(): string
  • Return the Base64 encoded public key

    Returns string

    the public key, as a base64 encoded string (padded).

  • sign(msg: Uint8Array): Promise<Uint8Array>
  • Create a signature of msg using the private signing key.

    Parameters

    • msg: Uint8Array

      a message to sign

    Returns Promise<Uint8Array>

    a Promise that resolves to the signature (as a Uint8Array)

  • Generate a new KeyPair.

    Returns Promise<KeyPair>

    a Promise that resolves to the generated KeyPair

  • fromExportedKey(key: string): Promise<KeyPair>
  • Create a KeyPair from exported private key (see export).

    Parameters

    • key: string

      a private key, as encoded by export

    Returns Promise<KeyPair>

    a Promise that resolves to the loaded KeyPair object

Generated using TypeDoc