import { KVMap, RawMap } from './map'; /** * Claims represents a set of common claims for CWT. * * Encode claims as the payload of a COSE message, commonly COSE_Sign1, then * apply withCWTTag() when the surrounding protocol expects the CWT tag. * * @example * ```ts * const claims = new Claims() * claims.iss = 'issuer' * claims.aud = 'service' * claims.exp = Math.floor(Date.now() / 1000) + 3600 * const token = withCWTTag(new Sign1Message(claims.toBytes()).toBytes(key)) * ``` * * Reference https://www.iana.org/assignments/cwt/cwt.xhtml */ export declare class Claims extends KVMap { static fromBytes(data: Uint8Array): Claims; constructor(kv?: RawMap); get iss(): string; set iss(iss: string); get sub(): string; set sub(sub: string); get aud(): string; set aud(aud: string); get exp(): number; set exp(exp: number); get nbf(): number; set nbf(nbf: number); get iat(): number; set iat(iat: number); get cti(): Uint8Array; set cti(cti: Uint8Array); get cnf(): RawMap; set cnf(cnf: RawMap); get scope(): string; set scope(scope: string); get nonce(): Uint8Array; set nonce(nonce: Uint8Array); } export declare function withCWTTag(coseData: Uint8Array): Uint8Array; export interface ValidatorOpts { expectedIssuer: string; expectedAudience: string; allowMissingExpiration: boolean; expectIssuedInThePast: boolean; clockSkew: number; fixedNow: Date | null; } /** * Validator checks CWT time, issuer, and audience claims according to the * provided profile options. * * @example * ```ts * new Validator({ * expectedIssuer: 'issuer', * expectedAudience: 'service' * }).validate(claims) * ``` */ export declare class Validator { private opts; constructor(opts?: Partial); validate(claims: Claims): void; }