Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ed25519KeyIdentity

Ed25519KeyIdentity is an implementation of SignIdentity that uses Ed25519 keys. This class is used to sign and verify messages for an agent.

Hierarchy

  • SignIdentity
    • Ed25519KeyIdentity

Index

Constructors

Properties

#privateKey: Uint8Array
#publicKey: Ed25519PublicKey
_principal: undefined | Principal

Methods

  • getKeyPair(): KeyPair
  • getPrincipal(): Principal
  • Get the principal represented by this identity. Normally should be a Principal.selfAuthenticating().

    Returns Principal

  • getPublicKey(): Required<PublicKey>
  • sign(challenge: ArrayBuffer): Promise<Signature>
  • Signs a blob of data, with this identity's private key.

    Parameters

    • challenge: ArrayBuffer

      challenge to sign with this identity's secretKey, producing a signature

    Returns Promise<Signature>

  • toJSON(): JsonnableEd25519KeyIdentity
  • transformRequest(request: HttpAgentRequest): Promise<unknown>
  • Transform a request into a signed version of the request. This is done last after the transforms on the body of a request. The returned object can be anything, but must be serializable to CBOR.

    Parameters

    • request: HttpAgentRequest

      internet computer request to transform

    Returns Promise<unknown>

  • verify(sig: string | ArrayBuffer | Uint8Array, msg: string | ArrayBuffer | Uint8Array, pk: string | ArrayBuffer | Uint8Array): boolean
  • Verify

    Parameters

    • sig: string | ArrayBuffer | Uint8Array

      signature to verify

    • msg: string | ArrayBuffer | Uint8Array

      message to verify

    • pk: string | ArrayBuffer | Uint8Array

      public key

    Returns boolean

    • true if the signature is valid, false otherwise

Generated using TypeDoc