@darkbio/crypto 0.17.2 → 0.18.0

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 CHANGED
@@ -32,7 +32,7 @@ The library is opinionated. Parameters and primitives were selected to provide m
32
32
 
33
33
  *¹ Whilst RSA is used in the Dark Bio project for secure boot signatures on pre-quantum hardware, there was no reason to expose that in the TypeScript wrappers. It's available in Rust so anyone needing it can expose it easily themselves.*
34
34
 
35
- *² As CBOR encoding/decoding would require a full reimplementation in TypeScript, that is delegated to any preferred 3rd party library. To ensure correctness, this package provides a `cbor.verify`, which it also implicitly enforces that when crossing through `cose`.*
35
+ *² 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
36
 
37
37
  ## Native packages
38
38
 
@@ -1 +1 @@
1
- {"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["../src/argon2.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;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,CAKrB"}
1
+ {"version":3,"file":"argon2.d.ts","sourceRoot":"","sources":["../src/argon2.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;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,CAYrB"}
package/dist/cbor.d.ts CHANGED
@@ -1,11 +1,138 @@
1
+ /** A value bound to the codec that encodes it. */
2
+ export interface Encodable<T> {
3
+ readonly codec: Codec<T>;
4
+ readonly value: T;
5
+ }
6
+ /** Bytes bound to the codec that decodes them. */
7
+ export interface Decodable<T> {
8
+ readonly codec: Codec<T>;
9
+ readonly bytes: Uint8Array;
10
+ }
11
+ /**
12
+ * A codec between a value of type T and the representation cborg encodes and
13
+ * decodes. Both directions throw a {@link CodecError} on a value of the wrong
14
+ * shape.
15
+ */
16
+ export interface Codec<T> {
17
+ /** Converts a value into what cborg encodes, checking its shape. */
18
+ encode(value: T): unknown;
19
+ /** Converts what cborg decoded into a value, checking its shape. */
20
+ decode(value: unknown): T;
21
+ /** Binds a value to this codec for encoding. */
22
+ value(value: T): Encodable<T>;
23
+ /** Binds bytes to this codec for decoding. */
24
+ bytes(data: Uint8Array): Decodable<T>;
25
+ }
26
+ /** A required field of a map, a codec at an integer key. */
27
+ export interface Field<T> {
28
+ readonly key: number;
29
+ readonly codec: Codec<T>;
30
+ readonly required: true;
31
+ }
32
+ /** An optional field of a map, absent from the map when undefined. */
33
+ export interface OptionalField<T> {
34
+ readonly key: number;
35
+ readonly codec: Codec<T>;
36
+ readonly required: false;
37
+ }
38
+ /** The fields of a map codec, by name. */
39
+ export type Fields = Record<string, Field<unknown> | OptionalField<unknown>>;
40
+ /** The value type of a map codec, required fields present and optional ones optional. */
41
+ export type Values<F extends Fields> = {
42
+ [K in keyof F as F[K] extends Field<unknown> ? K : never]: F[K] extends Field<infer T> ? T : never;
43
+ } & {
44
+ [K in keyof F as F[K] extends OptionalField<unknown> ? K : never]?: F[K] extends OptionalField<infer T> ? T : never;
45
+ };
46
+ /** The value types of a tuple codec's items. */
47
+ export type Codecs<T extends unknown[]> = {
48
+ [I in keyof T]: Codec<T[I]>;
49
+ };
50
+ /**
51
+ * A value of the wrong shape for a codec. The path names where in the value
52
+ * the mismatch is, array items as `[i]` and map fields as `.name`, empty at
53
+ * the top.
54
+ */
55
+ export declare class CodecError extends Error {
56
+ readonly reason: string;
57
+ readonly path: string;
58
+ constructor(reason: string, path?: string);
59
+ }
60
+ /**
61
+ * Builds a codec from its two directions, the bindings coming for free.
62
+ *
63
+ * @param encode - Converts a value into what cborg encodes
64
+ * @param decode - Converts what cborg decoded into a value
65
+ */
66
+ export declare function codec<T>(encode: (value: T) => unknown, decode: (value: unknown) => T): Codec<T>;
67
+ /** A boolean. */
68
+ export declare const bool: Codec<boolean>;
69
+ /** Null, the value of `Option<T>::None` and of a CWT's authenticated data. */
70
+ export declare const nil: Codec<null>;
71
+ /** A UTF-8 text string. */
72
+ export declare const text: Codec<string>;
73
+ /** A byte string. */
74
+ export declare const bytes: Codec<Uint8Array>;
75
+ /** Anything, passed through as cborg decoded it, the counterpart of `cbor::Raw`. */
76
+ export declare const raw: Codec<unknown>;
77
+ /** An unsigned 64 bit integer. */
78
+ export declare const uint: Codec<bigint>;
79
+ /** A signed 64 bit integer. */
80
+ export declare const int: Codec<bigint>;
81
+ /**
82
+ * A value or null, the counterpart of `Option<T>` in an array or as a
83
+ * nullable map field.
84
+ */
85
+ export declare function nullable<T>(item: Codec<T>): Codec<T | null>;
86
+ /**
87
+ * A member of a set of small integers, the counterpart of a Rust enum encoded
88
+ * as its discriminant.
89
+ */
90
+ export declare function enumeration<E extends number>(values: readonly E[]): Codec<E>;
91
+ /** An array of any length of one kind of item, the counterpart of `Array<T>`. */
92
+ export declare function array<T>(item: Codec<T>): Codec<T[]>;
93
+ /**
94
+ * An array of a fixed length with an item codec per position, the counterpart
95
+ * of a tuple or a struct with `#[cbor(array)]`.
96
+ */
97
+ export declare function tuple<T extends unknown[]>(...items: Codecs<T>): Codec<T>;
98
+ /** Declares a required map field. */
99
+ export declare function field<T>(key: number, codec: Codec<T>): Field<T>;
100
+ /**
101
+ * Declares a map field that may be absent, the counterpart of an
102
+ * `Option<T>` field, absent when undefined.
103
+ */
104
+ export declare function optional<T>(field: Field<T>): OptionalField<T>;
105
+ /**
106
+ * An integer keyed map with exactly the declared fields, the counterpart of
107
+ * a struct with `#[cbor(key = N)]` fields. Both ways, a field the map does
108
+ * not declare and a required field missing are refused, as is a key that is
109
+ * not an integer. Only own properties of a value count as its fields.
110
+ */
111
+ export declare function map<F extends Fields>(fields: F): Codec<Values<F>>;
112
+ /**
113
+ * Encodes a value bound to its codec into canonical CBOR, the bytes checked
114
+ * by the Rust validator before they are returned.
115
+ *
116
+ * @param item - The value and the codec to encode it with
117
+ * @throws CodecError on a value of the wrong shape
118
+ */
119
+ export declare function encode<T>(item: Encodable<T>): Promise<Uint8Array>;
120
+ /**
121
+ * Decodes canonical CBOR bound to its codec, the bytes checked by the Rust
122
+ * validator before anything is decoded.
123
+ *
124
+ * @param item - The bytes and the codec to decode them with
125
+ * @throws CodecError on bytes of the wrong shape
126
+ */
127
+ export declare function decode<T>(item: Decodable<T>): Promise<T>;
1
128
  /**
2
129
  * Verify that data is valid CBOR under the restricted deterministic type
3
130
  * system used across the darkbio ecosystem (booleans, null, 64-bit integers,
4
131
  * text strings, byte strings, arrays, and integer-keyed maps).
5
132
  *
6
133
  * The COSE and CWT functions run this check internally on every payload they
7
- * sign or embed; use it directly to pre-check hand-rolled encodings such as
8
- * custom claim values.
134
+ * sign, embed or hand back; use it directly to pre-check hand-rolled
135
+ * encodings.
9
136
  *
10
137
  * @param data - The CBOR bytes to validate
11
138
  * @throws If the data is not valid restricted CBOR
@@ -1 +1 @@
1
- {"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5D"}
1
+ {"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../src/cbor.ts"],"names":[],"mappings":"AA6BA,kDAAkD;AAClD,MAAM,WAAW,SAAS,CAAC,CAAC;IA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AAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAqEjE;AAED;;;;;;GAMG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAKvE;AAED;;;;;;GAMG;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
@@ -1,24 +1,22 @@
1
+ import { Decodable, Encodable } from './cbor.js';
1
2
  import { SecretKey as XdsaSecretKey, PublicKey as XdsaPublicKey, Fingerprint as XdsaFingerprint } from './xdsa.js';
2
3
  import { SecretKey as XhpkeSecretKey, PublicKey as XhpkePublicKey, Fingerprint as XhpkeFingerprint } from './xhpke.js';
3
4
  /**
4
5
  * Create a COSE_Sign1 signature with an embedded payload.
5
6
  */
6
- export declare function sign<E, A>(msgToEmbed: E, msgToAuth: A, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
7
+ export declare function sign<E, A>(msgToEmbed: Encodable<E>, msgToAuth: Encodable<A>, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
7
8
  /**
8
9
  * Create a COSE_Sign1 signature without an embedded payload (detached mode).
9
10
  */
10
- export declare function signDetached<A>(msgToAuth: A, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
11
+ export declare function signDetached<A>(msgToAuth: Encodable<A>, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
11
12
  /**
12
13
  * Verify a COSE_Sign1 signature and return the embedded payload.
13
- *
14
- * CBOR maps in the payload decode as `Map` objects, not plain objects, so a
15
- * payload signed from a plain object comes back as a `Map`.
16
14
  */
17
- export declare function verify<T, A>(msgToCheck: Uint8Array, msgToAuth: A, verifier: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<T>;
15
+ export declare function verify<T, A>(msgToCheck: Decodable<T>, msgToAuth: Encodable<A>, verifier: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<T>;
18
16
  /**
19
17
  * Verify a COSE_Sign1 signature with a detached payload.
20
18
  */
21
- export declare function verifyDetached<A>(msgToCheck: Uint8Array, msgToAuth: A, verifier: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<void>;
19
+ export declare function verifyDetached<A>(msgToCheck: Uint8Array, msgToAuth: Encodable<A>, verifier: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<void>;
22
20
  /**
23
21
  * Extract the signer's fingerprint from a COSE_Sign1 without verifying.
24
22
  */
@@ -28,10 +26,8 @@ export declare function signer(signature: Uint8Array): Promise<XdsaFingerprint>;
28
26
  *
29
27
  * Warning: The returned payload is unauthenticated and should not be
30
28
  * trusted until verified with `verify`.
31
- *
32
- * CBOR maps in the payload decode as `Map` objects, not plain objects.
33
29
  */
34
- export declare function peek<T>(signature: Uint8Array): Promise<T>;
30
+ export declare function peek<T>(signature: Decodable<T>): Promise<T>;
35
31
  /**
36
32
  * Extract the recipient's fingerprint from a COSE_Encrypt0 without decrypting.
37
33
  */
@@ -39,20 +35,17 @@ export declare function recipient(ciphertext: Uint8Array): Promise<XhpkeFingerpr
39
35
  /**
40
36
  * Sign a message then encrypt it to a recipient (sign-then-encrypt).
41
37
  */
42
- export declare function seal<S, A>(msgToSeal: S, msgToAuth: A, signerKey: XdsaSecretKey, recipientKey: XhpkePublicKey, domain: Uint8Array): Promise<Uint8Array>;
38
+ export declare function seal<S, A>(msgToSeal: Encodable<S>, msgToAuth: Encodable<A>, signerKey: XdsaSecretKey, recipientKey: XhpkePublicKey, domain: Uint8Array): Promise<Uint8Array>;
43
39
  /**
44
40
  * Decrypt and verify a sealed message.
45
- *
46
- * CBOR maps in the payload decode as `Map` objects, not plain objects, so a
47
- * payload sealed from a plain object comes back as a `Map`.
48
41
  */
49
- export declare function open<T, A>(msgToOpen: Uint8Array, msgToAuth: A, recipientKey: XhpkeSecretKey, senderKey: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<T>;
42
+ export declare function open<T, A>(msgToOpen: Decodable<T>, msgToAuth: Encodable<A>, recipientKey: XhpkeSecretKey, senderKey: XdsaPublicKey, domain: Uint8Array, maxDriftSecs?: number): Promise<T>;
50
43
  /**
51
44
  * Encrypt an already-signed COSE_Sign1 to a recipient.
52
45
  */
53
- export declare function encrypt<A>(sign1: Uint8Array, msgToAuth: A, recipientKey: XhpkePublicKey, domain: Uint8Array): Promise<Uint8Array>;
46
+ export declare function encrypt<A>(sign1: Uint8Array, msgToAuth: Encodable<A>, recipientKey: XhpkePublicKey, domain: Uint8Array): Promise<Uint8Array>;
54
47
  /**
55
48
  * Decrypt a sealed message without verifying the signature.
56
49
  */
57
- export declare function decrypt<A>(msgToOpen: Uint8Array, msgToAuth: A, recipientKey: XhpkeSecretKey, domain: Uint8Array): Promise<Uint8Array>;
50
+ export declare function decrypt<A>(msgToOpen: Uint8Array, msgToAuth: Encodable<A>, recipientKey: XhpkeSecretKey, domain: Uint8Array): Promise<Uint8Array>;
58
51
  //# sourceMappingURL=cose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cose.d.ts","sourceRoot":"","sources":["../src/cose.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,SAAS,IAAI,cAAc,EAC3B,SAAS,IAAI,cAAc,EAC3B,WAAW,IAAI,gBAAgB,EAChC,MAAM,YAAY,CAAC;AA6BpB;;GAEG;AACH,wBAAsB,IAAI,CAAC,CAAC,EAAE,CAAC,EAC7B,UAAU,EAAE,CAAC,EACb,SAA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CAAC,CAAC,CAAC,EACvB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,YAAY,EAAE,cAAc,EAC5B,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,CAAC,CAAC,CAWZ;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,YAAY,EAAE,cAAc,EAC5B,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAKrB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,YAAY,EAAE,cAAc,EAC5B,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAKrB"}
package/dist/cwt.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { SecretKey as XdsaSecretKey, PublicKey as XdsaPublicKey, Fingerprint as XdsaFingerprint } from './xdsa.js';
2
- import { PublicKey as XhpkePublicKey } from './xhpke.js';
1
+ import { Codec, Decodable, Encodable } from './cbor.js';
2
+ import * as xdsa from "./xdsa.js";
3
+ import * as xhpke from "./xhpke.js";
3
4
  /**
4
5
  * Debug port state per RFC 9711 Section 4.2.9.
5
6
  */
@@ -31,130 +32,83 @@ export declare enum IntendedUse {
31
32
  ProofOfPossession = 5
32
33
  }
33
34
  /**
34
- * A CWT claims set with typed accessors for standard CWT (RFC 8392) and
35
- * EAT (RFC 9711) claims.
35
+ * An OEM identifier in one of the three forms RFC 9711 allows, an IANA
36
+ * private enterprise number, a 3 byte IEEE organisationally unique identifier
37
+ * or a 16 byte random identifier.
38
+ */
39
+ export type Oemid = {
40
+ pen: bigint;
41
+ } | {
42
+ ieee: Uint8Array;
43
+ } | {
44
+ random: Uint8Array;
45
+ };
46
+ /** Codec of an OEM identifier, an unsigned integer or 3 or 16 bytes. */
47
+ export declare const oemid: Codec<Oemid>;
48
+ /**
49
+ * Codec of a version, the text wrapped in a one element array as RFC 9711
50
+ * has it. The optional scheme element is not supported.
51
+ */
52
+ export declare const version: Codec<string>;
53
+ /**
54
+ * Codec of a confirmation, a public key the token's subject holds, wrapped in
55
+ * a COSE_Key of exactly the key type and the key bytes (RFC 8747).
36
56
  *
37
- * Standard claims are exposed as typed properties. Custom or application-
38
- * specific claims can be accessed via `get()` / `set()` using their integer key.
57
+ * @param algorithm - The COSE algorithm identifier of the key type
58
+ * @param key - The codec of the key
39
59
  */
40
- export declare class Claims {
41
- private readonly map;
42
- /** Creates an empty claims set. */
43
- constructor();
44
- private static fromMap;
45
- /** Issuer: identifies the principal that issued the token (key 1). */
46
- get issuer(): string | undefined;
47
- set issuer(value: string | undefined);
48
- /** Subject: identifies the principal that is the subject of the token (key 2). */
49
- get subject(): string | undefined;
50
- set subject(value: string | undefined);
51
- /** Audience: identifies the recipients the token is intended for (key 3). */
52
- get audience(): string | undefined;
53
- set audience(value: string | undefined);
54
- /**
55
- * Expiration: the time on or after which the token must not be accepted
56
- * (key 4, Unix timestamp in seconds).
57
- */
58
- get expiration(): number | undefined;
59
- set expiration(value: number | undefined);
60
- /**
61
- * NotBefore: the time before which the token must not be accepted
62
- * (key 5, Unix timestamp in seconds).
63
- */
64
- get notBefore(): number | undefined;
65
- set notBefore(value: number | undefined);
66
- /**
67
- * IssuedAt: the time at which the token was issued
68
- * (key 6, Unix timestamp in seconds).
69
- */
70
- get issuedAt(): number | undefined;
71
- set issuedAt(value: number | undefined);
72
- /** TokenID: a unique identifier for the token (key 7). */
73
- get tokenId(): Uint8Array | undefined;
74
- set tokenId(value: Uint8Array | undefined);
75
- /**
76
- * Sets the Confirm claim to bind an xDSA public key to this token.
77
- * Encoded as: `{8: {1: {1: -70000, -2: <key_bytes>}}}`
78
- */
79
- setConfirmXdsa(key: XdsaPublicKey): void;
80
- /**
81
- * Sets the Confirm claim to bind an xHPKE public key to this token.
82
- * Encoded as: `{8: {1: {1: -70001, -2: <key_bytes>}}}`
83
- */
84
- setConfirmXhpke(key: XhpkePublicKey): void;
85
- /**
86
- * Extracts the bound xDSA public key from the Confirm claim, or undefined
87
- * if absent or a different key type.
88
- */
89
- getConfirmXdsa(): Promise<XdsaPublicKey | undefined>;
90
- /**
91
- * Extracts the bound xHPKE public key from the Confirm claim, or undefined
92
- * if absent or a different key type.
93
- */
94
- getConfirmXhpke(): Promise<XhpkePublicKey | undefined>;
95
- private readConfirm;
96
- /** UEID: a globally unique device identifier (key 256). */
97
- get ueid(): Uint8Array | undefined;
98
- set ueid(value: Uint8Array | undefined);
99
- /**
100
- * OEMID: hardware manufacturer identifier (key 258).
101
- *
102
- * Use {@link setOemidRandom}, {@link setOemidIeee}, or {@link setOemidPen} to set.
103
- * The getter returns the raw CBOR value (Uint8Array or number).
104
- */
105
- get oemid(): Uint8Array | number | undefined;
106
- /** Sets OEMID to a 16-byte random manufacturer identifier. */
107
- setOemidRandom(id: Uint8Array): void;
108
- /** Sets OEMID to a 3-byte IEEE OUI/MA-L. */
109
- setOemidIeee(id: Uint8Array): void;
110
- /** Sets OEMID to an IANA Private Enterprise Number. */
111
- setOemidPen(pen: number): void;
112
- /** HwModel: product or board model identifier (key 259). */
113
- get hwModel(): Uint8Array | undefined;
114
- set hwModel(value: Uint8Array | undefined);
115
- /**
116
- * HwVersion: hardware revision identifier (key 260).
117
- * Stored as a 1-element CBOR array per RFC 9711 Section 4.2.5.
118
- */
119
- get hwVersion(): string | undefined;
120
- set hwVersion(value: string | undefined);
121
- /** Uptime: seconds since last boot (key 261). */
122
- get uptime(): number | undefined;
123
- set uptime(value: number | undefined);
124
- /** OemBoot: whether the boot chain is OEM-authorized (key 262). */
125
- get oemBoot(): boolean | undefined;
126
- set oemBoot(value: boolean | undefined);
127
- /** DebugStatus: debug port state (key 263). */
128
- get debugStatus(): DebugState | undefined;
129
- set debugStatus(value: DebugState | undefined);
130
- /** BootCount: number of times the device has booted (key 267). */
131
- get bootCount(): number | undefined;
132
- set bootCount(value: number | undefined);
133
- /** BootSeed: random value unique to the current boot cycle (key 268). */
134
- get bootSeed(): Uint8Array | undefined;
135
- set bootSeed(value: Uint8Array | undefined);
136
- /** SwName: name of the firmware or software (key 270). */
137
- get swName(): string | undefined;
138
- set swName(value: string | undefined);
139
- /**
140
- * SwVersion: software version identifier (key 271).
141
- * Stored as a 1-element CBOR array per RFC 9711 Section 4.2.7.
142
- */
143
- get swVersion(): string | undefined;
144
- set swVersion(value: string | undefined);
145
- /** IntendedUse: the token's purpose (key 275). */
146
- get intendedUse(): IntendedUse | undefined;
147
- set intendedUse(value: IntendedUse | undefined);
148
- /** Gets a custom claim by its integer key. */
149
- get(key: number): unknown;
150
- /** Sets a custom claim by its integer key. */
151
- set(key: number, value: unknown): void;
152
- private setOrDelete;
153
- /** Encodes the claims to CBOR bytes. @internal */
154
- encode(): Uint8Array;
155
- /** Decodes claims from CBOR bytes. @internal */
156
- static decode(bytes: Uint8Array): Claims;
157
- }
60
+ export declare function confirmation<K>(algorithm: number, key: Codec<K>): Codec<K>;
61
+ /**
62
+ * The registered claims, RFC 8392 for the token ones and RFC 9711 for the
63
+ * attestation ones under `eat`. A claim set is a `cbor.map` of these.
64
+ */
65
+ export declare const claims: {
66
+ /** The issuer, the principal that issued the token (key 1). */
67
+ issuer: import('./cbor.js').Field<string>;
68
+ /** The subject, the principal the token is about (key 2). */
69
+ subject: import('./cbor.js').Field<string>;
70
+ /** The audience, the recipients the token is meant for (key 3). */
71
+ audience: import('./cbor.js').Field<string>;
72
+ /** The expiration, Unix seconds the token is valid until, exclusive (key 4). */
73
+ expiration: import('./cbor.js').Field<bigint>;
74
+ /** The not before time, Unix seconds the token is valid from (key 5). */
75
+ notBefore: import('./cbor.js').Field<bigint>;
76
+ /** The issue time, Unix seconds the token was issued (key 6). */
77
+ issuedAt: import('./cbor.js').Field<bigint>;
78
+ /** The token identifier, unique to the token (key 7). */
79
+ tokenId: import('./cbor.js').Field<Uint8Array<ArrayBufferLike>>;
80
+ /** The confirmation, an xDSA public key the subject holds (key 8). */
81
+ confirmXdsa: import('./cbor.js').Field<xdsa.PublicKey>;
82
+ /** The confirmation, an xHPKE public key the subject holds (key 8). */
83
+ confirmXhpke: import('./cbor.js').Field<xhpke.PublicKey>;
84
+ /** The Entity Attestation Token claims of RFC 9711. */
85
+ eat: {
86
+ /** Universal entity identifier (key 256). */
87
+ ueid: import('./cbor.js').Field<Uint8Array<ArrayBufferLike>>;
88
+ /** OEM identifier (key 258). */
89
+ oemid: import('./cbor.js').Field<Oemid>;
90
+ /** Hardware model (key 259). */
91
+ hwModel: import('./cbor.js').Field<Uint8Array<ArrayBufferLike>>;
92
+ /** Hardware version (key 260). */
93
+ hwVersion: import('./cbor.js').Field<string>;
94
+ /** Seconds since boot (key 261). */
95
+ uptime: import('./cbor.js').Field<bigint>;
96
+ /** Whether the entity booted OEM authorised software (key 262). */
97
+ oemBoot: import('./cbor.js').Field<boolean>;
98
+ /** Debug state of the entity (key 263). */
99
+ debugStatus: import('./cbor.js').Field<DebugState>;
100
+ /** Number of boots (key 267). */
101
+ bootCount: import('./cbor.js').Field<bigint>;
102
+ /** Random seed of the boot (key 268). */
103
+ bootSeed: import('./cbor.js').Field<Uint8Array<ArrayBufferLike>>;
104
+ /** Software name (key 270). */
105
+ swName: import('./cbor.js').Field<string>;
106
+ /** Software version (key 271). */
107
+ swVersion: import('./cbor.js').Field<string>;
108
+ /** Intended use of the token (key 275). */
109
+ intendedUse: import('./cbor.js').Field<IntendedUse>;
110
+ };
111
+ };
158
112
  /**
159
113
  * Issues a CWT by signing the claims with COSE Sign1.
160
114
  *
@@ -165,7 +119,7 @@ export declare class Claims {
165
119
  * @param domain - Application-specific domain separator
166
120
  * @returns The serialized CWT
167
121
  */
168
- export declare function issue(claims: Claims, signer: XdsaSecretKey, domain: Uint8Array): Promise<Uint8Array>;
122
+ export declare function issue<C>(claims: Encodable<C>, signer: xdsa.SecretKey, domain: Uint8Array): Promise<Uint8Array>;
169
123
  /**
170
124
  * Verifies a CWT's COSE signature and temporal validity, then returns the
171
125
  * decoded claims.
@@ -180,7 +134,7 @@ export declare function issue(claims: Claims, signer: XdsaSecretKey, domain: Uin
180
134
  * @param now - Current Unix timestamp for temporal validation (undefined to skip)
181
135
  * @returns The decoded claims
182
136
  */
183
- export declare function verify(token: Uint8Array, verifier: XdsaPublicKey, domain: Uint8Array, now?: number): Promise<Claims>;
137
+ export declare function verify<C>(token: Decodable<C>, verifier: xdsa.PublicKey, domain: Uint8Array, now?: number | bigint): Promise<C>;
184
138
  /**
185
139
  * Extracts the signer's fingerprint from a CWT without verifying.
186
140
  *
@@ -190,7 +144,7 @@ export declare function verify(token: Uint8Array, verifier: XdsaPublicKey, domai
190
144
  * @param token - The serialized CWT
191
145
  * @returns The signer fingerprint
192
146
  */
193
- export declare function signer(token: Uint8Array): Promise<XdsaFingerprint>;
147
+ export declare function signer(token: Uint8Array): Promise<xdsa.Fingerprint>;
194
148
  /**
195
149
  * Extracts claims from a CWT without verifying the signature.
196
150
  *
@@ -201,5 +155,5 @@ export declare function signer(token: Uint8Array): Promise<XdsaFingerprint>;
201
155
  * @param token - The serialized CWT
202
156
  * @returns The decoded (but unverified) claims
203
157
  */
204
- export declare function peek(token: Uint8Array): Promise<Claims>;
158
+ export declare function peek<C>(token: Decodable<C>): Promise<C>;
205
159
  //# sourceMappingURL=cwt.d.ts.map
package/dist/cwt.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cwt.d.ts","sourceRoot":"","sources":["../src/cwt.ts"],"names":[],"mappings":"AAgDA,OAAO,EACL,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AAMzD;;GAEG;AACH,oBAAY,UAAU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QG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAGzE;AAED;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAG7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["../src/hkdf.ts"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH,wBAAsB,GAAG,CACvB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,MAAM,CAC1B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAGrB"}
1
+ {"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["../src/hkdf.ts"],"names":[],"mappings":"AAcA;;;;;;;;GAQG;AACH,wBAAsB,GAAG,CACvB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,MAAM,CAC1B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAGrB"}