import type { Jwk } from '../jose/jwk.js'; /** * COSE Key Type values (RFC 9052, Section 7). * * @see {@link https://www.iana.org/assignments/cose/cose.xhtml#key-type | IANA COSE Key Types} */ export declare enum CoseKeyType { /** Octet Key Pair (e.g., Ed25519, X25519) */ OKP = 1, /** Elliptic Curve (e.g., P-256, P-384, P-521) */ EC2 = 2, /** Symmetric key */ Symmetric = 4 } /** * COSE Elliptic Curve identifiers (RFC 9053, Section 7.1). * * @see {@link https://www.iana.org/assignments/cose/cose.xhtml#elliptic-curves | IANA COSE Elliptic Curves} */ export declare enum CoseEllipticCurve { /** NIST P-256 (secp256r1) */ P256 = 1, /** NIST P-384 (secp384r1) */ P384 = 2, /** NIST P-521 (secp521r1) */ P521 = 3, /** X25519 for ECDH */ X25519 = 4, /** X448 for ECDH */ X448 = 5, /** Ed25519 for EdDSA */ Ed25519 = 6, /** Ed448 for EdDSA */ Ed448 = 7, /** secp256k1 */ Secp256k1 = 8 } /** * COSE Algorithm identifiers (RFC 9053). * * Only includes algorithms relevant to Enbox confidential compute. * * @see {@link https://www.iana.org/assignments/cose/cose.xhtml#algorithms | IANA COSE Algorithms} */ export declare enum CoseAlgorithm { /** EdDSA (Ed25519 or Ed448) */ EdDSA = -8, /** ECDSA with SHA-256 (P-256) */ ES256 = -7, /** ECDSA with SHA-384 (P-384) */ ES384 = -35, /** ECDSA with SHA-512 (P-521) */ ES512 = -36, /** ECDSA with SHA-256 (secp256k1) */ ES256K = -47 } /** * Utilities for converting between JWK and COSE key representations. * * COSE keys use integer labels and CBOR encoding, while JWK uses string * property names and JSON. This class provides bidirectional conversion. * * @see {@link https://www.rfc-editor.org/rfc/rfc9052#section-7 | RFC 9052, Section 7} */ export declare class CoseKey { /** * Converts a JWK to a COSE key represented as a Map. * * @param jwk - The JWK to convert. * @returns A Map with integer labels as keys, suitable for CBOR encoding. * @throws {CryptoError} If the JWK key type or curve is not supported. */ static fromJwk(jwk: Jwk): Map; /** * Converts a COSE key Map to a JWK. * * @param coseKey - A Map with integer labels as keys (from CBOR decoding). * @returns The equivalent JWK. * @throws {CryptoError} If the COSE key type or curve is not supported. */ static toJwk(coseKey: Map): Jwk; /** * Infers the COSE algorithm identifier from a JWK. * * If the JWK has an `alg` field, it is used directly. Otherwise, the algorithm * is inferred from the key type and curve. * * @param jwk - The JWK to infer the algorithm from. * @returns The COSE algorithm identifier. * @throws {CryptoError} If the algorithm cannot be determined. */ static algorithmFromJwk(jwk: Jwk): CoseAlgorithm; /** * Maps a COSE algorithm identifier to a JWK algorithm name. * * @param alg - The COSE algorithm identifier. * @returns The JWK algorithm name. * @throws {CryptoError} If the algorithm is not supported. */ static algorithmToJwk(alg: CoseAlgorithm): string; /** * Applies common COSE key fields (kid, alg) to a JWK. */ private static applyCommonFields; } //# sourceMappingURL=cose-key.d.ts.map