@hpke/cose 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -2
  3. package/esm/mod.d.ts +16 -0
  4. package/esm/mod.d.ts.map +1 -0
  5. package/esm/mod.js +11 -0
  6. package/esm/package.json +3 -0
  7. package/esm/src/alg.d.ts +60 -0
  8. package/esm/src/alg.d.ts.map +1 -0
  9. package/esm/src/alg.js +96 -0
  10. package/esm/src/cbor/decoder.d.ts +4 -0
  11. package/esm/src/cbor/decoder.d.ts.map +1 -0
  12. package/esm/src/cbor/decoder.js +148 -0
  13. package/esm/src/cbor/encoder.d.ts +6 -0
  14. package/esm/src/cbor/encoder.d.ts.map +1 -0
  15. package/esm/src/cbor/encoder.js +109 -0
  16. package/esm/src/cbor/types.d.ts +8 -0
  17. package/esm/src/cbor/types.d.ts.map +1 -0
  18. package/esm/src/cbor/types.js +1 -0
  19. package/esm/src/contentAesGcm.d.ts +3 -0
  20. package/esm/src/contentAesGcm.d.ts.map +1 -0
  21. package/esm/src/contentAesGcm.js +30 -0
  22. package/esm/src/coseKey.d.ts +56 -0
  23. package/esm/src/coseKey.d.ts.map +1 -0
  24. package/esm/src/coseKey.js +185 -0
  25. package/esm/src/encrypt.d.ts +155 -0
  26. package/esm/src/encrypt.d.ts.map +1 -0
  27. package/esm/src/encrypt.js +317 -0
  28. package/esm/src/encrypt0.d.ts +91 -0
  29. package/esm/src/encrypt0.d.ts.map +1 -0
  30. package/esm/src/encrypt0.js +203 -0
  31. package/esm/src/errors.d.ts +5 -0
  32. package/esm/src/errors.d.ts.map +1 -0
  33. package/esm/src/errors.js +7 -0
  34. package/esm/src/hpke0.d.ts +8 -0
  35. package/esm/src/hpke0.d.ts.map +1 -0
  36. package/esm/src/hpke0.js +23 -0
  37. package/esm/src/hpke1.d.ts +8 -0
  38. package/esm/src/hpke1.d.ts.map +1 -0
  39. package/esm/src/hpke1.js +23 -0
  40. package/esm/src/hpke2.d.ts +8 -0
  41. package/esm/src/hpke2.d.ts.map +1 -0
  42. package/esm/src/hpke2.js +23 -0
  43. package/esm/src/hpke3.d.ts +8 -0
  44. package/esm/src/hpke3.d.ts.map +1 -0
  45. package/esm/src/hpke3.js +23 -0
  46. package/esm/src/hpke4.d.ts +8 -0
  47. package/esm/src/hpke4.d.ts.map +1 -0
  48. package/esm/src/hpke4.js +39 -0
  49. package/esm/src/hpke5.d.ts +8 -0
  50. package/esm/src/hpke5.d.ts.map +1 -0
  51. package/esm/src/hpke5.js +24 -0
  52. package/esm/src/hpke6.d.ts +8 -0
  53. package/esm/src/hpke6.d.ts.map +1 -0
  54. package/esm/src/hpke6.js +40 -0
  55. package/esm/src/hpke7.d.ts +8 -0
  56. package/esm/src/hpke7.d.ts.map +1 -0
  57. package/esm/src/hpke7.js +23 -0
  58. package/esm/src/structures.d.ts +41 -0
  59. package/esm/src/structures.d.ts.map +1 -0
  60. package/esm/src/structures.js +63 -0
  61. package/package.json +48 -3
