@ldclabs/cose-ts
Version:
Implemented Keys, Algorithms (RFC9053), COSE (RFC9052) and CWT (RFC8392) in TypeScript.
40 lines (39 loc) • 1.1 kB
TypeScript
import { KVMap, RawMap } from './map';
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;
}
export declare class Validator {
private opts;
constructor(opts?: Partial<ValidatorOpts>);
validate(claims: Claims): void;
}