Interface SigningAlgorithm<I, Asym, G>

WebCrypto based signing algorithm implementation.

interface SigningAlgorithm<I, Asym, G> {
    cryptoGenerate: ((params, extractable) => Promise<If<Asym, GeneratedKeyPair<I>, GeneratedSecretKey<I>, never>>);
    importSpki?: ((spki, der) => Promise<CryptoAlgorithm.PublicKey<I>>);
    keyUsages: If<Asym, Record<"private" | "public", readonly KeyUsage[]>, Record<"secret", readonly KeyUsage[]>, {}>;
    makeLLSign: If<Asym, ((key) => LLSign), ((key) => LLSign), unknown>;
    makeLLVerify: If<Asym, ((key) => LLVerify), ((key) => LLVerify), unknown>;
    sigType: number;
    uuid: string;
}

Type Parameters

  • I = any

    Algorithm-specific per-key information.

  • Asym extends boolean = any

    Whether the algorithm is asymmetric.

  • G = any

    Key generation parameters.

Hierarchy (view full)

Properties

cryptoGenerate: ((params, extractable) => Promise<If<Asym, GeneratedKeyPair<I>, GeneratedSecretKey<I>, never>>)

Generate key pair (for asymmetric algorithm) or secret key (for symmetric algorithm).

Type declaration

    • (params, extractable): Promise<If<Asym, GeneratedKeyPair<I>, GeneratedSecretKey<I>, never>>
    • Generate key pair (for asymmetric algorithm) or secret key (for symmetric algorithm).

      Parameters

      • params: G

        Key generation parameters.

      • extractable: boolean

        Whether to generate as extractable WebCrypto key.

      Returns Promise<If<Asym, GeneratedKeyPair<I>, GeneratedSecretKey<I>, never>>

      Generated key pair or secret key.

      Remarks

      Some algorithms allow importing an existing key pair from a serialization format such as PKCS#8 or JWK. This could be supported by passing the serialized key as part of params, and then importing instead of generating in this method.

Param: params

Key generation parameters.

Param: extractable

Whether to generate as extractable WebCrypto key.

Returns

Generated key pair or secret key.

Remarks

Some algorithms allow importing an existing key pair from a serialization format such as PKCS#8 or JWK. This could be supported by passing the serialized key as part of params, and then importing instead of generating in this method.

importSpki?: ((spki, der) => Promise<CryptoAlgorithm.PublicKey<I>>)

Import public key from SubjectPublicKeyInfo.

Type declaration

Remarks

This should only appear on asymmetric algorithm.

keyUsages: If<Asym, Record<"private" | "public", readonly KeyUsage[]>, Record<"secret", readonly KeyUsage[]>, {}>

WebCrypto KeyUsages for generated keys. These are specified separately for private/public/secret keys.

Type declaration

    makeLLSign: If<Asym, ((key) => LLSign), ((key) => LLSign), unknown>

    Create a low level signing function from private key (in asymmetric algorithm) or secret key (in symmetric algorithm).

    Type declaration

    Type declaration

    makeLLVerify: If<Asym, ((key) => LLVerify), ((key) => LLVerify), unknown>

    Create a low level verification function from public key (in asymmetric algorithm) or secret key (in symmetric algorithm).

    Type declaration

    Type declaration

    sigType: number

    SigInfo.sigType number for signatures produced by this algorithm.

    uuid: string

    Identifies an algorithm in storage.

    Remarks

    This should be changed when the serialization format changes.

    Generated using TypeDoc