@owf/mdoc 0.6.0 → 0.6.1-alpha-20260521074626
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/dist/index.d.mts +104 -560
- package/dist/index.mjs +220 -1045
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,209 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CborStructure, CoseKey, CoseKey as CoseKey$1, CoseKeyDecodedStructure, CoseKeyEncodedStructure, CoseKeyOptions, Curve, DataItem, DateOnly, DecodedStructureType, DigestAlgorithm, EncodedStructureType, KeyOps, KeyType, Mac0, Mac0 as Mac0$1, Mac0Context, Mac0DecodedStructure, Mac0EncodedStructure, Mac0Options, MacAlgorithm, ProtectedHeaders, RegisteredCwtClaimKey, RegisteredCwtHeaderClaimKey, Sign1, Sign1 as Sign1$1, Sign1Context, Sign1DecodedStructure, Sign1EncodedStructure, Sign1Options, SignatureAlgorithm, SignatureAlgorithm as SignatureAlgorithm$1, UnprotectedHeaders, cborDecode, cborEncode } from "@owf/cose";
|
|
2
2
|
import z$1, { z } from "zod";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
//#region src/context.d.ts
|
|
5
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
6
|
+
interface MdocContext {
|
|
7
|
+
crypto: {
|
|
8
|
+
random: (length: number) => Uint8Array;
|
|
9
|
+
digest: (input: {
|
|
10
|
+
digestAlgorithm: DigestAlgorithm;
|
|
11
|
+
bytes: Uint8Array;
|
|
12
|
+
}) => MaybePromise<Uint8Array>;
|
|
13
|
+
hdkf: (input: {
|
|
14
|
+
digestAlgorithm?: DigestAlgorithm;
|
|
15
|
+
privateKey: Uint8Array;
|
|
16
|
+
publicKey: Uint8Array;
|
|
17
|
+
salt: Uint8Array;
|
|
18
|
+
info: Uint8Array;
|
|
19
|
+
}) => MaybePromise<Uint8Array>;
|
|
20
|
+
};
|
|
21
|
+
cose: {
|
|
22
|
+
sign1: {
|
|
23
|
+
sign: Sign1Context['sign'];
|
|
24
|
+
verify: Sign1Context['verify'];
|
|
25
|
+
};
|
|
26
|
+
mac0: {
|
|
27
|
+
sign: Mac0Context['mac'];
|
|
28
|
+
verify(input: {
|
|
29
|
+
mac0: Mac0$1;
|
|
30
|
+
key: CoseKey$1 | Uint8Array;
|
|
31
|
+
}): MaybePromise<boolean>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
x509: {
|
|
35
|
+
getIssuerNameField: Sign1Context['x509']['getIssuerNameField'];
|
|
36
|
+
getPublicKey: Sign1Context['x509']['getPublicKey'];
|
|
37
|
+
verifyCertificateChain: (input: {
|
|
38
|
+
trustedCertificates: Uint8Array[];
|
|
39
|
+
x5chain: Uint8Array[];
|
|
40
|
+
now?: Date;
|
|
41
|
+
}) => MaybePromise<void>;
|
|
42
|
+
getCertificateData: (input: {
|
|
43
|
+
certificate: Uint8Array;
|
|
44
|
+
}) => MaybePromise<{
|
|
45
|
+
issuerName: string;
|
|
46
|
+
subjectName: string;
|
|
47
|
+
serialNumber: string;
|
|
48
|
+
thumbprint: string;
|
|
49
|
+
notBefore: Date;
|
|
50
|
+
notAfter: Date;
|
|
51
|
+
pem: string;
|
|
52
|
+
}>;
|
|
16
53
|
};
|
|
17
|
-
};
|
|
18
|
-
declare class CborStructure<EncodedStructure = unknown, DecodedStructure = EncodedStructure> {
|
|
19
|
-
protected structure: DecodedStructure;
|
|
20
|
-
constructor(structure: DecodedStructure);
|
|
21
|
-
get decodedStructure(): DecodedStructure;
|
|
22
|
-
/**
|
|
23
|
-
* Static getter for the Zod codec schema that defines the CBOR structure.
|
|
24
|
-
* Subclasses CAN override this to provide their specific schema for automatic encoding/decoding.
|
|
25
|
-
* The schema should be a Zod schema or codec that handles validation and transformation.
|
|
26
|
-
* If not provided, subclasses must override encode(), decode(), and fromEncodedStructure().
|
|
27
|
-
*/
|
|
28
|
-
static get encodingSchema(): z.ZodType | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the encoded structure that will be serialized to CBOR.
|
|
31
|
-
* By default, returns the protected structure property.
|
|
32
|
-
* Override if custom encoding logic is needed.
|
|
33
|
-
*/
|
|
34
|
-
get encodedStructure(): EncodedStructure;
|
|
35
|
-
/**
|
|
36
|
-
* Encodes this structure to CBOR bytes.
|
|
37
|
-
*/
|
|
38
|
-
encode(options?: CborEncodeOptions): Uint8Array;
|
|
39
|
-
/**
|
|
40
|
-
* Decodes CBOR bytes into a structure instance.
|
|
41
|
-
* Uses the encodingSchema's decode() method to validate and transform the decoded data.
|
|
42
|
-
*/
|
|
43
|
-
static decode<T extends AnyCborStructure>(this: CborStructureStaticThis<T>, bytes: Uint8Array): T;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a structure instance from the encoded CBOR structure (after calling cborDecode).
|
|
46
|
-
*
|
|
47
|
-
* Uses the encodingSchema's decode() method to validate and transform the structure if available.
|
|
48
|
-
* Otherwise, subclasses must override this method.
|
|
49
|
-
*/
|
|
50
|
-
static fromEncodedStructure<T extends AnyCborStructure>(this: CborStructureStaticThis<T>, encodedStructure: EncodedStructureType<T>): T;
|
|
51
|
-
static fromDataItem<T extends AnyCborStructure>(this: CborStructureStaticThis<T>, dataItem: unknown): T;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a structure instance from the decoded structure.
|
|
54
|
-
*
|
|
55
|
-
* Uses the encodingSchema's parse method to validate the structure if available.
|
|
56
|
-
* Otherwise, subclasses must override this method.
|
|
57
|
-
*/
|
|
58
|
-
static fromDecodedStructure<T extends AnyCborStructure>(this: CborStructureStaticThis<T>, decodedStructure: DecodedStructureType<T>): T;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/cbor/data-item.d.ts
|
|
62
|
-
type DataItemOptions<T = unknown> = {
|
|
63
|
-
data: T;
|
|
64
|
-
buffer: Uint8Array;
|
|
65
|
-
} | {
|
|
66
|
-
data: T;
|
|
67
|
-
} | {
|
|
68
|
-
buffer: Uint8Array;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* DataItem is an extension defined https://www.rfc-editor.org/rfc/rfc8949.html#name-encoded-cbor-data-item
|
|
72
|
-
* > Sometimes it is beneficial to carry an embedded CBOR data item that is
|
|
73
|
-
* > not meant to be decoded immediately at the time the enclosing data item is being decoded.
|
|
74
|
-
*
|
|
75
|
-
* The idea of this class is to provide lazy encode and decode of cbor data.
|
|
76
|
-
*
|
|
77
|
-
* Due to a bug in the cbor-x library, we are eagerly encoding the data in the constructor.
|
|
78
|
-
* https://github.com/kriszyp/cbor-x/issues/83
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
declare class DataItem<T = unknown> {
|
|
82
|
-
#private;
|
|
83
|
-
constructor(options: DataItemOptions<T>);
|
|
84
|
-
get data(): T;
|
|
85
|
-
get buffer(): Uint8Array;
|
|
86
|
-
static fromData<T>(data: T): DataItem<T>;
|
|
87
|
-
static fromBuffer<T>(buffer: Uint8Array): DataItem<T>;
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/cbor/models/date-only.d.ts
|
|
91
|
-
declare const customInspectSymbol: unique symbol;
|
|
92
|
-
declare class DateOnly {
|
|
93
|
-
private date;
|
|
94
|
-
constructor(date?: string);
|
|
95
|
-
get [Symbol.toStringTag](): string;
|
|
96
|
-
toString(): string;
|
|
97
|
-
toJSON(): string;
|
|
98
|
-
toISOString(): string;
|
|
99
|
-
[customInspectSymbol](): string;
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region src/cbor/parser.d.ts
|
|
103
|
-
type CborOptions = Options & {
|
|
104
|
-
unwrapTopLevelDataItem?: boolean;
|
|
105
|
-
};
|
|
106
|
-
declare const cborDecode: <T>(input: Uint8Array, options?: CborOptions) => T;
|
|
107
|
-
declare const cborEncode: (obj: unknown, options?: Options) => Uint8Array;
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/cose/error.d.ts
|
|
110
|
-
declare class CoseError extends Error {
|
|
111
|
-
constructor(message?: string);
|
|
112
|
-
}
|
|
113
|
-
declare class CoseUnsupportedMacError extends CoseError {}
|
|
114
|
-
declare class CoseInvalidSignatureError extends CoseError {}
|
|
115
|
-
declare class CoseInvalidAlgorithmError extends CoseError {}
|
|
116
|
-
declare class CosePayloadMustBeNullError extends CoseError {}
|
|
117
|
-
declare class CosePayloadMustBeDefinedError extends CoseError {}
|
|
118
|
-
declare class CosePayloadInvalidStructureError extends CoseError {}
|
|
119
|
-
declare class CoseInvalidTypeForKeyError extends CoseError {}
|
|
120
|
-
declare class CoseInvalidValueForKtyError extends CoseError {}
|
|
121
|
-
declare class CoseInvalidKtyForRawError extends CoseError {}
|
|
122
|
-
declare class CoseXNotDefinedError extends CoseError {}
|
|
123
|
-
declare class CoseYNotDefinedError extends CoseError {}
|
|
124
|
-
declare class CoseDNotDefinedError extends CoseError {}
|
|
125
|
-
declare class CoseKNotDefinedError extends CoseError {}
|
|
126
|
-
declare class CoseEphemeralMacKeyIsRequiredError extends CoseError {}
|
|
127
|
-
declare class CoseCertificateNotFoundError extends CoseError {}
|
|
128
|
-
declare class CoseKeyTypeNotSupportedForPrivateKeyExtractionError extends CoseError {}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/cose/headers/defaults.d.ts
|
|
131
|
-
declare enum Header {
|
|
132
|
-
Algorithm = 1,
|
|
133
|
-
Critical = 2,
|
|
134
|
-
ContentType = 3,
|
|
135
|
-
KeyId = 4,
|
|
136
|
-
Iv = 5,
|
|
137
|
-
PartialIv = 6,
|
|
138
|
-
CounterSignature = 7,
|
|
139
|
-
CounterSignature0 = 9,
|
|
140
|
-
CounterSignatureV2 = 11,
|
|
141
|
-
CounterSignature0V2 = 12,
|
|
142
|
-
X5Bag = 32,
|
|
143
|
-
X5Chain = 33,
|
|
144
|
-
X5T = 34,
|
|
145
|
-
X5U = 35
|
|
146
|
-
}
|
|
147
|
-
declare enum SignatureAlgorithm {
|
|
148
|
-
EdDSA = -8,
|
|
149
|
-
ES256 = -7,
|
|
150
|
-
ES384 = -35,
|
|
151
|
-
ES512 = -36,
|
|
152
|
-
PS256 = -37,
|
|
153
|
-
PS384 = -38,
|
|
154
|
-
PS512 = -39,
|
|
155
|
-
RS256 = -257,
|
|
156
|
-
RS384 = -258,
|
|
157
|
-
RS512 = -259
|
|
158
|
-
}
|
|
159
|
-
declare enum MacAlgorithm {
|
|
160
|
-
HS256 = 5,
|
|
161
|
-
HS384 = 6,
|
|
162
|
-
HS512 = 7
|
|
163
|
-
}
|
|
164
|
-
declare enum EncryptionAlgorithm {
|
|
165
|
-
A128GCM = 1,
|
|
166
|
-
A192GCM = 2,
|
|
167
|
-
A256GCM = 3,
|
|
168
|
-
Direct = -6
|
|
169
|
-
}
|
|
170
|
-
type DigestAlgorithm = 'SHA-256' | 'SHA-384' | 'SHA-512';
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/cose/headers/protected-headers.d.ts
|
|
173
|
-
declare const protectedHeadersEncodedStructure: z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
174
|
-
declare const protectedHeadersDecodedStructure: z$1.ZodMap<z$1.ZodNumber, z$1.ZodUnknown>;
|
|
175
|
-
type ProtectedHeadersDecodedStructure = z$1.infer<typeof protectedHeadersDecodedStructure>;
|
|
176
|
-
type ProtectedHeadersEncodedStructure = z$1.infer<typeof protectedHeadersEncodedStructure>;
|
|
177
|
-
type ProtectedHeaderOptions = {
|
|
178
|
-
protectedHeaders?: ProtectedHeadersDecodedStructure;
|
|
179
|
-
};
|
|
180
|
-
declare class ProtectedHeaders extends CborStructure<ProtectedHeadersEncodedStructure, ProtectedHeadersDecodedStructure> {
|
|
181
|
-
static get encodingSchema(): z$1.ZodCodec<z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z$1.ZodMap<z$1.ZodNumber, z$1.ZodUnknown>>;
|
|
182
|
-
get headers(): Map<number, unknown>;
|
|
183
|
-
static create(options: ProtectedHeaderOptions): ProtectedHeaders;
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/cose/headers/unprotected-headers.d.ts
|
|
187
|
-
declare const unprotectedHeadersStructure: z$1.ZodMap<z$1.ZodNumber, z$1.ZodUnknown>;
|
|
188
|
-
type UnprotectedHeadersStructure = z$1.infer<typeof unprotectedHeadersStructure>;
|
|
189
|
-
type UnprotectedHeaderOptions = {
|
|
190
|
-
unprotectedHeaders?: UnprotectedHeadersStructure;
|
|
191
|
-
};
|
|
192
|
-
declare class UnprotectedHeaders extends CborStructure<UnprotectedHeadersStructure> {
|
|
193
|
-
static get encodingSchema(): z$1.ZodMap<z$1.ZodNumber, z$1.ZodUnknown>;
|
|
194
|
-
get headers(): Map<number, unknown>;
|
|
195
|
-
static create(options: UnprotectedHeaderOptions): UnprotectedHeaders;
|
|
196
|
-
}
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region src/cose/key/curve.d.ts
|
|
199
|
-
declare enum Curve {
|
|
200
|
-
'P-256' = 1,
|
|
201
|
-
'P-384' = 2,
|
|
202
|
-
'P-521' = 3,
|
|
203
|
-
X25519 = 4,
|
|
204
|
-
X448 = 5,
|
|
205
|
-
Ed25519 = 6,
|
|
206
|
-
Ed448 = 7
|
|
207
54
|
}
|
|
208
55
|
//#endregion
|
|
209
56
|
//#region src/utils/transformers.d.ts
|
|
@@ -310,141 +157,6 @@ declare function typedMap<const Entries extends EntriesBase>(entries: Entries, {
|
|
|
310
157
|
decode?: (encoded: Map<unknown, unknown>, originalDecode: (decoded: Map<unknown, unknown>) => TypedMap<InferredSchema<Entries>, OptionalKeys<Entries>>) => TypedMap<InferredSchema<Entries>, OptionalKeys<Entries>>;
|
|
311
158
|
}): z.ZodCodec<z.ZodMap<z.ZodUnknown, z.ZodUnknown>, z.ZodCustom<TypedMap<InferredSchema<Entries>, OptionalKeys<Entries>>, TypedMap<InferredSchema<Entries>, OptionalKeys<Entries>>>>;
|
|
312
159
|
//#endregion
|
|
313
|
-
//#region src/cose/key/key-operation.d.ts
|
|
314
|
-
declare enum KeyOps {
|
|
315
|
-
Sign = 1,
|
|
316
|
-
Verify = 2,
|
|
317
|
-
Encrypt = 3,
|
|
318
|
-
Decrypt = 4,
|
|
319
|
-
WrapKey = 5,
|
|
320
|
-
UnwrapKey = 6,
|
|
321
|
-
DeriveKey = 7,
|
|
322
|
-
DeriveBits = 8,
|
|
323
|
-
MACCreate = 9,
|
|
324
|
-
MACVerify = 10
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/cose/key/key-type.d.ts
|
|
328
|
-
declare enum KeyType {
|
|
329
|
-
Okp = 1,
|
|
330
|
-
Ec = 2,
|
|
331
|
-
Oct = 4,
|
|
332
|
-
Reserved = 0
|
|
333
|
-
}
|
|
334
|
-
//#endregion
|
|
335
|
-
//#region src/cose/key/key.d.ts
|
|
336
|
-
declare enum CoseKeyParameter {
|
|
337
|
-
KeyType = 1,
|
|
338
|
-
KeyId = 2,
|
|
339
|
-
Algorithm = 3,
|
|
340
|
-
KeyOps = 4,
|
|
341
|
-
BaseIv = 5,
|
|
342
|
-
CurveOrK = -1,
|
|
343
|
-
X = -2,
|
|
344
|
-
Y = -3,
|
|
345
|
-
D = -4
|
|
346
|
-
}
|
|
347
|
-
declare const coseKeySchema: z.ZodCodec<z.ZodMap<z.ZodUnknown, z.ZodUnknown>, z.ZodCustom<TypedMap<{
|
|
348
|
-
1: string | KeyType;
|
|
349
|
-
2: string | Uint8Array<ArrayBufferLike>;
|
|
350
|
-
3: string | number;
|
|
351
|
-
4: (string | KeyOps)[];
|
|
352
|
-
5: Uint8Array<ArrayBufferLike>;
|
|
353
|
-
[-1]: Uint8Array<ArrayBufferLike> | Curve;
|
|
354
|
-
[-2]: Uint8Array<ArrayBufferLike>;
|
|
355
|
-
[-3]: Uint8Array<ArrayBufferLike>;
|
|
356
|
-
[-4]: Uint8Array<ArrayBufferLike>;
|
|
357
|
-
}, CoseKeyParameter.KeyId | CoseKeyParameter.Algorithm | CoseKeyParameter.KeyOps | CoseKeyParameter.BaseIv | CoseKeyParameter.CurveOrK | CoseKeyParameter.X | CoseKeyParameter.Y | CoseKeyParameter.D>, TypedMap<{
|
|
358
|
-
1: string | KeyType;
|
|
359
|
-
2: string | Uint8Array<ArrayBufferLike>;
|
|
360
|
-
3: string | number;
|
|
361
|
-
4: (string | KeyOps)[];
|
|
362
|
-
5: Uint8Array<ArrayBufferLike>;
|
|
363
|
-
[-1]: Uint8Array<ArrayBufferLike> | Curve;
|
|
364
|
-
[-2]: Uint8Array<ArrayBufferLike>;
|
|
365
|
-
[-3]: Uint8Array<ArrayBufferLike>;
|
|
366
|
-
[-4]: Uint8Array<ArrayBufferLike>;
|
|
367
|
-
}, CoseKeyParameter.KeyId | CoseKeyParameter.Algorithm | CoseKeyParameter.KeyOps | CoseKeyParameter.BaseIv | CoseKeyParameter.CurveOrK | CoseKeyParameter.X | CoseKeyParameter.Y | CoseKeyParameter.D>>>;
|
|
368
|
-
type CoseKeyDecodedStructure = z.output<typeof coseKeySchema>;
|
|
369
|
-
type CoseKeyEncodedStructure = z.input<typeof coseKeySchema>;
|
|
370
|
-
type CoseKeyOptions = {
|
|
371
|
-
keyType: KeyType | string;
|
|
372
|
-
keyId?: string;
|
|
373
|
-
algorithm?: string | number;
|
|
374
|
-
keyOps?: Array<KeyOps | string>;
|
|
375
|
-
baseIv?: Uint8Array;
|
|
376
|
-
curve?: Curve;
|
|
377
|
-
x?: Uint8Array;
|
|
378
|
-
y?: Uint8Array;
|
|
379
|
-
d?: Uint8Array;
|
|
380
|
-
k?: Uint8Array;
|
|
381
|
-
};
|
|
382
|
-
declare class CoseKey extends CborStructure<CoseKeyEncodedStructure, CoseKeyDecodedStructure> {
|
|
383
|
-
static get encodingSchema(): z.ZodCodec<z.ZodMap<z.ZodUnknown, z.ZodUnknown>, z.ZodCustom<TypedMap<{
|
|
384
|
-
1: string | KeyType;
|
|
385
|
-
2: string | Uint8Array<ArrayBufferLike>;
|
|
386
|
-
3: string | number;
|
|
387
|
-
4: (string | KeyOps)[];
|
|
388
|
-
5: Uint8Array<ArrayBufferLike>;
|
|
389
|
-
[-1]: Uint8Array<ArrayBufferLike> | Curve;
|
|
390
|
-
[-2]: Uint8Array<ArrayBufferLike>;
|
|
391
|
-
[-3]: Uint8Array<ArrayBufferLike>;
|
|
392
|
-
[-4]: Uint8Array<ArrayBufferLike>;
|
|
393
|
-
}, CoseKeyParameter.KeyId | CoseKeyParameter.Algorithm | CoseKeyParameter.KeyOps | CoseKeyParameter.BaseIv | CoseKeyParameter.CurveOrK | CoseKeyParameter.X | CoseKeyParameter.Y | CoseKeyParameter.D>, TypedMap<{
|
|
394
|
-
1: string | KeyType;
|
|
395
|
-
2: string | Uint8Array<ArrayBufferLike>;
|
|
396
|
-
3: string | number;
|
|
397
|
-
4: (string | KeyOps)[];
|
|
398
|
-
5: Uint8Array<ArrayBufferLike>;
|
|
399
|
-
[-1]: Uint8Array<ArrayBufferLike> | Curve;
|
|
400
|
-
[-2]: Uint8Array<ArrayBufferLike>;
|
|
401
|
-
[-3]: Uint8Array<ArrayBufferLike>;
|
|
402
|
-
[-4]: Uint8Array<ArrayBufferLike>;
|
|
403
|
-
}, CoseKeyParameter.KeyId | CoseKeyParameter.Algorithm | CoseKeyParameter.KeyOps | CoseKeyParameter.BaseIv | CoseKeyParameter.CurveOrK | CoseKeyParameter.X | CoseKeyParameter.Y | CoseKeyParameter.D>>>;
|
|
404
|
-
get keyType(): string | KeyType;
|
|
405
|
-
get keyId(): string | undefined;
|
|
406
|
-
get algorithm(): SignatureAlgorithm | undefined;
|
|
407
|
-
get keyOps(): (string | KeyOps)[] | undefined;
|
|
408
|
-
get baseIv(): Uint8Array<ArrayBufferLike> | undefined;
|
|
409
|
-
get curve(): Curve | undefined;
|
|
410
|
-
get x(): Uint8Array<ArrayBufferLike> | undefined;
|
|
411
|
-
get y(): Uint8Array<ArrayBufferLike> | undefined;
|
|
412
|
-
get d(): Uint8Array<ArrayBufferLike> | undefined;
|
|
413
|
-
get k(): Uint8Array<ArrayBufferLike> | undefined;
|
|
414
|
-
static create(options: CoseKeyOptions): CoseKey;
|
|
415
|
-
static fromJwk(jwk: Record<string, unknown>): CoseKey;
|
|
416
|
-
get publicKey(): Uint8Array<ArrayBufferLike>;
|
|
417
|
-
get privateKey(): Uint8Array<ArrayBufferLike>;
|
|
418
|
-
get jwk(): Record<string, unknown>;
|
|
419
|
-
}
|
|
420
|
-
//#endregion
|
|
421
|
-
//#region src/cose/key/jwk.d.ts
|
|
422
|
-
declare const jwkCoseOptionsMap: Record<string, keyof CoseKeyOptions>;
|
|
423
|
-
declare const coseOptionsJwkMap: {
|
|
424
|
-
[k: string]: string;
|
|
425
|
-
};
|
|
426
|
-
declare const jwkToCoseKey: {
|
|
427
|
-
kty: (kty?: unknown) => KeyType;
|
|
428
|
-
crv: (crv?: unknown) => Curve;
|
|
429
|
-
alg: (alg?: unknown) => MacAlgorithm | SignatureAlgorithm | EncryptionAlgorithm;
|
|
430
|
-
kid: (kid?: unknown) => unknown;
|
|
431
|
-
keyOps: (keyOps?: unknown) => KeyOps[] | undefined;
|
|
432
|
-
x: (s?: unknown) => Uint8Array<ArrayBuffer> | undefined;
|
|
433
|
-
y: (s?: unknown) => Uint8Array<ArrayBuffer> | undefined;
|
|
434
|
-
d: (s?: unknown) => Uint8Array<ArrayBuffer> | undefined;
|
|
435
|
-
};
|
|
436
|
-
declare const coseKeyToJwk: {
|
|
437
|
-
keyType: (keyType: KeyType) => any;
|
|
438
|
-
keyId: (keyId: unknown) => unknown;
|
|
439
|
-
algorithm: (algorithm?: SignatureAlgorithm | MacAlgorithm) => any;
|
|
440
|
-
keyOps: (keyOps?: unknown) => any[] | undefined;
|
|
441
|
-
baseIv: (baseIv?: unknown) => unknown;
|
|
442
|
-
curve: (curve?: Curve) => any;
|
|
443
|
-
x: (x?: Uint8Array) => string | undefined;
|
|
444
|
-
y: (y?: Uint8Array) => string | undefined;
|
|
445
|
-
d: (d?: Uint8Array) => string | undefined;
|
|
446
|
-
};
|
|
447
|
-
//#endregion
|
|
448
160
|
//#region src/mdoc/models/ble-options.d.ts
|
|
449
161
|
declare enum BleOptionsKeys {
|
|
450
162
|
PeripheralServerMode = 0,
|
|
@@ -497,6 +209,23 @@ declare class BleOptions extends CborStructure<BleOptionsEncodedStructure, BleOp
|
|
|
497
209
|
static create(options: BleOptionsOptions): BleOptions;
|
|
498
210
|
}
|
|
499
211
|
//#endregion
|
|
212
|
+
//#region src/mdoc/models/data-element-identifier.d.ts
|
|
213
|
+
type DataElementIdentifier = string;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/mdoc/models/data-element-value.d.ts
|
|
216
|
+
type DataElementValue = unknown;
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/mdoc/check-callback.d.ts
|
|
219
|
+
interface VerificationAssessment {
|
|
220
|
+
status: 'PASSED' | 'FAILED' | 'WARNING';
|
|
221
|
+
category: 'DOCUMENT_FORMAT' | 'DEVICE_AUTH' | 'ISSUER_AUTH' | 'DATA_INTEGRITY' | 'READER_AUTH';
|
|
222
|
+
check: string;
|
|
223
|
+
reason?: string;
|
|
224
|
+
}
|
|
225
|
+
type VerificationCallback = (item: VerificationAssessment) => void;
|
|
226
|
+
declare const defaultVerificationCallback: VerificationCallback;
|
|
227
|
+
declare const onCategoryCheck: (onCheck: VerificationCallback, category: VerificationAssessment["category"]) => (item: Omit<VerificationAssessment, "category">) => void;
|
|
228
|
+
//#endregion
|
|
500
229
|
//#region src/mdoc/models/nfc-options.d.ts
|
|
501
230
|
declare const nfcOptionsSchema: z.ZodCodec<z.ZodMap<z.ZodUnknown, z.ZodUnknown>, z.ZodCustom<TypedMap<{
|
|
502
231
|
0: number;
|
|
@@ -600,7 +329,7 @@ declare class DeviceRetrievalMethod extends CborStructure<DeviceRetrievalMethodE
|
|
|
600
329
|
}, z.core.$strip>>;
|
|
601
330
|
get type(): number;
|
|
602
331
|
get version(): number;
|
|
603
|
-
get retrievalOptions(): Map<unknown, unknown> |
|
|
332
|
+
get retrievalOptions(): Map<unknown, unknown> | BleOptions | NfcOptions | WifiOptions;
|
|
604
333
|
static create(options: DeviceRetrievalMethodOptions): DeviceRetrievalMethod;
|
|
605
334
|
}
|
|
606
335
|
//#endregion
|
|
@@ -615,7 +344,7 @@ declare class ProtocolInfo extends CborStructure<ProtocolInfoStructure> {
|
|
|
615
344
|
type EDeviceKeyDecodedStructure = CoseKeyDecodedStructure;
|
|
616
345
|
type EDeviceKeyEncodedStructure = CoseKeyEncodedStructure;
|
|
617
346
|
type EDeviceKeyOptions = CoseKeyOptions;
|
|
618
|
-
declare class EDeviceKey extends CoseKey {}
|
|
347
|
+
declare class EDeviceKey extends CoseKey$1 {}
|
|
619
348
|
//#endregion
|
|
620
349
|
//#region src/mdoc/models/security.d.ts
|
|
621
350
|
declare const securityEncodedSchema: z.ZodTuple<[z.ZodNumber, z.ZodCustom<DataItem<unknown>, DataItem<unknown>>], null>;
|
|
@@ -766,7 +495,7 @@ declare class DeviceEngagement extends CborStructure<DeviceEngagementEncodedStru
|
|
|
766
495
|
type EReaderKeyDecodedStructure = CoseKeyDecodedStructure;
|
|
767
496
|
type EReaderKeyEncodedStructure = CoseKeyEncodedStructure;
|
|
768
497
|
type EReaderKeyOptions = CoseKeyOptions;
|
|
769
|
-
declare class EReaderKey extends CoseKey {}
|
|
498
|
+
declare class EReaderKey extends CoseKey$1 {}
|
|
770
499
|
//#endregion
|
|
771
500
|
//#region src/mdoc/models/handover.d.ts
|
|
772
501
|
declare abstract class Handover<EncodedStructure = unknown, DecodedStructure = EncodedStructure> extends CborStructure<EncodedStructure, DecodedStructure> {
|
|
@@ -868,222 +597,37 @@ declare class SessionTranscript extends CborStructure<SessionTranscriptEncodedSt
|
|
|
868
597
|
}, ctx: Pick<MdocContext, 'crypto'>): Promise<SessionTranscript>;
|
|
869
598
|
}
|
|
870
599
|
//#endregion
|
|
871
|
-
//#region src/cose/mac0.d.ts
|
|
872
|
-
declare const mac0EncodedSchema: z.ZodTuple<[z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodMap<z.ZodUnknown, z.ZodUnknown>, z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>], null>;
|
|
873
|
-
declare const mac0DecodedSchema: z.ZodObject<{
|
|
874
|
-
protectedHeaders: z.ZodCustom<ProtectedHeaders, ProtectedHeaders>;
|
|
875
|
-
unprotectedHeaders: z.ZodCustom<UnprotectedHeaders, UnprotectedHeaders>;
|
|
876
|
-
payload: z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
877
|
-
tag: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
878
|
-
}, z.core.$strip>;
|
|
879
|
-
type Mac0EncodedStructure = z.infer<typeof mac0EncodedSchema>;
|
|
880
|
-
type Mac0DecodedStructure = z.infer<typeof mac0DecodedSchema>;
|
|
881
|
-
type Mac0Options = {
|
|
882
|
-
protectedHeaders: ProtectedHeaders | ProtectedHeaderOptions['protectedHeaders'];
|
|
883
|
-
unprotectedHeaders: UnprotectedHeaders | UnprotectedHeaderOptions['unprotectedHeaders'];
|
|
884
|
-
externalAad?: Uint8Array;
|
|
885
|
-
payload?: Uint8Array | null;
|
|
886
|
-
detachedPayload?: Uint8Array;
|
|
887
|
-
privateKey: CoseKey;
|
|
888
|
-
ephemeralKey: CoseKey;
|
|
889
|
-
sessionTranscript: SessionTranscript | Uint8Array;
|
|
890
|
-
};
|
|
891
|
-
declare class Mac0 extends CborStructure<Mac0EncodedStructure, Mac0DecodedStructure> {
|
|
892
|
-
static tag: number;
|
|
893
|
-
static get encodingSchema(): z.ZodCodec<z.ZodTuple<[z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z.ZodMap<z.ZodUnknown, z.ZodUnknown>, z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>], null>, z.ZodObject<{
|
|
894
|
-
protectedHeaders: z.ZodCustom<ProtectedHeaders, ProtectedHeaders>;
|
|
895
|
-
unprotectedHeaders: z.ZodCustom<UnprotectedHeaders, UnprotectedHeaders>;
|
|
896
|
-
payload: z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
897
|
-
tag: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
898
|
-
}, z.core.$strip>>;
|
|
899
|
-
externalAad?: Uint8Array;
|
|
900
|
-
detachedPayload?: Uint8Array;
|
|
901
|
-
get protectedHeaders(): ProtectedHeaders;
|
|
902
|
-
get unprotectedHeaders(): UnprotectedHeaders;
|
|
903
|
-
get payload(): Uint8Array<ArrayBufferLike> | null;
|
|
904
|
-
get tag(): Uint8Array<ArrayBufferLike>;
|
|
905
|
-
get toBeAuthenticated(): Uint8Array<ArrayBufferLike>;
|
|
906
|
-
/**
|
|
907
|
-
* Decodes CBOR bytes into a Sign1 instance.
|
|
908
|
-
* Uses the encodingSchema's decode() method to validate and transform the decoded data.
|
|
909
|
-
*/
|
|
910
|
-
static decode<T extends AnyCborStructure>(this: CborStructureStaticThis<T>, bytes: Uint8Array): T;
|
|
911
|
-
static toBeAuthenticated(options: {
|
|
912
|
-
payload: Uint8Array;
|
|
913
|
-
protectedHeaders: ProtectedHeaders;
|
|
914
|
-
externalAad?: Uint8Array;
|
|
915
|
-
}): Uint8Array<ArrayBufferLike>;
|
|
916
|
-
get signatureAlgorithmName(): MacAlgorithm;
|
|
917
|
-
static create(options: Mac0Options, ctx: Pick<MdocContext, 'crypto' | 'cose'>): Promise<Mac0>;
|
|
918
|
-
}
|
|
919
|
-
//#endregion
|
|
920
|
-
//#region src/cose/sign1.d.ts
|
|
921
|
-
declare const sign1EncodedSchema: z$1.ZodTuple<[z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z$1.ZodMap<z$1.ZodNumber, z$1.ZodUnknown>, z$1.ZodNullable<z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>], null>;
|
|
922
|
-
declare const sign1DecodedSchema: z$1.ZodObject<{
|
|
923
|
-
protected: z$1.ZodCustom<ProtectedHeaders, ProtectedHeaders>;
|
|
924
|
-
unprotected: z$1.ZodCustom<UnprotectedHeaders, UnprotectedHeaders>;
|
|
925
|
-
payload: z$1.ZodNullable<z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
926
|
-
signature: z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
927
|
-
}, z$1.core.$strip>;
|
|
928
|
-
type Sign1EncodedStructure = z$1.infer<typeof sign1EncodedSchema>;
|
|
929
|
-
type Sign1DecodedStructure = z$1.infer<typeof sign1DecodedSchema>;
|
|
930
|
-
type Sign1Options = {
|
|
931
|
-
protectedHeaders?: ProtectedHeaders | ProtectedHeaderOptions['protectedHeaders'];
|
|
932
|
-
unprotectedHeaders?: UnprotectedHeaders | UnprotectedHeaderOptions['unprotectedHeaders'];
|
|
933
|
-
signingKey: CoseKey;
|
|
934
|
-
algorithm?: SignatureAlgorithm;
|
|
935
|
-
payload?: Uint8Array | null;
|
|
936
|
-
detachedPayload?: Uint8Array;
|
|
937
|
-
externalAad?: Uint8Array;
|
|
938
|
-
};
|
|
939
|
-
declare class Sign1 extends CborStructure<Sign1EncodedStructure, Sign1DecodedStructure> {
|
|
940
|
-
static tag: number;
|
|
941
|
-
static get encodingSchema(): z$1.ZodCodec<z$1.ZodTuple<[z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, z$1.ZodMap<z$1.ZodNumber, z$1.ZodUnknown>, z$1.ZodNullable<z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>], null>, z$1.ZodObject<{
|
|
942
|
-
protected: z$1.ZodCustom<ProtectedHeaders, ProtectedHeaders>;
|
|
943
|
-
unprotected: z$1.ZodCustom<UnprotectedHeaders, UnprotectedHeaders>;
|
|
944
|
-
payload: z$1.ZodNullable<z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
945
|
-
signature: z$1.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
946
|
-
}, z$1.core.$strip>>;
|
|
947
|
-
detachedPayload?: Uint8Array;
|
|
948
|
-
externalAad?: Uint8Array;
|
|
949
|
-
get protectedHeaders(): ProtectedHeaders;
|
|
950
|
-
get unprotectedHeaders(): UnprotectedHeaders;
|
|
951
|
-
get payload(): Uint8Array<ArrayBufferLike> | null;
|
|
952
|
-
get signature(): Uint8Array<ArrayBufferLike>;
|
|
953
|
-
get certificateChain(): Uint8Array<ArrayBufferLike>[];
|
|
954
|
-
get certificate(): Uint8Array<ArrayBufferLike>;
|
|
955
|
-
getIssuingCountry(ctx: Pick<MdocContext, 'x509'>): string;
|
|
956
|
-
getIssuingStateOrProvince(ctx: Pick<MdocContext, 'x509'>): string;
|
|
957
|
-
get toBeSigned(): Uint8Array<ArrayBufferLike>;
|
|
958
|
-
/**
|
|
959
|
-
* Decodes CBOR bytes into a Sign1 instance.
|
|
960
|
-
* Uses the encodingSchema's decode() method to validate and transform the decoded data.
|
|
961
|
-
*/
|
|
962
|
-
static decode<T extends AnyCborStructure>(this: CborStructureStaticThis<T>, bytes: Uint8Array): T;
|
|
963
|
-
static toBeSigned(options: {
|
|
964
|
-
payload: Uint8Array;
|
|
965
|
-
protectedHeaders: ProtectedHeaders;
|
|
966
|
-
externalAad?: Uint8Array;
|
|
967
|
-
}): Uint8Array<ArrayBufferLike>;
|
|
968
|
-
get signatureAlgorithmName(): string;
|
|
969
|
-
get x5chain(): Uint8Array<ArrayBufferLike>[] | undefined;
|
|
970
|
-
verifySignature(options: {
|
|
971
|
-
key?: CoseKey;
|
|
972
|
-
}, ctx: Pick<MdocContext, 'cose' | 'x509'>): Promise<boolean>;
|
|
973
|
-
static create(options: Sign1Options, ctx: Pick<MdocContext, 'cose'>): Promise<Sign1>;
|
|
974
|
-
}
|
|
975
|
-
//#endregion
|
|
976
|
-
//#region src/context.d.ts
|
|
977
|
-
type MaybePromise<T> = Promise<T> | T;
|
|
978
|
-
interface MdocContext {
|
|
979
|
-
crypto: {
|
|
980
|
-
random: (length: number) => Uint8Array;
|
|
981
|
-
digest: (input: {
|
|
982
|
-
digestAlgorithm: DigestAlgorithm;
|
|
983
|
-
bytes: Uint8Array;
|
|
984
|
-
}) => MaybePromise<Uint8Array>;
|
|
985
|
-
calculateEphemeralMacKey: (input: {
|
|
986
|
-
privateKey: Uint8Array;
|
|
987
|
-
publicKey: Uint8Array;
|
|
988
|
-
sessionTranscriptBytes: Uint8Array;
|
|
989
|
-
info: 'EMacKey' | 'SKReader' | 'SKDevice';
|
|
990
|
-
}) => MaybePromise<CoseKey>;
|
|
991
|
-
};
|
|
992
|
-
cose: {
|
|
993
|
-
sign1: {
|
|
994
|
-
sign: (input: {
|
|
995
|
-
toBeSigned: Uint8Array;
|
|
996
|
-
key: CoseKey;
|
|
997
|
-
algorithm?: SignatureAlgorithm;
|
|
998
|
-
}) => MaybePromise<Uint8Array>;
|
|
999
|
-
verify(input: {
|
|
1000
|
-
key: CoseKey;
|
|
1001
|
-
sign1: Sign1;
|
|
1002
|
-
}): MaybePromise<boolean>;
|
|
1003
|
-
};
|
|
1004
|
-
mac0: {
|
|
1005
|
-
sign: (input: {
|
|
1006
|
-
key: CoseKey;
|
|
1007
|
-
toBeAuthenticated: Uint8Array;
|
|
1008
|
-
}) => MaybePromise<Uint8Array>;
|
|
1009
|
-
verify(input: {
|
|
1010
|
-
mac0: Mac0;
|
|
1011
|
-
key: CoseKey;
|
|
1012
|
-
}): MaybePromise<boolean>;
|
|
1013
|
-
};
|
|
1014
|
-
};
|
|
1015
|
-
x509: {
|
|
1016
|
-
getIssuerNameField: (input: {
|
|
1017
|
-
certificate: Uint8Array;
|
|
1018
|
-
field: string;
|
|
1019
|
-
}) => string[];
|
|
1020
|
-
getPublicKey: (input: {
|
|
1021
|
-
certificate: Uint8Array;
|
|
1022
|
-
alg: string;
|
|
1023
|
-
}) => MaybePromise<CoseKey>;
|
|
1024
|
-
verifyCertificateChain: (input: {
|
|
1025
|
-
trustedCertificates: Uint8Array[];
|
|
1026
|
-
x5chain: Uint8Array[];
|
|
1027
|
-
now?: Date;
|
|
1028
|
-
}) => MaybePromise<void>;
|
|
1029
|
-
getCertificateData: (input: {
|
|
1030
|
-
certificate: Uint8Array;
|
|
1031
|
-
}) => MaybePromise<{
|
|
1032
|
-
issuerName: string;
|
|
1033
|
-
subjectName: string;
|
|
1034
|
-
serialNumber: string;
|
|
1035
|
-
thumbprint: string;
|
|
1036
|
-
notBefore: Date;
|
|
1037
|
-
notAfter: Date;
|
|
1038
|
-
pem: string;
|
|
1039
|
-
}>;
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
//#endregion
|
|
1043
|
-
//#region src/mdoc/models/data-element-identifier.d.ts
|
|
1044
|
-
type DataElementIdentifier = string;
|
|
1045
|
-
//#endregion
|
|
1046
|
-
//#region src/mdoc/models/data-element-value.d.ts
|
|
1047
|
-
type DataElementValue = unknown;
|
|
1048
|
-
//#endregion
|
|
1049
|
-
//#region src/mdoc/check-callback.d.ts
|
|
1050
|
-
interface VerificationAssessment {
|
|
1051
|
-
status: 'PASSED' | 'FAILED' | 'WARNING';
|
|
1052
|
-
category: 'DOCUMENT_FORMAT' | 'DEVICE_AUTH' | 'ISSUER_AUTH' | 'DATA_INTEGRITY' | 'READER_AUTH';
|
|
1053
|
-
check: string;
|
|
1054
|
-
reason?: string;
|
|
1055
|
-
}
|
|
1056
|
-
type VerificationCallback = (item: VerificationAssessment) => void;
|
|
1057
|
-
declare const defaultVerificationCallback: VerificationCallback;
|
|
1058
|
-
declare const onCategoryCheck: (onCheck: VerificationCallback, category: VerificationAssessment["category"]) => (item: Omit<VerificationAssessment, "category">) => void;
|
|
1059
|
-
//#endregion
|
|
1060
600
|
//#region src/mdoc/models/device-mac.d.ts
|
|
1061
601
|
type DeviceMacEncodedStructure = Mac0EncodedStructure;
|
|
1062
602
|
type DeviceMacDecodedStructure = Mac0DecodedStructure;
|
|
1063
603
|
type DeviceMacOptions = Mac0Options;
|
|
1064
|
-
declare class DeviceMac extends Mac0 {
|
|
604
|
+
declare class DeviceMac extends Mac0$1 {
|
|
1065
605
|
verify(options: {
|
|
1066
|
-
publicKey: CoseKey;
|
|
1067
|
-
privateKey: CoseKey;
|
|
606
|
+
publicKey: CoseKey$1;
|
|
607
|
+
privateKey: CoseKey$1;
|
|
1068
608
|
info?: 'EMacKey' | 'SKReader' | 'SKDevice';
|
|
1069
609
|
sessionTranscript: SessionTranscript | Uint8Array;
|
|
1070
610
|
}, ctx: Pick<MdocContext, 'crypto' | 'cose'>): Promise<boolean>;
|
|
1071
|
-
static create(options: DeviceMacOptions
|
|
611
|
+
static create(options: DeviceMacOptions): DeviceMac;
|
|
612
|
+
createDeviceMacKey(options: {
|
|
613
|
+
publicKey: CoseKey$1;
|
|
614
|
+
privateKey: CoseKey$1;
|
|
615
|
+
sessionTranscript: SessionTranscript | Uint8Array;
|
|
616
|
+
info?: 'EMacKey' | 'SKReader' | 'SKDevice';
|
|
617
|
+
}, ctx: Pick<MdocContext, 'crypto' | 'cose'>): Promise<Uint8Array<ArrayBufferLike>>;
|
|
1072
618
|
}
|
|
1073
619
|
//#endregion
|
|
1074
620
|
//#region src/mdoc/models/device-signature.d.ts
|
|
1075
621
|
type DeviceSignatureEncodedStructure = Sign1EncodedStructure;
|
|
1076
622
|
type DeviceSignatureDecodedStructure = Sign1DecodedStructure;
|
|
1077
623
|
type DeviceSignatureOptions = Sign1Options;
|
|
1078
|
-
declare class DeviceSignature extends Sign1 {
|
|
1079
|
-
static create(options: DeviceSignatureOptions, ctx: Pick<MdocContext, 'cose'>): Promise<DeviceSignature>;
|
|
1080
|
-
}
|
|
624
|
+
declare class DeviceSignature extends Sign1$1 {}
|
|
1081
625
|
//#endregion
|
|
1082
626
|
//#region src/mdoc/models/device-key.d.ts
|
|
1083
627
|
type DeviceKeyDecodedStructure = CoseKeyDecodedStructure;
|
|
1084
628
|
type DeviceKeyEncodedStructure = CoseKeyEncodedStructure;
|
|
1085
629
|
type DeviceKeyOptions = CoseKeyOptions;
|
|
1086
|
-
declare class DeviceKey extends CoseKey {}
|
|
630
|
+
declare class DeviceKey extends CoseKey$1 {}
|
|
1087
631
|
//#endregion
|
|
1088
632
|
//#region src/mdoc/models/namespace.d.ts
|
|
1089
633
|
type Namespace = string;
|
|
@@ -1281,8 +825,8 @@ type IssuerAuthEncodedStructure = Sign1EncodedStructure;
|
|
|
1281
825
|
type IssuerAuthOptions = Omit<Sign1Options, 'payload'> & {
|
|
1282
826
|
payload?: Sign1Options['payload'] | MobileSecurityObject;
|
|
1283
827
|
};
|
|
1284
|
-
declare class IssuerAuth extends Sign1 {
|
|
1285
|
-
static create(options: IssuerAuthOptions
|
|
828
|
+
declare class IssuerAuth extends Sign1$1 {
|
|
829
|
+
static create(options: IssuerAuthOptions): IssuerAuth;
|
|
1286
830
|
get mobileSecurityObject(): MobileSecurityObject;
|
|
1287
831
|
verify(options: {
|
|
1288
832
|
verificationCallback?: VerificationCallback;
|
|
@@ -1522,7 +1066,7 @@ declare class DeviceAuth extends CborStructure<DeviceAuthEncodedStructure, Devic
|
|
|
1522
1066
|
verify(options: {
|
|
1523
1067
|
document: Document;
|
|
1524
1068
|
verificationCallback?: VerificationCallback;
|
|
1525
|
-
ephemeralMacPrivateKey?: CoseKey;
|
|
1069
|
+
ephemeralMacPrivateKey?: CoseKey$1;
|
|
1526
1070
|
sessionTranscript: SessionTranscript | Uint8Array;
|
|
1527
1071
|
}, ctx: Pick<MdocContext, 'crypto' | 'cose'>): Promise<void>;
|
|
1528
1072
|
static create(options: DeviceAuthOptions): DeviceAuth;
|
|
@@ -1612,12 +1156,12 @@ declare class ReaderAuthentication extends CborStructure<ReaderAuthenticationEnc
|
|
|
1612
1156
|
type ReaderAuthEncodedStructure = Sign1EncodedStructure;
|
|
1613
1157
|
type ReaderAuthDecodedStructure = Sign1DecodedStructure;
|
|
1614
1158
|
type ReaderAuthOptions = Sign1Options;
|
|
1615
|
-
declare class ReaderAuth extends Sign1 {
|
|
1159
|
+
declare class ReaderAuth extends Sign1$1 {
|
|
1616
1160
|
verify(options: {
|
|
1617
1161
|
readerAuthentication: ReaderAuthentication | ReaderAuthenticationOptions;
|
|
1618
1162
|
verificationCallback?: VerificationCallback;
|
|
1619
1163
|
}, ctx: Pick<MdocContext, 'cose' | 'x509'>): Promise<void>;
|
|
1620
|
-
static create(options: ReaderAuthOptions
|
|
1164
|
+
static create(options: ReaderAuthOptions): ReaderAuth;
|
|
1621
1165
|
}
|
|
1622
1166
|
//#endregion
|
|
1623
1167
|
//#region src/mdoc/models/doc-request.d.ts
|
|
@@ -1739,7 +1283,7 @@ declare class DeviceResponse extends CborStructure<DeviceResponseEncodedStructur
|
|
|
1739
1283
|
verify(options: {
|
|
1740
1284
|
deviceRequest?: DeviceRequest;
|
|
1741
1285
|
sessionTranscript: SessionTranscript | Uint8Array;
|
|
1742
|
-
ephemeralReaderKey?: CoseKey;
|
|
1286
|
+
ephemeralReaderKey?: CoseKey$1;
|
|
1743
1287
|
disableCertificateChainValidation?: boolean;
|
|
1744
1288
|
trustedCertificates: Uint8Array[];
|
|
1745
1289
|
now?: Date;
|
|
@@ -1755,11 +1299,11 @@ declare class DeviceResponse extends CborStructure<DeviceResponseEncodedStructur
|
|
|
1755
1299
|
issuerSigned: Array<IssuerSigned>;
|
|
1756
1300
|
deviceNamespaces?: DeviceNamespaces;
|
|
1757
1301
|
mac?: {
|
|
1758
|
-
ephemeralKey: CoseKey;
|
|
1759
|
-
signingKey: CoseKey;
|
|
1302
|
+
ephemeralKey: CoseKey$1;
|
|
1303
|
+
signingKey: CoseKey$1;
|
|
1760
1304
|
};
|
|
1761
1305
|
signature?: {
|
|
1762
|
-
signingKey: CoseKey;
|
|
1306
|
+
signingKey: CoseKey$1;
|
|
1763
1307
|
};
|
|
1764
1308
|
}, ctx: Pick<MdocContext, 'crypto' | 'cose'>): Promise<DeviceResponse>;
|
|
1765
1309
|
static createSimple(options: DeviceResponseOptions): DeviceResponse;
|
|
@@ -1822,14 +1366,14 @@ declare class DeviceSignedBuilder {
|
|
|
1822
1366
|
constructor(docType: DocType, ctx: Pick<MdocContext, 'cose' | 'crypto'>);
|
|
1823
1367
|
addDeviceNamespace(namespace: Namespace, value: Record<string, unknown>): this;
|
|
1824
1368
|
sign(options: {
|
|
1825
|
-
signingKey: CoseKey;
|
|
1826
|
-
algorithm: SignatureAlgorithm;
|
|
1369
|
+
signingKey: CoseKey$1;
|
|
1370
|
+
algorithm: SignatureAlgorithm$1;
|
|
1827
1371
|
sessionTranscript: SessionTranscript;
|
|
1828
1372
|
derCertificate: string;
|
|
1829
1373
|
}): Promise<DeviceSigned>;
|
|
1830
1374
|
tag(options: {
|
|
1831
|
-
publicKey: CoseKey;
|
|
1832
|
-
privateKey: CoseKey;
|
|
1375
|
+
publicKey: CoseKey$1;
|
|
1376
|
+
privateKey: CoseKey$1;
|
|
1833
1377
|
sessionTranscript: SessionTranscript;
|
|
1834
1378
|
algorithm: MacAlgorithm;
|
|
1835
1379
|
derCertificate: string;
|
|
@@ -1845,8 +1389,8 @@ declare class IssuerSignedBuilder {
|
|
|
1845
1389
|
addIssuerNamespace(namespace: Namespace, values: Record<string, unknown> | Map<string, unknown>): this;
|
|
1846
1390
|
private convertIssuerNamespacesIntoValueDigests;
|
|
1847
1391
|
sign(options: {
|
|
1848
|
-
signingKey: CoseKey;
|
|
1849
|
-
algorithm: SignatureAlgorithm;
|
|
1392
|
+
signingKey: CoseKey$1;
|
|
1393
|
+
algorithm: SignatureAlgorithm$1;
|
|
1850
1394
|
digestAlgorithm: DigestAlgorithm;
|
|
1851
1395
|
validityInfo: ValidityInfo | ValidityInfoOptions;
|
|
1852
1396
|
deviceKeyInfo: DeviceKeyInfo | DeviceKeyInfoOptions;
|
|
@@ -1893,11 +1437,11 @@ declare class Holder {
|
|
|
1893
1437
|
issuerSigned: Array<IssuerSigned>;
|
|
1894
1438
|
deviceNamespaces?: DeviceNamespaces;
|
|
1895
1439
|
mac?: {
|
|
1896
|
-
ephemeralKey: CoseKey;
|
|
1897
|
-
signingKey: CoseKey;
|
|
1440
|
+
ephemeralKey: CoseKey$1;
|
|
1441
|
+
signingKey: CoseKey$1;
|
|
1898
1442
|
};
|
|
1899
1443
|
signature?: {
|
|
1900
|
-
signingKey: CoseKey;
|
|
1444
|
+
signingKey: CoseKey$1;
|
|
1901
1445
|
};
|
|
1902
1446
|
}, context: Pick<MdocContext, 'cose' | 'crypto'>): Promise<DeviceResponse>;
|
|
1903
1447
|
}
|
|
@@ -1908,8 +1452,8 @@ declare class Issuer {
|
|
|
1908
1452
|
constructor(docType: DocType, ctx: Pick<MdocContext, 'cose' | 'crypto'>);
|
|
1909
1453
|
addIssuerNamespace(namespace: Namespace, value: Record<string | number, unknown>): this;
|
|
1910
1454
|
sign(options: {
|
|
1911
|
-
signingKey: CoseKey | Record<string | number, unknown>;
|
|
1912
|
-
algorithm: SignatureAlgorithm;
|
|
1455
|
+
signingKey: CoseKey$1 | Record<string | number, unknown>;
|
|
1456
|
+
algorithm: SignatureAlgorithm$1;
|
|
1913
1457
|
digestAlgorithm: DigestAlgorithm;
|
|
1914
1458
|
validityInfo: ValidityInfo | ValidityInfoOptions;
|
|
1915
1459
|
deviceKeyInfo: DeviceKeyInfo | DeviceKeyInfoOptions;
|
|
@@ -1926,7 +1470,7 @@ declare class Verifier {
|
|
|
1926
1470
|
deviceRequest?: DeviceRequest;
|
|
1927
1471
|
deviceResponse: Uint8Array | DeviceResponse;
|
|
1928
1472
|
sessionTranscript: SessionTranscript | Uint8Array;
|
|
1929
|
-
ephemeralReaderKey?: CoseKey;
|
|
1473
|
+
ephemeralReaderKey?: CoseKey$1;
|
|
1930
1474
|
disableCertificateChainValidation?: boolean;
|
|
1931
1475
|
trustedCertificates: Uint8Array[];
|
|
1932
1476
|
now?: Date;
|
|
@@ -1935,5 +1479,5 @@ declare class Verifier {
|
|
|
1935
1479
|
}, ctx: Pick<MdocContext, 'cose' | 'x509' | 'crypto'>): Promise<void>;
|
|
1936
1480
|
}
|
|
1937
1481
|
//#endregion
|
|
1938
|
-
export { AtLeastOneCertificateRequiredError, BleOptions, BleOptionsDecodedStructure, BleOptionsEncodedStructure, BleOptionsOptions,
|
|
1482
|
+
export { AtLeastOneCertificateRequiredError, BleOptions, BleOptionsDecodedStructure, BleOptionsEncodedStructure, BleOptionsOptions, CoseKey, Curve, DataElementIdentifier, DataElementValue, DateOnly, DeviceAuth, DeviceAuthDecodedStructure, DeviceAuthEncodedStructure, DeviceAuthOptions, DeviceAuthentication, DeviceAuthenticationDecodedStructure, DeviceAuthenticationEncodedStructure, DeviceAuthenticationOptions, DeviceEngagement, DeviceEngagementDecodedStructure, DeviceEngagementEncodedStructure, DeviceEngagementOptions, DeviceKey, DeviceKeyDecodedStructure, DeviceKeyEncodedStructure, DeviceKeyInfo, DeviceKeyInfoDecodedStructure, DeviceKeyInfoEncodedStructure, DeviceKeyInfoOptions, DeviceKeyOptions, DeviceMac, DeviceMacDecodedStructure, DeviceMacEncodedStructure, DeviceMacOptions, DeviceNamespaces, DeviceNamespacesDecodedStructure, DeviceNamespacesEncodedStructure, DeviceNamespacesOptions, DeviceRequest, DeviceRequestDecodedStructure, DeviceRequestEncodedStructure, DeviceRequestOptions, DeviceResponse, DeviceResponseDecodedStructure, DeviceResponseEncodedStructure, DeviceResponseOptions, DeviceRetrievalMethod, DeviceRetrievalMethodDecodedStructure, DeviceRetrievalMethodEncodedStructure, DeviceRetrievalMethodOptions, DeviceRetrievalMethodType, DeviceSignature, DeviceSignatureDecodedStructure, DeviceSignatureEncodedStructure, DeviceSignatureOptions, DeviceSigned, DeviceSignedBuilder, DeviceSignedDecodedStructure, DeviceSignedEncodedStructure, DeviceSignedItems, DeviceSignedItemsOptions, DeviceSignedItemsStructure, DeviceSignedOptions, Digest, DigestId, DocRequest, DocRequestDecodedStructure, DocRequestEncodedStructure, DocRequestOptions, DocType, Document, DocumentDecodedStructure, DocumentEncodedStructure, DocumentError, DocumentErrorOptions, DocumentErrorStructure, DocumentOptions, DuplicateDocumentInDeviceResponseError, DuplicateNamespaceInIssuerNamespacesError, EDeviceKey, EDeviceKeyDecodedStructure, EDeviceKeyEncodedStructure, EDeviceKeyOptions, EReaderKey, EReaderKeyDecodedStructure, EReaderKeyEncodedStructure, EReaderKeyOptions, EitherSignatureOrMacMustBeProvidedError, ErrorCode, ErrorItems, ErrorItemsOptions, ErrorItemsStructure, Errors, ErrorsDecodedStructure, ErrorsEncodedStructure, ErrorsOptions, Holder, IntentToRetain, Issuer, IssuerAuth, IssuerAuthEncodedStructure, IssuerAuthOptions, IssuerNamespaces, IssuerNamespacesDecodedStructure, IssuerNamespacesEncodedStructure, IssuerNamespacesOptions, IssuerSigned, IssuerSignedBuilder, IssuerSignedDecodedStructure, IssuerSignedEncodedStructure, IssuerSignedItem, IssuerSignedItemDecodedStructure, IssuerSignedItemEncodedStructure, IssuerSignedItemOptions, IssuerSignedOptions, ItemsRequest, ItemsRequestDecodedStructure, ItemsRequestEncodedStructure, ItemsRequestOptions, KeyAuthorizations, KeyAuthorizationsDecodedStructure, KeyAuthorizationsEncodedStructure, KeyAuthorizationsOptions, KeyInfo, KeyInfoDecodedStructure, KeyInfoEncodedStructure, KeyInfoOptions, KeyOps, KeyType, Mac0, MdlError, MdlParseError, MdocContext, MobileSecurityObject, MobileSecurityObjectDecodedStructure, MobileSecurityObjectEncodedStructure, MobileSecurityObjectOptions, Namespace, NfcHandover, NfcHandoverDecodedStructure, NfcHandoverEncodedStructure, NfcHandoverOptions, NfcOptions, NfcOptionsDecodedStructure, NfcOptionsEncodedStructure, NfcOptionsOptions, Oidc, OidcDecodedStructure, OidcEncodedStructure, OidcOptions, PresentationDefinitionOrDocRequestsAreRequiredError, ProtectedHeaders, ProtocolInfo, ProtocolInfoStructure, QrHandover, QrHandoverStructure, ReaderAuth, ReaderAuthDecodedStructure, ReaderAuthEncodedStructure, ReaderAuthOptions, RegisteredCwtClaimKey, RegisteredCwtHeaderClaimKey, RetrievalOptions, Security, SecurityDecodedStructure, SecurityEncodedStructure, SecurityOptions, ServerRetrievalMethod, ServerRetrievalMethodDecodedStructure, ServerRetrievalMethodEncodedStructure, ServerRetrievalMethodOptions, SessionTranscript, SessionTranscriptDecodedStructure, SessionTranscriptEncodedStructure, SessionTranscriptOptions, SessionTranscriptOrSessionTranscriptBytesAreRequiredError, Sign1, SignatureAlgorithm, SignatureAlgorithmDoesNotMatchSigningKeyAlgorithmError, TypedMap, UnprotectedHeaders, ValidityInfo, ValidityInfoDecodedStructure, ValidityInfoEncodedStructure, ValidityInfoOptions, ValueDigestOptions, ValueDigests, ValueDigestsStructure, VerificationAssessment, VerificationCallback, Verifier, WebApi, WebApiDecodedStructure, WebApiEncodedStructure, WebApiOptions, WifiOptions, WifiOptionsDecodedStructure, WifiOptionsEncodedStructure, WifiOptionsOptions, base64, base64url, bytesToString, cborDecode, cborEncode, compareBytes, concatBytes, defaultVerificationCallback, deviceSignedItemsSchema, errorItemsSchema, hex, issuerNamespacesDecodedSchema, issuerNamespacesEncodedSchema, issuerSignedItemSchema, limitDisclosureToDeviceRequestNameSpaces, onCategoryCheck, sessionTranscriptEncodedSchema, stringToBytes, typedMap };
|
|
1939
1483
|
//# sourceMappingURL=index.d.mts.map
|