/** * @typedef {import('./internal/keys.js').KeyInput} KeyInput * * @typedef {Object} SignOptions * @property {string} alg * @property {string | number} [expiresIn] * @property {string | number} [notBefore] * @property {string} [issuer] * @property {string | string[]} [audience] * @property {string} [subject] * @property {boolean | { size?: number, encoding?: string } | (() => string | Promise)} [jwtId] * @property {string} [nonce] * @property {string} [typ] Header `typ`. Default `'JWT'`. `'at+jwt'` for RFC 9068. * @property {string} [kid] * @property {Record} [header] * @property {boolean} [noTimestamp] * @property {boolean} [returnMetadata] * * @typedef {Object} SignResultMeta * @property {string} token * @property {string} [jti] * @property {Date} [expiresAt] * @property {Date} [issuedAt] * @property {string} alg * @property {string} [kid] */ /** * @param {Record} payload * @param {KeyInput} key * @param {SignOptions} options * @returns {Promise} */ export function sign(payload: Record, key: KeyInput, options: SignOptions): Promise; export type KeyInput = import("./internal/keys.js").KeyInput; export type SignOptions = { alg: string; expiresIn?: string | number | undefined; notBefore?: string | number | undefined; issuer?: string | undefined; audience?: string | string[] | undefined; subject?: string | undefined; jwtId?: boolean | { size?: number; encoding?: string; } | (() => string | Promise) | undefined; nonce?: string | undefined; /** * Header `typ`. Default `'JWT'`. `'at+jwt'` for RFC 9068. */ typ?: string | undefined; kid?: string | undefined; header?: Record | undefined; noTimestamp?: boolean | undefined; returnMetadata?: boolean | undefined; }; export type SignResultMeta = { token: string; jti?: string | undefined; expiresAt?: Date | undefined; issuedAt?: Date | undefined; alg: string; kid?: string | undefined; };