@@ -0,0 +1,56 @@
1
+ /** COSE key type values. */
2
+ export declare const CoseKty: {
3
+ readonly OKP: 1;
4
+ readonly EC2: 2;
5
+ };
6
+ export type CoseKty = (typeof CoseKty)[keyof typeof CoseKty];
7
+ /** COSE EC curve identifiers. */
8
+ export declare const CoseCrv: {
9
+ readonly P256: 1;
10
+ readonly P384: 2;
11
+ readonly P521: 3;
12
+ readonly X25519: 4;
13
+ readonly X448: 5;
14
+ };
15
+ export type CoseCrv = (typeof CoseCrv)[keyof typeof CoseCrv];
16
+ /**
17
+ * Parse a CBOR-encoded COSE_Key and extract the raw private key bytes (d parameter).
18
+ * Validates kty, crv, key length consistency.
19
+ *
20
+ * @param coseKeyBytes CBOR-encoded COSE_Key.
21
+ * @returns The raw private key bytes.
22
+ */
23
+ export declare function extractPrivateKeyBytes(coseKeyBytes: Uint8Array): Uint8Array;
24
+ /**
25
+ * Parse a CBOR-encoded COSE_Key and extract the raw public key bytes.
26
+ * Validates kty, crv, key length consistency.
27
+ *
28
+ * For EC2 keys (P-256/P-384/P-521): returns uncompressed point (0x04 || x || y).
29
+ * For OKP keys (X25519/X448): returns x coordinate.
30
+ *
31
+ * @param coseKeyBytes CBOR-encoded COSE_Key.
32
+ * @returns The raw public key bytes.
33
+ */
34
+ export declare function extractPublicKeyBytes(coseKeyBytes: Uint8Array): Uint8Array;
35
+ /**
36
+ * Get the curve identifier from a CBOR-encoded COSE_Key.
37
+ * Validates kty/crv consistency.
38
+ *
39
+ * @param coseKeyBytes CBOR-encoded COSE_Key.
40
+ * @returns The COSE curve identifier.
41
+ */
42
+ export declare function extractCurve(coseKeyBytes: Uint8Array): CoseCrv;
43
+ /** Options for building a COSE_Key. */
44
+ export interface CoseKeyBuildOptions {
45
+ kid?: Uint8Array;
46
+ alg?: number;
47
+ }
48
+ /**
49
+ * Build a CBOR-encoded COSE_Key for an EC2 key (P-256/P-384/P-521).
50
+ */
51
+ export declare function buildEc2CoseKey(crv: CoseCrv, x: Uint8Array, y: Uint8Array, d?: Uint8Array, options?: CoseKeyBuildOptions): Uint8Array;
52
+ /**
53
+ * Build a CBOR-encoded COSE_Key for an OKP key (X25519/X448).
54
+ */
55
+ export declare function buildOkpCoseKey(crv: CoseCrv, x: Uint8Array, d?: Uint8Array, options?: CoseKeyBuildOptions): Uint8Array;
56
+ //# sourceMappingURL=coseKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coseKey.d.ts","sourceRoot":"","sources":["../../src/src/coseKey.ts"],"names":[],"mappings":"AAiBA,4BAA4B;AAC5B,eAAO,MAAM,OAAO;;;CAGV,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE7D,iCAAiC;AACjC,eAAO,MAAM,OAAO;;;;;;CAMV,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AA6F7D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,UAAU,GAAG,UAAU,CAQ3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,UAAU,GAAG,UAAU,CAsB1E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,CAG9D;AAED,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,UAAU,EACb,CAAC,CAAC,EAAE,UAAU,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,UAAU,CAgBZ;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,CAAC,EAAE,UAAU,EACb,CAAC,CAAC,EAAE,UAAU,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,UAAU,CAeZ"}
@@ -0,0 +1,185 @@
1
+ import { encode } from "./cbor/encoder.js";
2
+ import { decode } from "./cbor/decoder.js";
3
+ import { CoseError } from "./errors.js";
4
+ /** COSE_Key parameter labels (RFC 9052 / RFC 9053). */
5
+ const KeyLabel = {
6
+ KTY: 1,
7
+ KID: 2,
8
+ ALG: 3,
9
+ KEY_OPS: 4,
10
+ CRV: -1,
11
+ X: -2,
12
+ Y: -3,
13
+ D: -4,
14
+ };
15
+ /** COSE key type values. */
16
+ export const CoseKty = {
17
+ OKP: 1,
18
+ EC2: 2,
19
+ };
20
+ /** COSE EC curve identifiers. */
21
+ export const CoseCrv = {
22
+ P256: 1,
23
+ P384: 2,
24
+ P521: 3,
25
+ X25519: 4,
26
+ X448: 5,
27
+ };
28
+ /** Expected coordinate sizes per curve. */
29
+ const CRV_KEY_SIZES = {
30
+ [CoseCrv.P256]: 32,
31
+ [CoseCrv.P384]: 48,
32
+ [CoseCrv.P521]: 66,
33
+ [CoseCrv.X25519]: 32,
34
+ [CoseCrv.X448]: 56,
35
+ };
36
+ /** Valid kty for each curve. */
37
+ const CRV_KTY = {
38
+ [CoseCrv.P256]: CoseKty.EC2,
39
+ [CoseCrv.P384]: CoseKty.EC2,
40
+ [CoseCrv.P521]: CoseKty.EC2,
41
+ [CoseCrv.X25519]: CoseKty.OKP,
42
+ [CoseCrv.X448]: CoseKty.OKP,
43
+ };
44
+ /** COSE key_ops values relevant to HPKE. */
45
+ const KeyOps = {
46
+ DERIVE_BITS: 8,
47
+ };
48
+ function parseCoseKeyMap(coseKeyBytes) {
49
+ const map = decode(coseKeyBytes);
50
+ if (!(map instanceof Map)) {
51
+ throw new CoseError("COSE_Key is not a CBOR map");
52
+ }
53
+ const kty = map.get(KeyLabel.KTY);
54
+ if (typeof kty !== "number" || (kty !== CoseKty.OKP && kty !== CoseKty.EC2)) {
55
+ throw new CoseError(`Invalid or unsupported kty: ${kty} (expected OKP=1 or EC2=2)`);
56
+ }
57
+ const crv = map.get(KeyLabel.CRV);
58
+ if (typeof crv !== "number" || !(crv in CRV_KTY)) {
59
+ throw new CoseError(`Invalid or unsupported crv: ${crv}`);
60
+ }
61
+ // Validate kty/crv consistency
62
+ const expectedKty = CRV_KTY[crv];
63
+ if (kty !== expectedKty) {
64
+ throw new CoseError(`kty/crv mismatch: kty=${kty} but crv=${crv} requires kty=${expectedKty}`);
65
+ }
66
+ // Validate key_ops if present
67
+ const keyOps = map.get(KeyLabel.KEY_OPS);
68
+ if (keyOps !== undefined) {
69
+ if (!Array.isArray(keyOps)) {
70
+ throw new CoseError("key_ops must be an array");
71
+ }
72
+ const hasD = map.has(KeyLabel.D);
73
+ if (hasD) {
74
+ // Private key: key_ops MUST include "derive bits" (8)
75
+ if (!keyOps.includes(KeyOps.DERIVE_BITS)) {
76
+ throw new CoseError("Private key key_ops must include 'derive bits' (8)");
77
+ }
78
+ }
79
+ }
80
+ return { map, kty: kty, crv: crv };
81
+ }
82
+ function validateCoordinateSize(name, data, crv) {
83
+ const expected = CRV_KEY_SIZES[crv];
84
+ if (expected !== undefined && data.length !== expected) {
85
+ throw new CoseError(`${name} length ${data.length} does not match crv expectation ${expected}`);
86
+ }
87
+ }
88
+ /**
89
+ * Parse a CBOR-encoded COSE_Key and extract the raw private key bytes (d parameter).
90
+ * Validates kty, crv, key length consistency.
91
+ *
92
+ * @param coseKeyBytes CBOR-encoded COSE_Key.
93
+ * @returns The raw private key bytes.
94
+ */
95
+ export function extractPrivateKeyBytes(coseKeyBytes) {
96
+ const { map, crv } = parseCoseKeyMap(coseKeyBytes);
97
+ const d = map.get(KeyLabel.D);
98
+ if (!(d instanceof Uint8Array)) {
99
+ throw new CoseError("COSE_Key does not contain a private key (d)");
100
+ }
101
+ validateCoordinateSize("d", d, crv);
102
+ return d;
103
+ }
104
+ /**
105
+ * Parse a CBOR-encoded COSE_Key and extract the raw public key bytes.
106
+ * Validates kty, crv, key length consistency.
107
+ *
108
+ * For EC2 keys (P-256/P-384/P-521): returns uncompressed point (0x04 || x || y).
109
+ * For OKP keys (X25519/X448): returns x coordinate.
110
+ *
111
+ * @param coseKeyBytes CBOR-encoded COSE_Key.
112
+ * @returns The raw public key bytes.
113
+ */
114
+ export function extractPublicKeyBytes(coseKeyBytes) {
115
+ const { map, kty, crv } = parseCoseKeyMap(coseKeyBytes);
116
+ const x = map.get(KeyLabel.X);
117
+ if (!(x instanceof Uint8Array)) {
118
+ throw new CoseError("COSE_Key does not contain x coordinate");
119
+ }
120
+ validateCoordinateSize("x", x, crv);
121
+ if (kty === CoseKty.EC2) {
122
+ const y = map.get(KeyLabel.Y);
123
+ if (!(y instanceof Uint8Array)) {
124
+ throw new CoseError("EC2 COSE_Key does not contain y coordinate");
125
+ }
126
+ validateCoordinateSize("y", y, crv);
127
+ const result = new Uint8Array(1 + x.length + y.length);
128
+ result[0] = 0x04;
129
+ result.set(x, 1);
130
+ result.set(y, 1 + x.length);
131
+ return result;
132
+ }
133
+ // OKP: raw x coordinate
134
+ return x;
135
+ }
136
+ /**
137
+ * Get the curve identifier from a CBOR-encoded COSE_Key.
138
+ * Validates kty/crv consistency.
139
+ *
140
+ * @param coseKeyBytes CBOR-encoded COSE_Key.
141
+ * @returns The COSE curve identifier.
142
+ */
143
+ export function extractCurve(coseKeyBytes) {
144
+ const { crv } = parseCoseKeyMap(coseKeyBytes);
145
+ return crv;
146
+ }
147
+ /**
148
+ * Build a CBOR-encoded COSE_Key for an EC2 key (P-256/P-384/P-521).
149
+ */
150
+ export function buildEc2CoseKey(crv, x, y, d, options) {
151
+ const map = new Map();
152
+ map.set(KeyLabel.KTY, CoseKty.EC2);
153
+ if (options?.kid) {
154
+ map.set(KeyLabel.KID, options.kid);
155
+ }
156
+ if (options?.alg !== undefined) {
157
+ map.set(KeyLabel.ALG, options.alg);
158
+ }
159
+ map.set(KeyLabel.CRV, crv);
160
+ map.set(KeyLabel.X, x);
161
+ map.set(KeyLabel.Y, y);
162
+ if (d) {
163
+ map.set(KeyLabel.D, d);
164
+ }
165
+ return encode(map);
166
+ }
167
+ /**
168
+ * Build a CBOR-encoded COSE_Key for an OKP key (X25519/X448).
169
+ */
170
+ export function buildOkpCoseKey(crv, x, d, options) {
171
+ const map = new Map();
172
+ map.set(KeyLabel.KTY, CoseKty.OKP);
173
+ if (options?.kid) {
174
+ map.set(KeyLabel.KID, options.kid);
175
+ }
176
+ if (options?.alg !== undefined) {
177
+ map.set(KeyLabel.ALG, options.alg);
178
+ }
179
+ map.set(KeyLabel.CRV, crv);
180
+ map.set(KeyLabel.X, x);
181
+ if (d) {
182
+ map.set(KeyLabel.D, d);
183
+ }
184
+ return encode(map);
185
+ }
@@ -0,0 +1,155 @@
1
+ import type { CipherSuite } from "@hpke/core";
2
+ import { type ContentAlg, type CoseHpkeAlg } from "./alg.js";
3
+ /**
4
+ * Content encryption interface for Layer 0.
5
+ * Each factory provides the appropriate implementation
6
+ * (e.g. AES-GCM via WebCrypto, ChaCha20/Poly1305).
7
+ */
8
+ export interface ContentCrypto {
9
+ seal(key: Uint8Array, nonce: Uint8Array, plaintext: Uint8Array, aad: Uint8Array): Promise<Uint8Array>;
10
+ open(key: Uint8Array, nonce: Uint8Array, ciphertext: Uint8Array, aad: Uint8Array): Promise<Uint8Array>;
11
+ }
12
+ /** A recipient descriptor for CoseEncrypt.seal(). */
13
+ export interface CoseRecipient {
14
+ /** The recipient's public key. */
15
+ recipientPublicKey: CryptoKey;
16
+ /** Key identifier for the recipient (bstr per RFC 9052). */
17
+ kid?: Uint8Array;
18
+ /** Extra info embedded in Recipient_structure. */
19
+ extraInfo?: Uint8Array;
20
+ /**
21
+ * HPKE AAD for this recipient (Layer 1).
22
+ * Per draft-ietf-cose-hpke-27, this SHOULD be empty. Only use for
23
+ * special cases where additional authenticated data is needed at the
24
+ * key-wrapping layer. Defaults to empty.
25
+ */
26
+ aad?: Uint8Array;
27
+ /** Pre-shared key for PSK mode. */
28
+ psk?: {
29
+ id: Uint8Array;
30
+ key: Uint8Array;
31
+ };
32
+ }
33
+ /** Options for CoseEncrypt.seal(). */
34
+ export interface CoseEncryptSealOptions {
35
+ /** External AAD for Layer 0 content encryption. */
36
+ externalAad?: Uint8Array;
37
+ /** If true, output is wrapped in CBOR Tag 96 (COSE_Encrypt). */
38
+ tagged?: boolean;
39
+ }
40
+ /** Options for CoseEncrypt.open(). */
41
+ export interface CoseEncryptOpenOptions {
42
+ /** External AAD for Layer 0 content decryption. */
43
+ externalAad?: Uint8Array;
44
+ /** Extra info for Recipient_structure. */
45
+ extraInfo?: Uint8Array;
46
+ /**
47
+ * HPKE AAD for this recipient (Layer 1).
48
+ * Per draft-ietf-cose-hpke-27, this SHOULD be empty. Only use for
49
+ * special cases where additional authenticated data is needed at the
50
+ * key-wrapping layer. Defaults to empty.
51
+ */
52
+ aad?: Uint8Array;
53
+ /** Pre-shared key for PSK mode. */
54
+ psk?: {
55
+ id: Uint8Array;
56
+ key: Uint8Array;
57
+ };
58
+ /** Key identifier to match against recipient protected headers. */
59
+ kid?: Uint8Array;
60
+ /**
61
+ * Detached ciphertext for open(). When provided, the ciphertext field
62
+ * in the COSE structure (which should be null) is replaced by this value.
63
+ */
64
+ detachedPayload?: Uint8Array;
65
+ }
66
+ /** Result of a detached seal operation. */
67
+ export interface CoseEncryptDetachedResult {
68
+ /** CBOR-encoded COSE_Encrypt with null ciphertext. */
69
+ message: Uint8Array;
70
+ /** The ciphertext transported separately. */
71
+ payload: Uint8Array;
72
+ }
73
+ /**
74
+ * COSE_Encrypt (Key Encryption) using HPKE.
75
+ *
76
+ * Implements draft-ietf-cose-hpke-27 Section 3.3 (HPKE Key Encryption Mode).
77
+ */
78
+ export interface CoseEncrypt {
79
+ /** The underlying HPKE CipherSuite. */
80
+ readonly suite: CipherSuite;
81
+ /**
82
+ * Generate a KEM key pair.
83
+ */
84
+ generateKemKeyPair(): Promise<CryptoKeyPair>;
85
+ /**
86
+ * Encrypt plaintext into a CBOR-encoded COSE_Encrypt structure.
87
+ */
88
+ seal(recipients: CoseRecipient[], plaintext: Uint8Array, options?: CoseEncryptSealOptions): Promise<Uint8Array>;
89
+ /**
90
+ * Encrypt plaintext into a detached COSE_Encrypt structure.
91
+ * The ciphertext field is null; the actual payload is returned separately.
92
+ */
93
+ sealDetached(recipients: CoseRecipient[], plaintext: Uint8Array, options?: CoseEncryptSealOptions): Promise<CoseEncryptDetachedResult>;
94
+ /**
95
+ * Decrypt a CBOR-encoded COSE_Encrypt structure.
96
+ * For detached payloads, pass the ciphertext via options.detachedPayload.
97
+ */
98
+ open(recipientKey: CryptoKeyPair | CryptoKey, data: Uint8Array, options?: CoseEncryptOpenOptions): Promise<Uint8Array>;
99
+ /**
100
+ * Import a public key from a CBOR-encoded COSE_Key.
101
+ * Validates kty, crv, and key length.
102
+ */
103
+ importPublicCoseKey(coseKeyBytes: Uint8Array): Promise<CryptoKey>;
104
+ /**
105
+ * Import a private key from a CBOR-encoded COSE_Key.
106
+ * Validates kty, crv, and key length.
107
+ */
108
+ importPrivateCoseKey(coseKeyBytes: Uint8Array): Promise<CryptoKey>;
109
+ }
110
+ /** @internal */
111
+ export declare class CoseEncryptImpl implements CoseEncrypt {
112
+ private _suite;
113
+ private _alg;
114
+ private _contentAlg;
115
+ private _contentCrypto;
116
+ /**
117
+ * @param suite The HPKE CipherSuite to use for key wrapping.
118
+ * @param alg A COSE HPKE algorithm identifier for Key Encryption (46-53).
119
+ * @param contentAlg The content encryption algorithm (A128GCM=1, A256GCM=3, or CHACHA20POLY1305=24).
120
+ * @param contentCrypto Content encryption implementation for Layer 0.
121
+ */
122
+ constructor(suite: CipherSuite, alg: CoseHpkeAlg, contentAlg: ContentAlg, contentCrypto: ContentCrypto);
123
+ /** The underlying HPKE CipherSuite. */
124
+ get suite(): CipherSuite;
125
+ /**
126
+ * Generate a KEM key pair.
127
+ */
128
+ generateKemKeyPair(): Promise<CryptoKeyPair>;
129
+ /**
130
+ * Encrypt plaintext into a CBOR-encoded COSE_Encrypt structure.
131
+ *
132
+ * @param recipients One or more recipient descriptors.
133
+ * @param plaintext The data to encrypt.
134
+ * @param options Optional seal parameters.
135
+ * @returns CBOR-encoded COSE_Encrypt.
136
+ */
137
+ seal(recipients: CoseRecipient[], plaintext: Uint8Array, options?: CoseEncryptSealOptions): Promise<Uint8Array>;
138
+ sealDetached(recipients: CoseRecipient[], plaintext: Uint8Array, options?: CoseEncryptSealOptions): Promise<CoseEncryptDetachedResult>;
139
+ private _sealInner;
140
+ /**
141
+ * Decrypt a CBOR-encoded COSE_Encrypt structure.
142
+ *
143
+ * @param recipientKey The recipient's key pair or private key.
144
+ * @param data CBOR-encoded COSE_Encrypt.
145
+ * @param options Optional parameters.
146
+ * @returns Decrypted plaintext.
147
+ */
148
+ open(recipientKey: CryptoKeyPair | CryptoKey, data: Uint8Array, options?: CoseEncryptOpenOptions): Promise<Uint8Array>;
149
+ private _contentEncrypt;
150
+ private _contentDecrypt;
151
+ private _wrapCek;
152
+ importPublicCoseKey(coseKeyBytes: Uint8Array): Promise<CryptoKey>;
153
+ importPrivateCoseKey(coseKeyBytes: Uint8Array): Promise<CryptoKey>;
154
+ }
155
+ //# sourceMappingURL=encrypt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encrypt.d.ts","sourceRoot":"","sources":["../../src/src/encrypt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EACL,KAAK,UAAU,EAGf,KAAK,WAAW,EAEjB,MAAM,UAAU,CAAC;AAmBlB;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CACF,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,IAAI,CACF,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,UAAU,CAAC,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,kBAAkB,EAAE,SAAS,CAAC;IAC9B,4DAA4D;IAC5D,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,kDAAkD;IAClD,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,mCAAmC;IACnC,GAAG,CAAC,EAAE;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,GAAG,EAAE,UAAU,CAAA;KAAE,CAAC;CAC3C;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,gEAAgE;IAChE,MAAM,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