UNPKG

@a4smanjorg5/invoida

Version:

> Core signing and cryptographic module for the Invoida project

31 lines 1.36 kB
import { type JWK } from 'jose'; /** * Generates a new ES256 key pair and saves both the public JWK and private PEM to the filesystem. * * @param {string} [kid] - Optional key ID. If not provided, a random one will be generated. * @returns {Promise<JWK>} A promise that resolves to the public JWK with the key ID. */ export declare const generateKeyPair: (kid?: string) => Promise<JWK>; /** * Lists all saved public JWK keys from the filesystem. * * @returns {Promise<JWK[]>} A promise that resolves to an array of JWKs. */ export declare const listKeys: () => Promise<JWK[]>; /** * Removes both the PEM and JWK files associated with the given key ID from the filesystem. * * @param {string} kid - The key ID whose files should be removed. * @returns {Promise<void>} A promise that resolves once both files have been deleted. */ export declare const removeKeyPair: (kid: string) => Promise<void>; /** * Signs a payload using the private key associated with the given key ID (kid). * * @template T * @param {Record<string, T>} payload - The payload to sign. * @param {string} kid - The key ID of the signing key. * @returns {Promise<string>} A promise that resolves to the compact JWS (JSON Web Signature) string. */ export declare const sign: <T>(payload: Record<string, T>, kid: string) => Promise<string>; //# sourceMappingURL=index.d.ts.map