This interface parametrizes SignerKey and extends it with Ed specific details.

Hierarchy

Properties

code: MulticodecCode<4864, "ed25519-private-key">

Multicodec code that corresponds to Ed private key.

signatureAlgorithm: "EdDSA"

Name of the signature algorithm. It is a human readable equivalent of the signatureCode, however it is also used as last segment in Nonstandard Signatures, which is used as an alg field of JWT header when UCANs are serialized to JWT.

signatureCode: SigAlg

Integer corresponding to the byteprefix of the Crypto.SigAlg. It is used to tag signature so it can self describe what algorithm was used.

signer: EdSigner

The signer field is a self reference (usually a getter). It's sole purpose is to allow splitting signer and verifier through destructuring.

Example

import * as Principal from "@ucanto/principal"

const { signer, verifier } = Principal.from(archive)
verifier: EdVerifier

The verifier field just like the signer exists to allow splitting them apart through destructuring.

Methods

  • Returns `did:key:${string}`

  • Type Parameters

    • T

      Source data before it was byte encoding into payload.

      Takes byte encoded payload and produces a verifiable signature.

    Parameters

    Returns Await<SignatureView<T, SigAlg>>

  • Returns unwrapped did:key of this principal.

    Returns `did:key:${string}`

  • Type Parameters

    • T

      Source data before it was byte encoding into payload.

      Takes byte encoded payload and verifies that it is signed by corresponding signer.

    Parameters

    Returns Await<boolean>

  • Wraps key of this signer into a signer with a different DID. This is primarily used to wrap SignerKey into a Signer that has did of different method.

    Type Parameters

    • ID extends `did:${string}:${string}`

    Parameters

    • id: ID

    Returns Signer<ID, SigAlg>

    Example

    import { ed25519 } from "@ucanto/principal"

    const demo = async () => {
    const key = await ed25519.generate()
    key.did() // 'did:key:z6Mkqa4oY9Z5Pf5tUcjLHLUsDjKwMC95HGXdE1j22jkbhz6r'
    const gozala = key.withDID('did:web:gozala.io')
    gozala.did() // 'did:web:gozala.io'
    }

Generated using TypeDoc