@tai-kun/surrealdb
Version:
The SurrealDB SDK for JavaScript
51 lines • 1.37 kB
TypeScript
import type { Encodable } from "@tai-kun/surrealdb/encodable-datatypes";
export interface JwtHeader {
typ: "JWT";
alg: string;
[p: string]: unknown;
}
export interface JwtPayload {
iss: "SurrealDB";
iat: number;
nbf: number;
exp: number;
jti: string;
NS?: string;
DB?: string;
AC?: string;
ID: string;
[p: string]: unknown;
}
export interface JwtOptions {
readonly redactedText?: string | undefined;
}
export default class Jwt implements Encodable {
#private;
static isWellFormed(jwt: string): boolean;
redactedText: string;
readonly raw: string;
constructor(jwt: string, options?: JwtOptions | undefined);
get header(): JwtHeader;
get payload(): JwtPayload;
get issuer(): "SurrealDB";
get issuedAt(): number;
get notBefore(): number;
get expiresAt(): number;
get namespace(): string | undefined;
get database(): string | undefined;
get access(): string | undefined;
get user(): string;
get id(): string;
getMillisecondsUntilExpiration(): number;
getSecondsUntilExpiration(): number;
getExpirationDate(): Date;
toString(): string;
toCBOR(): [redactedText: string];
toJSON(): string;
toSurql(): string;
toPlainObject(): {
header: JwtHeader;
payload: JwtPayload;
};
}
//# sourceMappingURL=jwt.d.ts.map