@darkbio/crypto 0.17.3 → 0.19.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.
- package/README.md +36 -2
- package/dist/argon2.d.ts +41 -8
- package/dist/argon2.d.ts.map +1 -1
- package/dist/cbor.d.ts +111 -21
- package/dist/cbor.d.ts.map +1 -1
- package/dist/cose.d.ts +144 -13
- package/dist/cose.d.ts.map +1 -1
- package/dist/cwt.d.ts +110 -50
- package/dist/cwt.d.ts.map +1 -1
- package/dist/hkdf.d.ts +22 -15
- package/dist/hkdf.d.ts.map +1 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1125 -1032
- package/dist/index.js.map +1 -1
- package/dist/rand.d.ts +4 -3
- package/dist/rand.d.ts.map +1 -1
- package/dist/xdsa.d.ts +93 -37
- package/dist/xdsa.d.ts.map +1 -1
- package/dist/xhpke.d.ts +155 -49
- package/dist/xhpke.d.ts.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@darkbio/crypto)
|
|
4
4
|
[](https://github.com/dark-bio/crypto-ts/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/dark-bio/crypto-ts/blob/main/LICENSE)
|
|
5
6
|
|
|
6
7
|
This repository is parameter selection and lightweight wrapper around a number of (WASM wrapped) Rust cryptographic libraries. Its purpose isn't to implement primitives, rather to unify the API surface of existing libraries; limited to the tiny subset needed by the Dark Bio project.
|
|
7
8
|
|
|
@@ -18,14 +19,14 @@ The library is opinionated. Parameters and primitives were selected to provide m
|
|
|
18
19
|
- **xHPKE ([RFC-9180](https://datatracker.ietf.org/doc/html/rfc9180))**: `X-WING`, `HKDF`, `SHA256`, `ChaCha20`, `Poly1305`, `dark-bio-v1:` domain prefix
|
|
19
20
|
- **X-WING ([RFC-DRAFT](https://datatracker.ietf.org/doc/html/draft-connolly-cfrg-xwing-kem))**: `MLKEM`, `ECC`
|
|
20
21
|
- **ECC ([RFC-7748](https://datatracker.ietf.org/doc/html/rfc7748))**: `X25519`
|
|
21
|
-
- **MLKEM([
|
|
22
|
+
- **MLKEM ([FIPS-203](https://csrc.nist.gov/pubs/fips/203/final))**: Security level 3 (`ML-KEM-768`)
|
|
22
23
|
- **STREAM (*RFC N/A*, [Rage](https://github.com/str4d/rage))**: `ChaCha20`, `Poly1305`, `16B` tag, `64KB` chunk
|
|
23
24
|
- Key derivation
|
|
24
25
|
- **Argon2 ([RFC-9106](https://datatracker.ietf.org/doc/html/rfc9106))**: `id` variant
|
|
25
26
|
- **HKDF ([RFC-5869](https://datatracker.ietf.org/doc/html/rfc5869))**: `SHA256`
|
|
26
27
|
- Serialization
|
|
27
28
|
- **CBOR² ([RFC-8949](https://datatracker.ietf.org/doc/html/rfc8949))**: restricted to `bool`,`null`, `integer`, `text`, `bytes`, `array`, `map[int]`, `option`
|
|
28
|
-
- **COSE ([RFC-
|
|
29
|
+
- **COSE ([RFC-9052](https://datatracker.ietf.org/doc/html/rfc9052))**: `COSE_Sign1`, `COSE_Encrypt0`, `dark-bio-v1:` domain prefix
|
|
29
30
|
- Credential / Attestation
|
|
30
31
|
- **CWT ([RFC-8392](https://datatracker.ietf.org/doc/html/rfc8392))**: `xDSA`, `xHPKE`
|
|
31
32
|
- **EAT ([RFC-9711](https://datatracker.ietf.org/doc/html/rfc9711))**
|
|
@@ -34,6 +35,35 @@ The library is opinionated. Parameters and primitives were selected to provide m
|
|
|
34
35
|
|
|
35
36
|
*² CBOR encoding and decoding is delegated to [cborg](https://github.com/rvagg/cborg), a full reimplementation in TypeScript being out of scope. To ensure correctness, this package provides a type system. `cbor` codecs declare the shape of a value the way a Rust type deriving `Cbor` does, `cose` and `cwt` functions take values bound to their codec, and the canonical form of every byte crossing the WASM boundary is checked by the Rust validator, which `cbor.verify` also exposes.*
|
|
36
37
|
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
Signatures come from `xdsa`, encryption from `xhpke`, and `cose` wraps both into COSE envelopes using the Dark Bio wire profile. Payloads and authenticated messages are bound to a `cbor` codec, which declares their shape.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install @darkbio/crypto
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
COSE signing and verification and xHPKE encryption and decryption use an application domain that both sides must agree on. It is prefixed with `dark-bio-v1:` internally and binds the operation to one purpose. Choose distinct domains for distinct purposes. Raw `xdsa` signatures carry no such application domain, which is why the `cose` envelopes are the recommended entry point.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { cbor, cose, xdsa, xhpke } from "@darkbio/crypto";
|
|
50
|
+
|
|
51
|
+
// Long term identities, one for signing and one for receiving
|
|
52
|
+
const signer = await xdsa.SecretKey.generate();
|
|
53
|
+
const recipient = await xhpke.SecretKey.generate();
|
|
54
|
+
const domain = new TextEncoder().encode("example");
|
|
55
|
+
|
|
56
|
+
// A detached signature over a message that travels separately
|
|
57
|
+
const signature = await cose.signDetached(cbor.text.value("payload"), signer, domain);
|
|
58
|
+
await cose.verifyDetached(signature, cbor.text.value("payload"), signer.publicKey(), domain, 60);
|
|
59
|
+
|
|
60
|
+
// Sign and encrypt a payload to the recipient, then open and verify it back.
|
|
61
|
+
// The second argument is authenticated but must be supplied separately.
|
|
62
|
+
const metadata = cbor.text.value("metadata");
|
|
63
|
+
const sealed = await cose.seal(cbor.text.value("payload"), metadata, signer, recipient.publicKey(), domain);
|
|
64
|
+
const opened = await cose.open(cbor.text.bytes(sealed), metadata, recipient, signer.publicKey(), domain, 60);
|
|
65
|
+
```
|
|
66
|
+
|
|
37
67
|
## Native packages
|
|
38
68
|
|
|
39
69
|
The underlying implementation exists in two sibling repos, which track the same feature set and API surfaces, released at corresponding version points.
|
|
@@ -50,3 +80,7 @@ Sibling wrapper exists in one other repo:
|
|
|
50
80
|
Shoutout to Filippo Valsorda ([@filosottile](https://github.com/filosottile)) for lots of tips and nudges on what kind of cryptographic primitives to use and how to combine them properly; and also for his work in general on cryptography standards.
|
|
51
81
|
|
|
52
82
|
Naturally, many thanks to the authors of all the libraries this project depends on.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
This library is licensed under the [BSD 3-Clause License](https://github.com/dark-bio/crypto-ts/blob/main/LICENSE).
|
package/dist/argon2.d.ts
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Derives a key from the password, salt and cost parameters using Argon2id.
|
|
3
3
|
*
|
|
4
|
-
* RFC 9106 Section
|
|
5
|
-
*
|
|
4
|
+
* RFC 9106 Section 4 recommends `time = 1`, `memory = 2 * 1024 * 1024`
|
|
5
|
+
* (2 GiB) and `threads = 4`. Its second recommendation uses `time = 3`,
|
|
6
|
+
* `memory = 64 * 1024` (64 MiB) and `threads = 4`. Both use a random 16-byte
|
|
7
|
+
* salt and a 32-byte output. A single WASM allocation stays below 2 GiB, so
|
|
8
|
+
* only the second profile fits within the memory limit below.
|
|
9
|
+
*
|
|
10
|
+
* `time` is the number of passes and `memory` is the total working memory in
|
|
11
|
+
* KiB. `threads` is Argon2's lane count, an algorithm parameter that changes
|
|
12
|
+
* the derived key. It does not select how many threads compute the key. Store
|
|
13
|
+
* the salt and all cost parameters so the same key can be reproduced on other
|
|
14
|
+
* devices.
|
|
15
|
+
*
|
|
16
|
+
* The parameters must stay within these limits:
|
|
17
|
+
*
|
|
18
|
+
* - `time` must be at least 1.
|
|
19
|
+
* - `threads` must be at least 1.
|
|
20
|
+
* - `memory` must be at least `8 * threads` KiB and at most 2097151 KiB, one
|
|
21
|
+
* KiB short of 2 GiB.
|
|
22
|
+
* - `salt` must be at least 8 bytes.
|
|
23
|
+
* - `outLen` must be at least 4 bytes and at most 2147483647 bytes.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { argon2 } from "@darkbio/crypto";
|
|
28
|
+
*
|
|
29
|
+
* // Example salt only; generate and store a fresh random 16-byte salt in real code
|
|
30
|
+
* const salt = new TextEncoder().encode("example salt1234");
|
|
31
|
+
* const password = new TextEncoder().encode("password");
|
|
32
|
+
*
|
|
33
|
+
* // RFC 9106's recommended profile for memory-constrained environments
|
|
34
|
+
* const key = await argon2.key(password, salt, 3, 64 * 1024, 4, 32);
|
|
35
|
+
* console.log(key.length); // 32
|
|
36
|
+
* ```
|
|
6
37
|
*
|
|
7
38
|
* @param password - The password to derive from
|
|
8
|
-
* @param salt - A random salt
|
|
9
|
-
* @param time - Number of passes over memory
|
|
10
|
-
* @param memory -
|
|
11
|
-
* @param threads -
|
|
12
|
-
* @param outLen -
|
|
39
|
+
* @param salt - A random salt, at least 8 bytes and 16 bytes recommended
|
|
40
|
+
* @param time - Number of passes over the memory
|
|
41
|
+
* @param memory - Size of the working memory in KiB
|
|
42
|
+
* @param threads - Argon2's lane count
|
|
43
|
+
* @param outLen - Length of the key in bytes
|
|
13
44
|
* @returns The derived key
|
|
45
|
+
* @throws If a parameter is outside the limits above, or the working memory
|
|
46
|
+
* cannot be allocated
|
|
14
47
|
*/
|
|
15
48
|
export declare function key(password: Uint8Array, salt: Uint8Array, time: number, memory: number, threads: number, outLen: number): Promise<Uint8Array>;
|
|
16
49
|
//# sourceMappingURL=argon2.d.ts.map
|
package/dist/argon2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["../src/argon2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["../src/argon2.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,GAAG,CACvB,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAUrB"}
|
package/dist/cbor.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/** A value bound to the codec that encodes it. */
|
|
2
2
|
export interface Encodable<T> {
|
|
3
|
+
/** The codec that encodes the value. */
|
|
3
4
|
readonly codec: Codec<T>;
|
|
5
|
+
/** The value to encode. */
|
|
4
6
|
readonly value: T;
|
|
5
7
|
}
|
|
6
8
|
/** Bytes bound to the codec that decodes them. */
|
|
7
9
|
export interface Decodable<T> {
|
|
10
|
+
/** The codec that decodes the bytes. */
|
|
8
11
|
readonly codec: Codec<T>;
|
|
12
|
+
/** The CBOR bytes to decode. */
|
|
9
13
|
readonly bytes: Uint8Array;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
@@ -25,14 +29,20 @@ export interface Codec<T> {
|
|
|
25
29
|
}
|
|
26
30
|
/** A required field of a map, a codec at an integer key. */
|
|
27
31
|
export interface Field<T> {
|
|
32
|
+
/** The integer key of the field in the map. */
|
|
28
33
|
readonly key: number;
|
|
34
|
+
/** The codec of the field's value. */
|
|
29
35
|
readonly codec: Codec<T>;
|
|
36
|
+
/** Marks the field as required. */
|
|
30
37
|
readonly required: true;
|
|
31
38
|
}
|
|
32
39
|
/** An optional field of a map, absent from the map when undefined. */
|
|
33
40
|
export interface OptionalField<T> {
|
|
41
|
+
/** The integer key of the field in the map. */
|
|
34
42
|
readonly key: number;
|
|
43
|
+
/** The codec of the field's value. */
|
|
35
44
|
readonly codec: Codec<T>;
|
|
45
|
+
/** Marks the field as optional. */
|
|
36
46
|
readonly required: false;
|
|
37
47
|
}
|
|
38
48
|
/** The fields of a map codec, by name. */
|
|
@@ -43,7 +53,7 @@ export type Values<F extends Fields> = {
|
|
|
43
53
|
} & {
|
|
44
54
|
[K in keyof F as F[K] extends OptionalField<unknown> ? K : never]?: F[K] extends OptionalField<infer T> ? T : never;
|
|
45
55
|
};
|
|
46
|
-
/** The
|
|
56
|
+
/** The item codecs of a tuple codec, one per position of the value types. */
|
|
47
57
|
export type Codecs<T extends unknown[]> = {
|
|
48
58
|
[I in keyof T]: Codec<T[I]>;
|
|
49
59
|
};
|
|
@@ -53,86 +63,166 @@ export type Codecs<T extends unknown[]> = {
|
|
|
53
63
|
* the top.
|
|
54
64
|
*/
|
|
55
65
|
export declare class CodecError extends Error {
|
|
66
|
+
/** What is wrong with the value. */
|
|
56
67
|
readonly reason: string;
|
|
68
|
+
/** Where in the value the mismatch is, empty at the top. */
|
|
57
69
|
readonly path: string;
|
|
70
|
+
/**
|
|
71
|
+
* Creates an error for a value of the wrong shape.
|
|
72
|
+
*
|
|
73
|
+
* @param reason - What is wrong with the value
|
|
74
|
+
* @param path - Where in the value the mismatch is, empty at the top
|
|
75
|
+
*/
|
|
58
76
|
constructor(reason: string, path?: string);
|
|
59
77
|
}
|
|
60
78
|
/**
|
|
61
|
-
* Builds a codec from its two directions, the
|
|
79
|
+
* Builds a codec from its two directions, adding the value and bytes bindings.
|
|
80
|
+
* Both directions should throw a {@link CodecError} on a value of the wrong
|
|
81
|
+
* shape.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { cbor } from "@darkbio/crypto";
|
|
86
|
+
*
|
|
87
|
+
* // A date carried as whole seconds since the Unix epoch
|
|
88
|
+
* const date = cbor.codec<Date>(
|
|
89
|
+
* (value) => cbor.uint.encode(BigInt(Math.floor(value.getTime() / 1000))),
|
|
90
|
+
* (value) => new Date(Number(cbor.uint.decode(value)) * 1000),
|
|
91
|
+
* );
|
|
92
|
+
* const bytes = await cbor.encode(date.value(new Date("2026-01-01T00:00:00Z")));
|
|
93
|
+
* console.log(await cbor.decode(date.bytes(bytes))); // 2026-01-01T00:00:00.000Z
|
|
94
|
+
* ```
|
|
62
95
|
*
|
|
63
96
|
* @param encode - Converts a value into what cborg encodes
|
|
64
97
|
* @param decode - Converts what cborg decoded into a value
|
|
98
|
+
* @returns The codec
|
|
65
99
|
*/
|
|
66
100
|
export declare function codec<T>(encode: (value: T) => unknown, decode: (value: unknown) => T): Codec<T>;
|
|
67
101
|
/** A boolean. */
|
|
68
102
|
export declare const bool: Codec<boolean>;
|
|
69
|
-
/** Null, the
|
|
103
|
+
/** Null, the counterpart of Rust's `cbor::Null` and of a `None` option. */
|
|
70
104
|
export declare const nil: Codec<null>;
|
|
71
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* A UTF-8 text string. Decoding keeps every character, a leading U+FEFF
|
|
107
|
+
* included. Encoding rejects a string with a lone surrogate, since it has no
|
|
108
|
+
* UTF-8 form.
|
|
109
|
+
*/
|
|
72
110
|
export declare const text: Codec<string>;
|
|
73
111
|
/** A byte string. */
|
|
74
112
|
export declare const bytes: Codec<Uint8Array>;
|
|
75
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Anything, passed through as cborg decoded it, the counterpart of
|
|
115
|
+
* `cbor::Raw`. The value is not checked against any shape, but {@link encode}
|
|
116
|
+
* and {@link decode} still check its encoding.
|
|
117
|
+
*/
|
|
76
118
|
export declare const raw: Codec<unknown>;
|
|
77
|
-
/** An unsigned 64
|
|
119
|
+
/** An unsigned 64-bit integer, a bigint in both directions. */
|
|
78
120
|
export declare const uint: Codec<bigint>;
|
|
79
|
-
/** A signed 64
|
|
121
|
+
/** A signed 64-bit integer, a bigint in both directions. */
|
|
80
122
|
export declare const int: Codec<bigint>;
|
|
81
123
|
/**
|
|
82
124
|
* A value or null, the counterpart of `Option<T>` in an array or as a
|
|
83
125
|
* nullable map field.
|
|
126
|
+
*
|
|
127
|
+
* @param item - The codec of the value when it is not null
|
|
128
|
+
* @returns The codec
|
|
84
129
|
*/
|
|
85
130
|
export declare function nullable<T>(item: Codec<T>): Codec<T | null>;
|
|
86
131
|
/**
|
|
87
132
|
* A member of a set of small integers, the counterpart of a Rust enum encoded
|
|
88
133
|
* as its discriminant.
|
|
134
|
+
*
|
|
135
|
+
* @param values - The integers the value may take
|
|
136
|
+
* @returns The codec
|
|
89
137
|
*/
|
|
90
138
|
export declare function enumeration<E extends number>(values: readonly E[]): Codec<E>;
|
|
91
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* An array of any length of one kind of item, the counterpart of `Array<T>`.
|
|
141
|
+
*
|
|
142
|
+
* @param item - The codec of every item
|
|
143
|
+
* @returns The codec
|
|
144
|
+
*/
|
|
92
145
|
export declare function array<T>(item: Codec<T>): Codec<T[]>;
|
|
93
146
|
/**
|
|
94
147
|
* An array of a fixed length with an item codec per position, the counterpart
|
|
95
148
|
* of a tuple or a struct with `#[cbor(array)]`.
|
|
149
|
+
*
|
|
150
|
+
* @param items - The codec of each item, in order
|
|
151
|
+
* @returns The codec
|
|
96
152
|
*/
|
|
97
153
|
export declare function tuple<T extends unknown[]>(...items: Codecs<T>): Codec<T>;
|
|
98
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Declares a required map field.
|
|
156
|
+
*
|
|
157
|
+
* @param key - The integer key of the field in the map
|
|
158
|
+
* @param codec - The codec of the field's value
|
|
159
|
+
* @returns The field
|
|
160
|
+
* @throws CodecError if the key is not a safe integer
|
|
161
|
+
*/
|
|
99
162
|
export declare function field<T>(key: number, codec: Codec<T>): Field<T>;
|
|
100
163
|
/**
|
|
101
164
|
* Declares a map field that may be absent, the counterpart of an
|
|
102
|
-
* `Option<T>` field
|
|
165
|
+
* `Option<T>` field. The field is left out of the map when its value is
|
|
166
|
+
* undefined.
|
|
167
|
+
*
|
|
168
|
+
* @param field - The field to make optional
|
|
169
|
+
* @returns The optional field
|
|
103
170
|
*/
|
|
104
171
|
export declare function optional<T>(field: Field<T>): OptionalField<T>;
|
|
105
172
|
/**
|
|
106
|
-
* An integer
|
|
173
|
+
* An integer-keyed map with exactly the declared fields, the counterpart of
|
|
107
174
|
* a struct with `#[cbor(key = N)]` fields. Both ways, a field the map does
|
|
108
175
|
* not declare and a required field missing are refused, as is a key that is
|
|
109
176
|
* not an integer. Only own properties of a value count as its fields.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { cbor } from "@darkbio/crypto";
|
|
181
|
+
*
|
|
182
|
+
* const Bar = cbor.map({
|
|
183
|
+
* x: cbor.field(1, cbor.uint), // required
|
|
184
|
+
* y: cbor.optional(cbor.field(2, cbor.bytes)), // omitted when undefined
|
|
185
|
+
* z: cbor.field(3, cbor.nullable(cbor.uint)), // always present, a value or null
|
|
186
|
+
* });
|
|
187
|
+
* const bytes = await cbor.encode(Bar.value({ x: 7n, z: null }));
|
|
188
|
+
* // bytes holds a2 01 07 03 f6 in hex
|
|
189
|
+
*
|
|
190
|
+
* console.log(await cbor.decode(Bar.bytes(bytes))); // { x: 7n, z: null }
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @param fields - The fields of the map, by name
|
|
194
|
+
* @returns The codec
|
|
195
|
+
* @throws CodecError if two fields share a key
|
|
110
196
|
*/
|
|
111
197
|
export declare function map<F extends Fields>(fields: F): Codec<Values<F>>;
|
|
112
198
|
/**
|
|
113
|
-
* Encodes a value bound to its codec into
|
|
114
|
-
* by the Rust validator before they are returned.
|
|
199
|
+
* Encodes a value bound to its codec into deterministic CBOR.
|
|
115
200
|
*
|
|
116
201
|
* @param item - The value and the codec to encode it with
|
|
202
|
+
* @returns The CBOR bytes
|
|
117
203
|
* @throws CodecError on a value of the wrong shape
|
|
204
|
+
* @throws If the encoding falls outside the restricted type system, such as a
|
|
205
|
+
* float in a raw value or text with a lone surrogate
|
|
118
206
|
*/
|
|
119
207
|
export declare function encode<T>(item: Encodable<T>): Promise<Uint8Array>;
|
|
120
208
|
/**
|
|
121
|
-
* Decodes
|
|
122
|
-
*
|
|
209
|
+
* Decodes deterministic CBOR bound to its codec. The bytes must pass
|
|
210
|
+
* {@link verify} before anything is decoded.
|
|
123
211
|
*
|
|
124
212
|
* @param item - The bytes and the codec to decode them with
|
|
213
|
+
* @returns The decoded value
|
|
214
|
+
* @throws If the bytes are not valid restricted CBOR
|
|
125
215
|
* @throws CodecError on bytes of the wrong shape
|
|
126
216
|
*/
|
|
127
217
|
export declare function decode<T>(item: Decodable<T>): Promise<T>;
|
|
128
218
|
/**
|
|
129
|
-
*
|
|
130
|
-
* system
|
|
131
|
-
* text strings, byte strings, arrays, and integer-keyed maps).
|
|
219
|
+
* Verifies that data is exactly one complete CBOR item under the restricted
|
|
220
|
+
* type system.
|
|
132
221
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
222
|
+
* It checks UTF-8 text, deterministic integer and length encodings, integer
|
|
223
|
+
* map keys in order without duplicates, and the nesting limit. It does not
|
|
224
|
+
* check application-specific schemas or values. The `cose` and `cwt`
|
|
225
|
+
* functions apply the same check to every payload they sign, embed or return.
|
|
136
226
|
*
|
|
137
227
|
* @param data - The CBOR bytes to validate
|
|
138
228
|
* @throws If the data is not valid restricted CBOR
|
package/dist/cbor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AA4CA,kDAAkD;AAClD,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED,kDAAkD;AAClD,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,oEAAoE;IACpE,M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,GAAG,OAAO,CAAC,UAAU,CAAC,CAKvE;AAED;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAI9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5D"}
|
package/dist/cose.d.ts
CHANGED
|
@@ -2,50 +2,181 @@ import { Decodable, Encodable } from './cbor.js';
|
|
|
2
2
|
import { SecretKey as XdsaSecretKey, PublicKey as XdsaPublicKey, Fingerprint as XdsaFingerprint } from './xdsa.js';
|
|
3
3
|
import { SecretKey as XhpkeSecretKey, PublicKey as XhpkePublicKey, Fingerprint as XhpkeFingerprint } from './xhpke.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Creates a COSE_Sign1 signature with an embedded payload.
|
|
6
|
+
*
|
|
7
|
+
* Uses the current system time as the signature timestamp.
|
|
8
|
+
*
|
|
9
|
+
* @param msgToEmbed - The message to sign, embedded in the envelope
|
|
10
|
+
* @param msgToAuth - Additional authenticated data, signed but not embedded
|
|
11
|
+
* @param signer - The xDSA secret key to sign with
|
|
12
|
+
* @param domain - Application domain for separating protocol purposes
|
|
13
|
+
* @returns The serialized COSE_Sign1 envelope
|
|
14
|
+
* @throws CodecError if a message does not fit its codec
|
|
15
|
+
* @throws If a message falls outside the restricted CBOR type system
|
|
6
16
|
*/
|
|
7
17
|
export declare function sign<E, A>(msgToEmbed: Encodable<E>, msgToAuth: Encodable<A>, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
|
|
8
18
|
/**
|
|
9
|
-
*
|
|
19
|
+
* Creates a COSE_Sign1 signature without an embedded payload, the envelope
|
|
20
|
+
* payload being null.
|
|
21
|
+
*
|
|
22
|
+
* The caller's message is authenticated in external_aad, and the payload in
|
|
23
|
+
* the signature input is empty. See the module's wire profile for
|
|
24
|
+
* interoperability. Uses the current system time as the signature timestamp.
|
|
25
|
+
*
|
|
26
|
+
* @param msgToAuth - The message to sign, not embedded in the envelope
|
|
27
|
+
* @param signer - The xDSA secret key to sign with
|
|
28
|
+
* @param domain - Application domain for separating protocol purposes
|
|
29
|
+
* @returns The serialized COSE_Sign1 envelope
|
|
30
|
+
* @throws CodecError if the message does not fit its codec
|
|
31
|
+
* @throws If the message falls outside the restricted CBOR type system
|
|
10
32
|
*/
|
|
11
33
|
export declare function signDetached<A>(msgToAuth: Encodable<A>, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
|
|
12
34
|
/**
|
|
13
|
-
*
|
|
35
|
+
* Verifies a COSE_Sign1 signature and returns the embedded payload.
|
|
36
|
+
*
|
|
37
|
+
* Uses the current system time for the drift check.
|
|
38
|
+
*
|
|
39
|
+
* @param msgToCheck - The serialized COSE_Sign1 envelope, bound to the codec
|
|
40
|
+
* of its payload
|
|
41
|
+
* @param msgToAuth - The same additional authenticated data used during signing
|
|
42
|
+
* @param verifier - The xDSA public key to verify against
|
|
43
|
+
* @param domain - Application domain for separating protocol purposes
|
|
44
|
+
* @param maxDriftSecs - Maximum allowed timestamp difference in seconds, past
|
|
45
|
+
* or future. A value of n accepts differences up to and including n, with
|
|
46
|
+
* fractions rounded down. Undefined skips the check.
|
|
47
|
+
* @returns The decoded payload
|
|
48
|
+
* @throws If the envelope is malformed, carries no payload or does not verify
|
|
49
|
+
* for this key, `msgToAuth` and `domain`, or its timestamp drifts too far
|
|
50
|
+
* @throws If `maxDriftSecs` is negative or beyond 64 bits
|
|
51
|
+
* @throws CodecError if the payload or `msgToAuth` does not fit its codec
|
|
14
52
|
*/
|
|
15
53
|
export declare function verify<T, A>(msgToCheck: Decodable<T>, msgToAuth: Encodable<A>, verifier: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<T>;
|
|
16
54
|
/**
|
|
17
|
-
*
|
|
55
|
+
* Verifies a COSE_Sign1 signature with a detached payload.
|
|
56
|
+
*
|
|
57
|
+
* Uses the current system time for the drift check.
|
|
58
|
+
*
|
|
59
|
+
* @param msgToCheck - The serialized COSE_Sign1 envelope, with a null payload
|
|
60
|
+
* @param msgToAuth - The same message used during signing
|
|
61
|
+
* @param verifier - The xDSA public key to verify against
|
|
62
|
+
* @param domain - Application domain for separating protocol purposes
|
|
63
|
+
* @param maxDriftSecs - Maximum allowed timestamp difference in seconds, past
|
|
64
|
+
* or future. A value of n accepts differences up to and including n, with
|
|
65
|
+
* fractions rounded down. Undefined skips the check.
|
|
66
|
+
* @throws If the envelope is malformed, embeds a payload or does not verify
|
|
67
|
+
* for this key, `msgToAuth` and `domain`, or its timestamp drifts too far
|
|
68
|
+
* @throws If `maxDriftSecs` is negative or beyond 64 bits
|
|
69
|
+
* @throws CodecError if `msgToAuth` does not fit its codec
|
|
18
70
|
*/
|
|
19
71
|
export declare function verifyDetached<A>(msgToCheck: Uint8Array, msgToAuth: Encodable<A>, verifier: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<void>;
|
|
20
72
|
/**
|
|
21
|
-
*
|
|
73
|
+
* Extracts the signer's fingerprint from a COSE_Sign1 envelope without
|
|
74
|
+
* verifying it.
|
|
75
|
+
*
|
|
76
|
+
* This allows looking up the appropriate verification key before attempting
|
|
77
|
+
* full signature verification. The fingerprint is unauthenticated.
|
|
78
|
+
*
|
|
79
|
+
* @param signature - The serialized COSE_Sign1 envelope
|
|
80
|
+
* @returns The signer's fingerprint from the protected header's `kid`
|
|
81
|
+
* @throws If the envelope is malformed
|
|
22
82
|
*/
|
|
23
83
|
export declare function signer(signature: Uint8Array): Promise<XdsaFingerprint>;
|
|
24
84
|
/**
|
|
25
|
-
*
|
|
85
|
+
* Extracts the embedded payload from a COSE_Sign1 envelope without verifying
|
|
86
|
+
* it.
|
|
87
|
+
*
|
|
88
|
+
* The payload is unauthenticated and must not be trusted until verified with
|
|
89
|
+
* {@link verify}. Use {@link signer} to extract the signer's fingerprint for
|
|
90
|
+
* key lookup.
|
|
26
91
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
92
|
+
* @param signature - The serialized COSE_Sign1 envelope, bound to the codec of
|
|
93
|
+
* its payload
|
|
94
|
+
* @returns The decoded, unverified payload
|
|
95
|
+
* @throws If the envelope is malformed or carries no payload
|
|
96
|
+
* @throws CodecError if the payload does not fit its codec
|
|
29
97
|
*/
|
|
30
98
|
export declare function peek<T>(signature: Decodable<T>): Promise<T>;
|
|
31
99
|
/**
|
|
32
|
-
*
|
|
100
|
+
* Extracts the recipient's fingerprint from a COSE_Encrypt0 envelope without
|
|
101
|
+
* decrypting it.
|
|
102
|
+
*
|
|
103
|
+
* This allows looking up the appropriate decryption key before attempting
|
|
104
|
+
* full decryption. The fingerprint is unauthenticated.
|
|
105
|
+
*
|
|
106
|
+
* @param ciphertext - The serialized COSE_Encrypt0 envelope
|
|
107
|
+
* @returns The recipient's fingerprint from the protected header's `kid`
|
|
108
|
+
* @throws If the envelope is malformed
|
|
33
109
|
*/
|
|
34
110
|
export declare function recipient(ciphertext: Uint8Array): Promise<XhpkeFingerprint>;
|
|
35
111
|
/**
|
|
36
|
-
*
|
|
112
|
+
* Signs a message then encrypts it to a recipient.
|
|
113
|
+
*
|
|
114
|
+
* Uses the current system time as the signature timestamp.
|
|
115
|
+
*
|
|
116
|
+
* @param msgToSeal - The message to sign and encrypt
|
|
117
|
+
* @param msgToAuth - Additional authenticated data, signed and bound to the
|
|
118
|
+
* encryption but not embedded
|
|
119
|
+
* @param signerKey - The xDSA secret key to sign with
|
|
120
|
+
* @param recipientKey - The xHPKE public key to encrypt to
|
|
121
|
+
* @param domain - Application domain for HPKE key derivation
|
|
122
|
+
* @returns The serialized COSE_Encrypt0 envelope holding the encrypted
|
|
123
|
+
* COSE_Sign1
|
|
124
|
+
* @throws CodecError if a message does not fit its codec
|
|
125
|
+
* @throws If a message falls outside the restricted CBOR type system
|
|
37
126
|
*/
|
|
38
127
|
export declare function seal<S, A>(msgToSeal: Encodable<S>, msgToAuth: Encodable<A>, signerKey: XdsaSecretKey, recipientKey: XhpkePublicKey, domain: Uint8Array): Promise<Uint8Array>;
|
|
39
128
|
/**
|
|
40
|
-
*
|
|
129
|
+
* Decrypts and verifies a sealed message.
|
|
130
|
+
*
|
|
131
|
+
* Uses the current system time for the drift check.
|
|
132
|
+
*
|
|
133
|
+
* @param msgToOpen - The serialized COSE_Encrypt0 envelope, bound to the codec
|
|
134
|
+
* of its payload
|
|
135
|
+
* @param msgToAuth - The same additional authenticated data used during sealing
|
|
136
|
+
* @param recipientKey - The xHPKE secret key to decrypt with
|
|
137
|
+
* @param senderKey - The xDSA public key to verify the signature against
|
|
138
|
+
* @param domain - Application domain for HPKE key derivation
|
|
139
|
+
* @param maxDriftSecs - Maximum allowed timestamp difference in seconds, past
|
|
140
|
+
* or future. A value of n accepts differences up to and including n, with
|
|
141
|
+
* fractions rounded down. Undefined skips the check.
|
|
142
|
+
* @returns The decoded payload
|
|
143
|
+
* @throws If the envelope is malformed, does not decrypt or verify for these
|
|
144
|
+
* keys, `msgToAuth` and `domain`, or its timestamp drifts too far
|
|
145
|
+
* @throws If `maxDriftSecs` is negative or beyond 64 bits
|
|
146
|
+
* @throws CodecError if the payload or `msgToAuth` does not fit its codec
|
|
41
147
|
*/
|
|
42
148
|
export declare function open<T, A>(msgToOpen: Decodable<T>, msgToAuth: Encodable<A>, recipientKey: XhpkeSecretKey, senderKey: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<T>;
|
|
43
149
|
/**
|
|
44
|
-
*
|
|
150
|
+
* Encrypts an already signed COSE_Sign1 envelope to a recipient.
|
|
151
|
+
*
|
|
152
|
+
* For most use cases, prefer {@link seal}, which signs and encrypts in one
|
|
153
|
+
* step. Use this only when re-encrypting a message from {@link decrypt} to a
|
|
154
|
+
* different recipient without access to the original signer's key. The
|
|
155
|
+
* envelope is encrypted as given, without being checked.
|
|
156
|
+
*
|
|
157
|
+
* @param sign1 - The COSE_Sign1 envelope, such as one from {@link decrypt}
|
|
158
|
+
* @param msgToAuth - The same additional authenticated data used during sealing
|
|
159
|
+
* @param recipientKey - The xHPKE public key to encrypt to
|
|
160
|
+
* @param domain - Application domain for HPKE key derivation
|
|
161
|
+
* @returns The serialized COSE_Encrypt0 envelope
|
|
162
|
+
* @throws CodecError if `msgToAuth` does not fit its codec
|
|
45
163
|
*/
|
|
46
164
|
export declare function encrypt<A>(sign1: Uint8Array, msgToAuth: Encodable<A>, recipientKey: XhpkePublicKey, domain: Uint8Array): Promise<Uint8Array>;
|
|
47
165
|
/**
|
|
48
|
-
*
|
|
166
|
+
* Decrypts a sealed message without verifying the signature.
|
|
167
|
+
*
|
|
168
|
+
* This allows inspecting the signer before verification. Use {@link signer}
|
|
169
|
+
* to extract the signer's fingerprint, then {@link verify} with the same
|
|
170
|
+
* `msgToAuth` and `domain` to verify.
|
|
171
|
+
*
|
|
172
|
+
* @param msgToOpen - The serialized COSE_Encrypt0 envelope
|
|
173
|
+
* @param msgToAuth - The same additional authenticated data used during sealing
|
|
174
|
+
* @param recipientKey - The xHPKE secret key to decrypt with
|
|
175
|
+
* @param domain - Application domain for HPKE key derivation
|
|
176
|
+
* @returns The decrypted COSE_Sign1 envelope, not yet verified
|
|
177
|
+
* @throws If the envelope is malformed or does not decrypt for this key,
|
|
178
|
+
* `msgToAuth` and `domain`
|
|
179
|
+
* @throws CodecError if `msgToAuth` does not fit its codec
|
|
49
180
|
*/
|
|
50
181
|
export declare function decrypt<A>(msgToOpen: Uint8Array, msgToAuth: Encodable<A>, recipientKey: XhpkeSecretKey, domain: Uint8Array): Promise<Uint8Array>;
|
|
51
182
|
//# sourceMappingURL=cose.d.ts.map
|
package/dist/cose.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cose.d.ts","sourceRoot":"","sources":["../src/cose.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,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