import type { TokenPayload, TokenPayloadEncoded, TokenSignatureEncoded, TokenHeaderSignature, TokenHeaderSignatureEncoded, SignedToken, SignedTokenEncoded } from './types.js'; import type { Key, PublicKey, PrivateKey, KeyPair } from '../keys/types.js'; import type { POJO } from '../types.js'; /** * Token represents a single token with methods to sign and verify. * This token is derived from a strict subset of the JWS specification. * The token payload must abide by the registered claims of JWS, additional * properties that do not conflict are allowed. * For public key signatures, it only supports `EdDSA` algorithm. * For MAC signatures, it only supports `BLAKE2b` algorithm. * Multiple signatures are allowed, including 0 signatures. * During signing, additional properties can be part of the protected header. * The encoded format is compatible with the General JWS JSON format. */ declare class Token
{ readonly payload: Readonly
;
readonly payloadEncoded: TokenPayloadEncoded;
protected _signatures: Array (payload: P): Token ;
static fromSigned (tokenSigned: SignedToken ): Token ;
/**
* Construct from encoded payload.
* It is up the caller to decide what the payload type should be.
*/
static fromEncoded (signedTokenEncoded: SignedTokenEncoded): Token ;
constructor(payload: P, payloadEncoded: TokenPayloadEncoded, signatures?: Array ;
/**
* Exports this `Token` into `SignedTokenEncoded`
*/
toEncoded(): SignedTokenEncoded;
/**
* The JSON representation of this `Token` is `SignedTokenEncoded`
*/
toJSON(): SignedTokenEncoded;
}
export default Token;