Hierarchy

  • LinkedDataSignature
    • Sr25519Signature2020

Constructors

  • Cryptographic suite to produce and verify Sr25519Signature2020 linked data signatures. This is modelled after the Ed25519Signature2020 suite but uses the sr25519 signature scheme common in the polkadot ecosystem.

    Parameters

    • options: {
          date?: string | Date;
          key?: Sr25519VerificationKey2020;
          proof?: Proof;
          signer?: JSigsSigner;
          useNativeCanonize?: boolean;
          verifier?: JSigsVerifier;
      } = {}

      Options hashmap.

      Either a key OR at least one of signer/verifier is required.

      • Optional date?: string | Date

        Signing date to use if not passed.

      • Optional key?: Sr25519VerificationKey2020

        An optional key object (containing an id property, and either signer or verifier, depending on the intended operation. Useful for when the application is managing keys itself (when using a KMS, you never have access to the private key, and so should use the signer param instead).

      • Optional proof?: Proof

        A JSON-LD document with options to use for the proof node (e.g. any other custom fields can be provided here using a context different from security-v2).

      • Optional signer?: JSigsSigner

        Signer function that returns an object with an async sign() method. This is useful when interfacing with a KMS (since you don't get access to the private key and its signer(), the KMS client gives you only the signer function to use).

      • Optional useNativeCanonize?: boolean

        Whether to use a native canonize algorithm.

      • Optional verifier?: JSigsVerifier

        Verifier function that returns an object with an async verify() method. Useful when working with a KMS-provided verifier function.

        Advanced optional parameters and overrides.

    Returns Sr25519Signature2020

Properties

LDKeyClass: typeof Sr25519VerificationKey2020
signer?: JSigsSigner
verifier?: JSigsVerifier
CONTEXT: any = ...
CONTEXT_URL: "https://www.kilt.io/contexts/credentials" = SUITE_CONTEXT_URL

Methods

  • Parameters

    • __namedParameters: Pick<Options, "document" | "proof"> & Partial<Pick<Options, "documentLoader" | "purpose">>

    Returns Promise<boolean>

  • Adds a signature (proofValue) field to the proof object. Called by LinkedDataSignature.createProof().

    Parameters

    • options: Pick<Options, "proof" | "verifyData">

      The options to use.

    Returns Promise<{
        proofValue: string;
    } & Proof>

    Resolves with the proof containing the signature value.

  • Verifies the proof signature against the given data.

    Parameters

    • options: Pick<Options, "verificationMethod" | "proof" | "verifyData">

      The options to use.

    Returns Promise<boolean>

    Resolves with the verification result.