@intuitionrobotics/user-account
Version:
39 lines (38 loc) • 1.31 kB
TypeScript
import { ObjectTS } from "@intuitionrobotics/ts-common";
import { Algorithm } from "jws";
export declare const ALGORITHM = "alg";
export declare const CONTENT_TYPE = "cty";
export declare const TYPE = "typ";
export declare const KEY_ID = "kid";
export declare const ISSUER = "iss";
export declare const SUBJECT = "sub";
export declare const EXPIRES_AT = "exp";
export declare const NOT_BEFORE = "nbf";
export declare const ISSUED_AT = "iat";
export declare const JWT_ID = "jti";
export declare const AUDIENCE = "aud";
export declare const TYP_DEFAULT: string;
export declare class JWTBuilder {
private payload;
private readonly header;
constructor(alg: Algorithm);
addClaims(claims: ObjectTS): this;
addClaim(key: string, value: any): this;
addHeader(key: string, value: any): this;
setContentType: (cty: string) => this;
setType: (typ: string) => this;
setKeyID: (kid: string) => this;
setIssuer(iss: string): this;
setSub(iss: string): this;
setExpiration(exp: number): this;
setNotBefore(nbf: string): this;
private setIssuedAt;
setJWTID(jti: string): this;
setAudience(aud: string): this;
private getIssuer;
private getAlgorithm;
private getExpiration;
private getType;
private assertAlg;
build(secret: string): string;
}