parse-cosekey
Version:
Parse COSE(CBOR Object Signing and Encryption) to JWK(JSON Web Key) or PEM.
252 lines (251 loc) • 10.7 kB
TypeScript
/**
* JSON Web Key (JWK) Types class.
* "kty" (Key Type) parameter.
*
* RFC: {@link https://datatracker.ietf.org/doc/html/rfc7517#section-4.1}
*
* Registry: {@link https://www.iana.org/assignments/jose/jose.xhtml#web-key-types}
*/
declare class JSONWebKeyType {
private _value;
private _description;
static _values: JSONWebKeyType[];
static readonly EC: JSONWebKeyType;
static readonly RSA: JSONWebKeyType;
static readonly OCT: JSONWebKeyType;
static readonly OKP: JSONWebKeyType;
/**
* Private constructor.
*
* @param _value key type.key type.
* @param _description Key type description
*/
private constructor();
/**
* Returns key type.
*
* @returns Key type
*/
get value(): string;
/**
* Returns key type description.
*
* @returns Key type description
*/
get description(): string;
/**
* Returns all JWK key type class.
*
* @returns All JWK key type class
*/
static values(): JSONWebKeyType[];
/**
* Returns JWK key type class which has same key type to function's parameter.
*
* @param value Target key type
* @returns JWK key type class, if not found returns null
*/
static fromValue(value: string): JSONWebKeyType | null;
}
/**
* JSON Web Signature and Encryption Algorithms class.
* "alg" (Algorithm) parameter.
*
* RFC: {@link https://datatracker.ietf.org/doc/html/rfc7517#section-4.4}
*
* Registry: {@link https://www.iana.org/assignments/jose/jose.xhtml#web-signature-encryption-algorithms}
*/
declare class JSONWebSignatureAndEncryptionAlgorithm {
private _name;
private _description;
private _nodeCryptoHashAlg;
static _values: JSONWebSignatureAndEncryptionAlgorithm[];
static readonly HS256: JSONWebSignatureAndEncryptionAlgorithm;
static readonly HS384: JSONWebSignatureAndEncryptionAlgorithm;
static readonly HS512: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RS256: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RS384: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RS512: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ES256: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ES384: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ES512: JSONWebSignatureAndEncryptionAlgorithm;
static readonly PS256: JSONWebSignatureAndEncryptionAlgorithm;
static readonly PS384: JSONWebSignatureAndEncryptionAlgorithm;
static readonly PS512: JSONWebSignatureAndEncryptionAlgorithm;
static readonly NONE: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RSA1_5: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RSA_OAEP: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RSA_OAEP_256: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A128KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A192KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A256KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly DIR: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ECDH_ES: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ECDH_ES_A128KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ECDH_ES_A192KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ECDH_ES_A256KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A128GCMKW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A192GCMKW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A256GCMKW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly PBES2_HS256_A128KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly PBES2_HS384_A192KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly PBES2_HS512_A256KW: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A128CBC_HS256: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A192CBC_HS384: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A256CBC_HS512: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A128GCM: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A192GCM: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A256GCM: JSONWebSignatureAndEncryptionAlgorithm;
static readonly EdDSA: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RS1: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RSA_OAEP_384: JSONWebSignatureAndEncryptionAlgorithm;
static readonly RSA_OAEP_512: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A128CBC: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A192CBC: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A256CBC: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A128CTR: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A192CTR: JSONWebSignatureAndEncryptionAlgorithm;
static readonly A256CTR: JSONWebSignatureAndEncryptionAlgorithm;
static readonly HS1: JSONWebSignatureAndEncryptionAlgorithm;
static readonly ES256K: JSONWebSignatureAndEncryptionAlgorithm;
/**
* Private constructor.
*
* @param _name Algorithm name
* @param _description Algorithm description
* @param _nodeCryptoHashAlg Node.js crypto module's algorithm name
*/
private constructor();
/**
* Returns algorithm name.
*
* @returns Algorithm name
*/
get name(): string;
/**
* Returns algorithm description.
*
* @returns Algorithm description
*/
get description(): string;
/**
* Returns Node.js crypto module's algorithm name.
*
* @returns Node.js crypto module's algorithm name
*/
get nodeCryptoHashAlg(): string | null;
/**
* Returns all JSON Web Signature and Encryption Algorithms class.
*
* @returns All JSON Web Signature and Encryption Algorithms class
*/
static values(): JSONWebSignatureAndEncryptionAlgorithm[];
/**
* Returns JSON Web Signature and Encryption Algorithms class which has same algorithm name to function's parameter.
*
* @param name Target algorithm name
* @returns JSON Web Signature and Encryption Algorithms class, if not found returns null
*/
static fromName(name: string): JSONWebSignatureAndEncryptionAlgorithm | null;
}
/**
* JSON Web Key Elliptic Curve class.
*
* RFC: {@link https://www.rfc-editor.org/rfc/rfc7518.html#section-6.2.1.1}
*
* Registry: {@link https://www.iana.org/assignments/jose/jose.xhtml#web-key-elliptic-curve}
*/
declare class JSONWebKeyEllipticCurve {
private _name;
private _description;
static _values: JSONWebKeyEllipticCurve[];
static readonly P_256: JSONWebKeyEllipticCurve;
static readonly P_384: JSONWebKeyEllipticCurve;
static readonly P_521: JSONWebKeyEllipticCurve;
static readonly ED25519: JSONWebKeyEllipticCurve;
static readonly ED448: JSONWebKeyEllipticCurve;
static readonly X25519: JSONWebKeyEllipticCurve;
static readonly X448: JSONWebKeyEllipticCurve;
static readonly SECP256K1: JSONWebKeyEllipticCurve;
/**
* Private constructor.
*
* @param _name Curve name
* @param _description Curve description
*/
private constructor();
get name(): string;
get description(): string;
static values(): JSONWebKeyEllipticCurve[];
static fromName(name: string): JSONWebKeyEllipticCurve | null;
}
declare class JSONWebKeyParameter {
private _name;
private _description;
private _usedWith;
static _values: JSONWebKeyParameter[];
static readonly KTY: JSONWebKeyParameter;
static readonly USE: JSONWebKeyParameter;
static readonly KEY_OPS: JSONWebKeyParameter;
static readonly ALG: JSONWebKeyParameter;
static readonly KID: JSONWebKeyParameter;
static readonly X5U: JSONWebKeyParameter;
static readonly X5C: JSONWebKeyParameter;
static readonly X5T: JSONWebKeyParameter;
static readonly X5T_SHARP_S256: JSONWebKeyParameter;
static readonly EC_CRV: JSONWebKeyParameter;
static readonly EC_X: JSONWebKeyParameter;
static readonly EC_Y: JSONWebKeyParameter;
static readonly EC_D: JSONWebKeyParameter;
static readonly N: JSONWebKeyParameter;
static readonly E: JSONWebKeyParameter;
static readonly RSA_D: JSONWebKeyParameter;
static readonly P: JSONWebKeyParameter;
static readonly Q: JSONWebKeyParameter;
static readonly DP: JSONWebKeyParameter;
static readonly DQ: JSONWebKeyParameter;
static readonly QI: JSONWebKeyParameter;
static readonly OTH: JSONWebKeyParameter;
static readonly K: JSONWebKeyParameter;
static readonly OKP_CRV: JSONWebKeyParameter;
static readonly OKP_D: JSONWebKeyParameter;
static readonly OKP_X: JSONWebKeyParameter;
static readonly EXT: JSONWebKeyParameter;
private constructor();
get name(): string;
get description(): string;
get usedWith(): JSONWebKeyType[];
static values(): JSONWebKeyParameter[];
static fromName(usedWith: JSONWebKeyType, name: string): JSONWebKeyParameter | null;
}
declare class JSONWebKeyUse {
private _value;
private _description;
static _values: JSONWebKeyUse[];
static readonly SIG: JSONWebKeyUse;
static readonly ENC: JSONWebKeyUse;
private constructor();
get value(): string;
get description(): string;
static values(): JSONWebKeyUse[];
static fromValue(value: string): JSONWebKeyUse | null;
}
declare class JSONWebKeyOperation {
private _value;
private _description;
static _values: JSONWebKeyOperation[];
static readonly SIGN: JSONWebKeyOperation;
static readonly VERIFY: JSONWebKeyOperation;
static readonly ENCRYPT: JSONWebKeyOperation;
static readonly DECRYPT: JSONWebKeyOperation;
static readonly WRAP_KEY: JSONWebKeyOperation;
static readonly UNWRAP_KEY: JSONWebKeyOperation;
static readonly DERIVE_KEY: JSONWebKeyOperation;
static readonly DERIVE_BITS: JSONWebKeyOperation;
private constructor();
get value(): string;
get description(): string;
static values(): JSONWebKeyOperation[];
static fromValue(value: string): JSONWebKeyOperation | null;
}
export { JSONWebKeyType, JSONWebSignatureAndEncryptionAlgorithm, JSONWebKeyEllipticCurve, JSONWebKeyParameter, JSONWebKeyUse, JSONWebKeyOperation, };