parse-cosekey
Version:
Parse COSE(CBOR Object Signing and Encryption) to JWK(JSON Web Key) or PEM.
131 lines (130 loc) • 7.46 kB
TypeScript
import * as CoseKey from './coseKey';
import * as JoseKey from './joseKey';
declare class KeyTypeMapping {
private _coseKeyType;
private _jsonWebKeyType;
static _values: KeyTypeMapping[];
static readonly OKP: KeyTypeMapping;
static readonly EC2: KeyTypeMapping;
static readonly RSA: KeyTypeMapping;
private constructor();
get coseKeyType(): CoseKey.COSEKeyType;
get jsonWebKeyType(): JoseKey.JSONWebKeyType;
static values(): KeyTypeMapping[];
static fromCOSEKeyType(coseKeyType: CoseKey.COSEKeyType): JoseKey.JSONWebKeyType | null;
static fromCOSEKeyTypeValue(coseKeyTypeValue: number): JoseKey.JSONWebKeyType | null;
static fromJSONWebKeyType(jsonWebKeyType: JoseKey.JSONWebKeyType): CoseKey.COSEKeyType | null;
static fromJSONWebKeyTypeValue(jsonWebKeyTypeValue: string): CoseKey.COSEKeyType | null;
}
declare class KeyAlgorithmMapping {
private _coseAlgorithm;
private _joseAlgorithm;
static _values: KeyAlgorithmMapping[];
static readonly RS1: KeyAlgorithmMapping;
static readonly RS512: KeyAlgorithmMapping;
static readonly RS384: KeyAlgorithmMapping;
static readonly RS256: KeyAlgorithmMapping;
static readonly ES256K: KeyAlgorithmMapping;
static readonly RSAES_OAEP_SHA512: KeyAlgorithmMapping;
static readonly RSAES_OAEP_SHA256: KeyAlgorithmMapping;
static readonly PS512: KeyAlgorithmMapping;
static readonly PS384: KeyAlgorithmMapping;
static readonly PS256: KeyAlgorithmMapping;
static readonly ES512: KeyAlgorithmMapping;
static readonly ES384: KeyAlgorithmMapping;
static readonly ECDH_ES_A256KW: KeyAlgorithmMapping;
static readonly ECDH_ES_A192KW: KeyAlgorithmMapping;
static readonly ECDH_ES_A128KW: KeyAlgorithmMapping;
static readonly EdDSA: KeyAlgorithmMapping;
static readonly ES256: KeyAlgorithmMapping;
static readonly DIRECT: KeyAlgorithmMapping;
static readonly A256KW: KeyAlgorithmMapping;
static readonly A192KW: KeyAlgorithmMapping;
static readonly A128KW: KeyAlgorithmMapping;
static readonly A128GCM: KeyAlgorithmMapping;
static readonly A192GCM: KeyAlgorithmMapping;
static readonly A256GCM: KeyAlgorithmMapping;
constructor(_coseAlgorithm: CoseKey.COSEAlgorithm, _joseAlgorithm: JoseKey.JSONWebSignatureAndEncryptionAlgorithm);
get coseAlgorithm(): CoseKey.COSEAlgorithm;
get joseAlgorithm(): JoseKey.JSONWebSignatureAndEncryptionAlgorithm;
static values(): KeyAlgorithmMapping[];
static fromCOSEAlgorithm(coseAlgorithm: CoseKey.COSEAlgorithm): JoseKey.JSONWebSignatureAndEncryptionAlgorithm | null;
static fromCOSEAlgorithmValue(coseAlgorithmValue: number): JoseKey.JSONWebSignatureAndEncryptionAlgorithm | null;
static fromJoseAlgorithm(joseAlgorithm: JoseKey.JSONWebSignatureAndEncryptionAlgorithm): CoseKey.COSEAlgorithm | null;
static fromJoseAlgorithmName(joseAlgorithmName: string): CoseKey.COSEAlgorithm | null;
}
declare class KeyParameterMapping {
private _coseKeyParameter;
private _jsonWebKeyParameter;
static _values: KeyParameterMapping[];
static readonly KTY: KeyParameterMapping;
static readonly KID: KeyParameterMapping;
static readonly ALG: KeyParameterMapping;
static readonly KEY_OPS: KeyParameterMapping;
static readonly OKP_CRV: KeyParameterMapping;
static readonly OKP_X: KeyParameterMapping;
static readonly OKP_D: KeyParameterMapping;
static readonly EC2_CRV: KeyParameterMapping;
static readonly EC2_X: KeyParameterMapping;
static readonly EC2_Y: KeyParameterMapping;
static readonly EC2_D: KeyParameterMapping;
static readonly RSA_N: KeyParameterMapping;
static readonly RSA_E: KeyParameterMapping;
static readonly RSA_D: KeyParameterMapping;
static readonly RSA_P: KeyParameterMapping;
static readonly RSA_Q: KeyParameterMapping;
static readonly RSA_DP: KeyParameterMapping;
static readonly RSA_DQ: KeyParameterMapping;
static readonly OTHER: KeyParameterMapping;
private constructor();
get coseKeyParameter(): CoseKey.COSEKeyCommonParameter | CoseKey.COSEKeyTypeParameter;
get jsonWebKeyParameter(): JoseKey.JSONWebKeyParameter;
static values(): KeyParameterMapping[];
static fromCOSEKeyParameter(coseKeyParameter: CoseKey.COSEKeyCommonParameter | CoseKey.COSEKeyTypeParameter): JoseKey.JSONWebKeyParameter | null;
static fromCOSEKeyParameterLabel(coseKeyParameterLabel: number): JoseKey.JSONWebKeyParameter | null;
static fromJSONWebKeyParameter(jsonWebKeyParameter: JoseKey.JSONWebKeyParameter): CoseKey.COSEKeyCommonParameter | CoseKey.COSEKeyTypeParameter | null;
static fromJSONWebKeyParameterName(jsonWebKeyParameterName: string): CoseKey.COSEKeyCommonParameter | CoseKey.COSEKeyTypeParameter | null;
}
declare class KeyOperationMapping {
private _coseKeyOperation;
private _jsonWebKeyOperation;
static _values: KeyOperationMapping[];
static readonly SIGN: KeyOperationMapping;
static readonly VERIFY: KeyOperationMapping;
static readonly ENCRYPT: KeyOperationMapping;
static readonly DECRYPT: KeyOperationMapping;
static readonly WRAP_KEY: KeyOperationMapping;
static readonly UNWRAP_KEY: KeyOperationMapping;
static readonly DERIVE_KEY: KeyOperationMapping;
static readonly DERIVE_BITS: KeyOperationMapping;
private constructor();
get coseKeyOperation(): CoseKey.COSEKeyOperationValue;
get jsonWebKeyOperation(): JoseKey.JSONWebKeyOperation;
static values(): KeyOperationMapping[];
static fromCOSEKeyOperation(coseKeyOperation: CoseKey.COSEKeyOperationValue): JoseKey.JSONWebKeyOperation | null;
static fromCOSEKeyOperationValue(coseKeyOperationValue: number): JoseKey.JSONWebKeyOperation | null;
static fromJSONWebKeyOperation(jsonWebKeyOperation: JoseKey.JSONWebKeyOperation): CoseKey.COSEKeyOperationValue | null;
static fromJSONWebKeyOperationValue(jsonWebKeyOperationValue: string): CoseKey.COSEKeyOperationValue | null;
}
declare class EllipticCurveMapping {
private _coseEllipticCurve;
private _jsonWebKeyEllipticCurve;
static _values: EllipticCurveMapping[];
static readonly P_256: EllipticCurveMapping;
static readonly P_384: EllipticCurveMapping;
static readonly P_512: EllipticCurveMapping;
static readonly X25519: EllipticCurveMapping;
static readonly X448: EllipticCurveMapping;
static readonly ED25519: EllipticCurveMapping;
static readonly ED448: EllipticCurveMapping;
static readonly SECP256K1: EllipticCurveMapping;
private constructor();
get coseEllipticCurve(): CoseKey.COSEEllipticCurve;
get jsonWebKeyEllipticCurve(): JoseKey.JSONWebKeyEllipticCurve;
static values(): EllipticCurveMapping[];
static fromCOSEEllipticCurve(coseEllipticCurve: CoseKey.COSEEllipticCurve): JoseKey.JSONWebKeyEllipticCurve | null;
static fromCOSEEllipticCurveValue(coseEllipticCurveValue: number): JoseKey.JSONWebKeyEllipticCurve | null;
static fromJSONWebKeyEllipticCurve(jsonWebKeyEllipticCurve: JoseKey.JSONWebKeyEllipticCurve): CoseKey.COSEEllipticCurve | null;
static fromJSONWebKeyEllipticCurveName(jsonWebKeyEllipticCurveValue: string): CoseKey.COSEEllipticCurve | null;
}
export { KeyTypeMapping, KeyAlgorithmMapping, KeyParameterMapping, KeyOperationMapping, EllipticCurveMapping };