@bcts/envelope 1.0.0-alpha.7 → 1.0.0-alpha.9

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.cts CHANGED
@@ -21,17 +21,17 @@ interface DigestProvider {
21
21
  //#endregion
22
22
  //#region src/base/envelope-encodable.d.ts
23
23
  interface EnvelopeEncodable {
24
- intoEnvelope(): Envelope$1;
24
+ intoEnvelope(): Envelope;
25
25
  }
26
26
  declare function isEnvelopeEncodable(value: unknown): value is EnvelopeEncodable;
27
- type EnvelopeEncodableValue = EnvelopeEncodable | string | number | boolean | bigint | Uint8Array | null | undefined | Envelope$1;
27
+ type EnvelopeEncodableValue = EnvelopeEncodable | string | number | boolean | bigint | Uint8Array | null | undefined | Envelope;
28
28
  //#endregion
29
29
  //#region src/base/assertion.d.ts
30
30
  declare class Assertion implements DigestProvider {
31
31
  #private;
32
- constructor(predicate: EnvelopeEncodable | Envelope$1, object: EnvelopeEncodable | Envelope$1);
33
- predicate(): Envelope$1;
34
- object(): Envelope$1;
32
+ constructor(predicate: EnvelopeEncodable | Envelope, object: EnvelopeEncodable | Envelope);
33
+ predicate(): Envelope;
34
+ object(): Envelope;
35
35
  digest(): Digest;
36
36
  equals(other: Assertion): boolean;
37
37
  toCbor(): Cbor;
@@ -41,255 +41,6 @@ declare class Assertion implements DigestProvider {
41
41
  clone(): Assertion;
42
42
  }
43
43
  //#endregion
44
- //#region src/extension/compress.d.ts
45
- declare class Compressed {
46
- #private;
47
- constructor(compressedData: Uint8Array, digest?: Digest);
48
- static fromDecompressedData(decompressedData: Uint8Array, digest?: Digest): Compressed;
49
- compressedData(): Uint8Array;
50
- digestOpt(): Digest | undefined;
51
- decompress(): Uint8Array;
52
- }
53
- declare module "../base/envelope" {
54
- interface Envelope {
55
- compress(): Envelope;
56
- decompress(): Envelope;
57
- compressSubject(): Envelope;
58
- decompressSubject(): Envelope;
59
- isCompressed(): boolean;
60
- }
61
- }
62
- declare function registerCompressExtension(): void;
63
- //#endregion
64
- //#region src/extension/encrypt.d.ts
65
- declare class SymmetricKey {
66
- #private;
67
- constructor(key: Uint8Array);
68
- static generate(): SymmetricKey;
69
- static from(key: Uint8Array): SymmetricKey;
70
- data(): Uint8Array;
71
- encrypt(plaintext: Uint8Array, digest: Digest): EncryptedMessage;
72
- decrypt(message: EncryptedMessage): Uint8Array;
73
- }
74
- declare class EncryptedMessage {
75
- #private;
76
- constructor(ciphertext: Uint8Array, nonce: Uint8Array, authTag: Uint8Array, aadDigest?: Digest);
77
- ciphertext(): Uint8Array;
78
- nonce(): Uint8Array;
79
- authTag(): Uint8Array;
80
- aadDigest(): Digest | undefined;
81
- digest(): Digest;
82
- }
83
- declare module "../base/envelope" {
84
- interface Envelope {
85
- encryptSubject(key: SymmetricKey): Envelope;
86
- decryptSubject(key: SymmetricKey): Envelope;
87
- encrypt(key: SymmetricKey): Envelope;
88
- decrypt(key: SymmetricKey): Envelope;
89
- isEncrypted(): boolean;
90
- }
91
- }
92
- declare function registerEncryptExtension(): void;
93
- //#endregion
94
- //#region src/base/envelope.d.ts
95
- type EnvelopeCase = {
96
- type: "node";
97
- subject: Envelope$1;
98
- assertions: Envelope$1[];
99
- digest: Digest;
100
- } | {
101
- type: "leaf";
102
- cbor: Cbor;
103
- digest: Digest;
104
- } | {
105
- type: "wrapped";
106
- envelope: Envelope$1;
107
- digest: Digest;
108
- } | {
109
- type: "assertion";
110
- assertion: Assertion;
111
- } | {
112
- type: "elided";
113
- digest: Digest;
114
- } | {
115
- type: "knownValue";
116
- value: KnownValue;
117
- digest: Digest;
118
- } | {
119
- type: "encrypted";
120
- message: EncryptedMessage;
121
- } | {
122
- type: "compressed";
123
- value: Compressed;
124
- };
125
- declare class Envelope$1 implements DigestProvider {
126
- #private;
127
- private constructor();
128
- case(): EnvelopeCase;
129
- static new(subject: EnvelopeEncodableValue): Envelope$1;
130
- static newOrNull(subject: EnvelopeEncodableValue | undefined): Envelope$1;
131
- static newOrNone(subject: EnvelopeEncodableValue | undefined): Envelope$1 | undefined;
132
- static fromCase(envelopeCase: EnvelopeCase): Envelope$1;
133
- static newAssertion(predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue): Envelope$1;
134
- static null(): Envelope$1;
135
- static newWithUncheckedAssertions(subject: Envelope$1, uncheckedAssertions: Envelope$1[]): Envelope$1;
136
- static newWithAssertions(subject: Envelope$1, assertions: Envelope$1[]): Envelope$1;
137
- static newWithAssertion(assertion: Assertion): Envelope$1;
138
- static newWithKnownValue(value: KnownValue | number | bigint): Envelope$1;
139
- static newWithEncrypted(encryptedMessage: EncryptedMessage): Envelope$1;
140
- static newWithCompressed(compressed: Compressed): Envelope$1;
141
- static newElided(digest: Digest): Envelope$1;
142
- static newLeaf(value: unknown): Envelope$1;
143
- static newWrapped(envelope: Envelope$1): Envelope$1;
144
- digest(): Digest;
145
- subject(): Envelope$1;
146
- isSubjectAssertion(): boolean;
147
- isSubjectObscured(): boolean;
148
- private static valueToCbor;
149
- private static cborToBytes;
150
- untaggedCbor(): Cbor;
151
- taggedCbor(): Cbor;
152
- static fromUntaggedCbor(cbor: Cbor): Envelope$1;
153
- static fromTaggedCbor(cbor: Cbor): Envelope$1;
154
- addAssertion(predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue): Envelope$1;
155
- addAssertionEnvelope(assertion: Envelope$1): Envelope$1;
156
- toString(): string;
157
- clone(): Envelope$1;
158
- treeFormat: (options?: {
159
- hideNodes?: boolean;
160
- highlightDigests?: Set<string>;
161
- digestDisplay?: "short" | "full";
162
- }) => string;
163
- shortId: (format?: "short" | "full") => string;
164
- summary: (maxLength?: number) => string;
165
- hex: () => string;
166
- cborBytes: () => Uint8Array;
167
- diagnostic: () => string;
168
- }
169
- //#endregion
170
- //#region src/base/error.d.ts
171
- declare enum ErrorCode {
172
- ALREADY_ELIDED = "ALREADY_ELIDED",
173
- AMBIGUOUS_PREDICATE = "AMBIGUOUS_PREDICATE",
174
- INVALID_DIGEST = "INVALID_DIGEST",
175
- INVALID_FORMAT = "INVALID_FORMAT",
176
- MISSING_DIGEST = "MISSING_DIGEST",
177
- NONEXISTENT_PREDICATE = "NONEXISTENT_PREDICATE",
178
- NOT_WRAPPED = "NOT_WRAPPED",
179
- NOT_LEAF = "NOT_LEAF",
180
- NOT_ASSERTION = "NOT_ASSERTION",
181
- INVALID_ASSERTION = "INVALID_ASSERTION",
182
- INVALID_ATTACHMENT = "INVALID_ATTACHMENT",
183
- NONEXISTENT_ATTACHMENT = "NONEXISTENT_ATTACHMENT",
184
- AMBIGUOUS_ATTACHMENT = "AMBIGUOUS_ATTACHMENT",
185
- ALREADY_COMPRESSED = "ALREADY_COMPRESSED",
186
- NOT_COMPRESSED = "NOT_COMPRESSED",
187
- ALREADY_ENCRYPTED = "ALREADY_ENCRYPTED",
188
- NOT_ENCRYPTED = "NOT_ENCRYPTED",
189
- NOT_KNOWN_VALUE = "NOT_KNOWN_VALUE",
190
- UNKNOWN_RECIPIENT = "UNKNOWN_RECIPIENT",
191
- UNKNOWN_SECRET = "UNKNOWN_SECRET",
192
- UNVERIFIED_SIGNATURE = "UNVERIFIED_SIGNATURE",
193
- INVALID_OUTER_SIGNATURE_TYPE = "INVALID_OUTER_SIGNATURE_TYPE",
194
- INVALID_INNER_SIGNATURE_TYPE = "INVALID_INNER_SIGNATURE_TYPE",
195
- UNVERIFIED_INNER_SIGNATURE = "UNVERIFIED_INNER_SIGNATURE",
196
- INVALID_SIGNATURE_TYPE = "INVALID_SIGNATURE_TYPE",
197
- INVALID_SHARES = "INVALID_SHARES",
198
- SSKR = "SSKR",
199
- INVALID_TYPE = "INVALID_TYPE",
200
- AMBIGUOUS_TYPE = "AMBIGUOUS_TYPE",
201
- UNEXPECTED_RESPONSE_ID = "UNEXPECTED_RESPONSE_ID",
202
- INVALID_RESPONSE = "INVALID_RESPONSE",
203
- CBOR = "CBOR",
204
- COMPONENTS = "COMPONENTS",
205
- GENERAL = "GENERAL",
206
- }
207
- declare class EnvelopeError extends Error {
208
- readonly code: ErrorCode;
209
- readonly cause?: Error;
210
- constructor(code: ErrorCode, message: string, cause?: Error);
211
- static alreadyElided(): EnvelopeError;
212
- static ambiguousPredicate(): EnvelopeError;
213
- static invalidDigest(): EnvelopeError;
214
- static invalidFormat(): EnvelopeError;
215
- static missingDigest(): EnvelopeError;
216
- static nonexistentPredicate(): EnvelopeError;
217
- static notWrapped(): EnvelopeError;
218
- static notLeaf(): EnvelopeError;
219
- static notAssertion(): EnvelopeError;
220
- static invalidAssertion(): EnvelopeError;
221
- static invalidAttachment(): EnvelopeError;
222
- static nonexistentAttachment(): EnvelopeError;
223
- static ambiguousAttachment(): EnvelopeError;
224
- static alreadyCompressed(): EnvelopeError;
225
- static notCompressed(): EnvelopeError;
226
- static alreadyEncrypted(): EnvelopeError;
227
- static notEncrypted(): EnvelopeError;
228
- static notKnownValue(): EnvelopeError;
229
- static unknownRecipient(): EnvelopeError;
230
- static unknownSecret(): EnvelopeError;
231
- static unverifiedSignature(): EnvelopeError;
232
- static invalidOuterSignatureType(): EnvelopeError;
233
- static invalidInnerSignatureType(): EnvelopeError;
234
- static unverifiedInnerSignature(): EnvelopeError;
235
- static invalidSignatureType(): EnvelopeError;
236
- static invalidShares(): EnvelopeError;
237
- static sskr(message: string, cause?: Error): EnvelopeError;
238
- static invalidType(): EnvelopeError;
239
- static ambiguousType(): EnvelopeError;
240
- static unexpectedResponseId(): EnvelopeError;
241
- static invalidResponse(): EnvelopeError;
242
- static cbor(message: string, cause?: Error): EnvelopeError;
243
- static components(message: string, cause?: Error): EnvelopeError;
244
- static general(message: string, cause?: Error): EnvelopeError;
245
- static msg(message: string): EnvelopeError;
246
- }
247
- //#endregion
248
- //#region src/base/cbor.d.ts
249
- declare class EnvelopeCBORTagged implements CborTagged {
250
- cborTags(): ReturnType<typeof tagsForValues>;
251
- static cborTags(): number[];
252
- }
253
- declare class EnvelopeCBORTaggedEncodable implements CborTaggedEncodable {
254
- private readonly envelope;
255
- constructor(envelope: Envelope$1);
256
- cborTags(): ReturnType<typeof tagsForValues>;
257
- untaggedCbor(): Cbor;
258
- taggedCbor(): Cbor;
259
- }
260
- declare class EnvelopeCBORTaggedDecodable<T = Envelope$1> implements CborTaggedDecodable<T> {
261
- cborTags(): ReturnType<typeof tagsForValues>;
262
- static fromUntaggedCbor(cbor: Cbor): Envelope$1;
263
- static fromTaggedCbor(cbor: Cbor): Envelope$1;
264
- fromUntaggedCbor(cbor: Cbor): T;
265
- fromTaggedCbor(cbor: Cbor): T;
266
- }
267
- declare function envelopeToCbor(envelope: Envelope$1): Cbor;
268
- declare function envelopeFromCbor(cbor: Cbor): Envelope$1;
269
- declare function envelopeToBytes(envelope: Envelope$1): Uint8Array;
270
- declare function envelopeFromBytes(bytes: Uint8Array): Envelope$1;
271
- //#endregion
272
- //#region src/base/envelope-decodable.d.ts
273
- declare function extractString(envelope: Envelope$1): string;
274
- declare function extractNumber(envelope: Envelope$1): number;
275
- declare function extractBoolean(envelope: Envelope$1): boolean;
276
- declare function extractBytes(envelope: Envelope$1): Uint8Array;
277
- declare function extractNull(envelope: Envelope$1): null;
278
- declare module "./envelope" {
279
- interface Envelope {
280
- tryLeaf(): Cbor;
281
- extractString(): string;
282
- extractNumber(): number;
283
- extractBoolean(): boolean;
284
- extractBytes(): Uint8Array;
285
- extractNull(): null;
286
- }
287
- }
288
- declare class EnvelopeDecoder {
289
- static tryFromCbor(cbor: Cbor): Envelope$1;
290
- static tryFromCborData(data: Uint8Array): Envelope$1;
291
- }
292
- //#endregion
293
44
  //#region src/base/elide.d.ts
294
45
  declare enum ObscureType {
295
46
  Elided = "elided",
@@ -305,29 +56,6 @@ type ObscureAction = {
305
56
  type: "compress";
306
57
  };
307
58
  declare function elideAction(): ObscureAction;
308
- declare module "./envelope" {
309
- interface Envelope {
310
- elide(): Envelope;
311
- elideRemovingSetWithAction(target: Set<Digest>, action: ObscureAction): Envelope;
312
- elideRemovingSet(target: Set<Digest>): Envelope;
313
- elideRemovingArrayWithAction(target: DigestProvider[], action: ObscureAction): Envelope;
314
- elideRemovingArray(target: DigestProvider[]): Envelope;
315
- elideRemovingTargetWithAction(target: DigestProvider, action: ObscureAction): Envelope;
316
- elideRemovingTarget(target: DigestProvider): Envelope;
317
- elideRevealingSetWithAction(target: Set<Digest>, action: ObscureAction): Envelope;
318
- elideRevealingSet(target: Set<Digest>): Envelope;
319
- elideRevealingArrayWithAction(target: DigestProvider[], action: ObscureAction): Envelope;
320
- elideRevealingArray(target: DigestProvider[]): Envelope;
321
- elideRevealingTargetWithAction(target: DigestProvider, action: ObscureAction): Envelope;
322
- elideRevealingTarget(target: DigestProvider): Envelope;
323
- unelide(envelope: Envelope): Envelope;
324
- nodesMatching(targetDigests: Set<Digest> | undefined, obscureTypes: ObscureType[]): Set<Digest>;
325
- walkUnelide(envelopes: Envelope[]): Envelope;
326
- walkReplace(target: Set<Digest>, replacement: Envelope): Envelope;
327
- isIdenticalTo(other: Envelope): boolean;
328
- }
329
- }
330
- //# sourceMappingURL=elide.d.ts.map
331
59
  //#endregion
332
60
  //#region src/base/walk.d.ts
333
61
  declare enum EdgeType {
@@ -339,115 +67,45 @@ declare enum EdgeType {
339
67
  Content = "content",
340
68
  }
341
69
  declare function edgeLabel(edgeType: EdgeType): string | undefined;
342
- type Visitor<State> = (envelope: Envelope$1, level: number, incomingEdge: EdgeType, state: State) => [State, boolean];
343
- declare module "./envelope" {
344
- interface Envelope {
345
- walk<State>(hideNodes: boolean, state: State, visit: Visitor<State>): void;
346
- }
347
- }
348
- //# sourceMappingURL=walk.d.ts.map
349
- //#endregion
350
- //#region src/base/assertions.d.ts
351
- declare module "./envelope" {
352
- interface Envelope {
353
- addAssertionEnvelopes(assertions: Envelope[]): Envelope;
354
- addOptionalAssertionEnvelope(assertion: Envelope | undefined): Envelope;
355
- addOptionalAssertion(predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue | undefined): Envelope;
356
- addNonemptyStringAssertion(predicate: EnvelopeEncodableValue, str: string): Envelope;
357
- addAssertions(envelopes: Envelope[]): Envelope;
358
- addAssertionIf(condition: boolean, predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue): Envelope;
359
- addAssertionEnvelopeIf(condition: boolean, assertionEnvelope: Envelope): Envelope;
360
- removeAssertion(target: Envelope): Envelope;
361
- replaceAssertion(assertion: Envelope, newAssertion: Envelope): Envelope;
362
- replaceSubject(subject: Envelope): Envelope;
363
- assertions(): Envelope[];
364
- }
365
- }
366
- //# sourceMappingURL=assertions.d.ts.map
367
- //#endregion
368
- //#region src/base/leaf.d.ts
369
- declare module "./envelope" {
370
- interface Envelope {
371
- isFalse(): boolean;
372
- isTrue(): boolean;
373
- isBool(): boolean;
374
- isNumber(): boolean;
375
- isSubjectNumber(): boolean;
376
- isNaN(): boolean;
377
- isSubjectNaN(): boolean;
378
- isNull(): boolean;
379
- tryByteString(): Uint8Array;
380
- asByteString(): Uint8Array | undefined;
381
- asArray(): readonly Cbor[] | undefined;
382
- asMap(): CborMap | undefined;
383
- asText(): string | undefined;
384
- asLeaf(): Cbor | undefined;
385
- }
386
- }
387
- //# sourceMappingURL=leaf.d.ts.map
388
- //#endregion
389
- //#region src/base/queries.d.ts
390
- declare module "./envelope" {
391
- interface Envelope {
392
- hasAssertions(): boolean;
393
- asAssertion(): Envelope | undefined;
394
- tryAssertion(): Envelope;
395
- asPredicate(): Envelope | undefined;
396
- tryPredicate(): Envelope;
397
- asObject(): Envelope | undefined;
398
- tryObject(): Envelope;
399
- isAssertion(): boolean;
400
- isElided(): boolean;
401
- isLeaf(): boolean;
402
- isNode(): boolean;
403
- isWrapped(): boolean;
404
- isInternal(): boolean;
405
- isObscured(): boolean;
406
- assertionsWithPredicate(predicate: EnvelopeEncodableValue): Envelope[];
407
- assertionWithPredicate(predicate: EnvelopeEncodableValue): Envelope;
408
- optionalAssertionWithPredicate(predicate: EnvelopeEncodableValue): Envelope | undefined;
409
- objectForPredicate(predicate: EnvelopeEncodableValue): Envelope;
410
- optionalObjectForPredicate(predicate: EnvelopeEncodableValue): Envelope | undefined;
411
- objectsForPredicate(predicate: EnvelopeEncodableValue): Envelope[];
412
- elementsCount(): number;
413
- }
414
- }
415
- //# sourceMappingURL=queries.d.ts.map
416
- //#endregion
417
- //#region src/base/wrap.d.ts
418
- declare module "./envelope" {
419
- interface Envelope {
420
- wrap(): Envelope;
421
- tryUnwrap(): Envelope;
422
- unwrap(): Envelope;
423
- }
424
- }
70
+ type Visitor<State> = (envelope: Envelope, level: number, incomingEdge: EdgeType, state: State) => [State, boolean];
425
71
  //#endregion
426
72
  //#region src/extension/types.d.ts
427
73
  declare const IS_A = "isA";
428
- declare module "../base/envelope" {
429
- interface Envelope {
430
- addType(object: EnvelopeEncodableValue): Envelope;
431
- types(): Envelope[];
432
- getType(): Envelope;
433
- hasType(t: EnvelopeEncodableValue): boolean;
434
- checkType(t: EnvelopeEncodableValue): void;
435
- }
436
- }
437
- //# sourceMappingURL=types.d.ts.map
438
74
  //#endregion
439
75
  //#region src/extension/salt.d.ts
440
76
  declare const SALT = "salt";
441
- declare module "../base/envelope" {
442
- interface Envelope {
443
- addSalt(): Envelope;
444
- addSaltWithLength(count: number): Envelope;
445
- addSaltBytes(saltBytes: Uint8Array): Envelope;
446
- addSaltInRange(min: number, max: number): Envelope;
447
- }
77
+ //#endregion
78
+ //#region src/extension/compress.d.ts
79
+ declare class Compressed {
80
+ #private;
81
+ constructor(compressedData: Uint8Array, digest?: Digest);
82
+ static fromDecompressedData(decompressedData: Uint8Array, digest?: Digest): Compressed;
83
+ compressedData(): Uint8Array;
84
+ digestOpt(): Digest | undefined;
85
+ decompress(): Uint8Array;
448
86
  }
449
- //# sourceMappingURL=salt.d.ts.map
450
-
87
+ declare function registerCompressExtension(): void;
88
+ //#endregion
89
+ //#region src/extension/encrypt.d.ts
90
+ declare class SymmetricKey {
91
+ #private;
92
+ constructor(key: Uint8Array);
93
+ static generate(): SymmetricKey;
94
+ static from(key: Uint8Array): SymmetricKey;
95
+ data(): Uint8Array;
96
+ encrypt(plaintext: Uint8Array, digest: Digest): EncryptedMessage;
97
+ decrypt(message: EncryptedMessage): Uint8Array;
98
+ }
99
+ declare class EncryptedMessage {
100
+ #private;
101
+ constructor(ciphertext: Uint8Array, nonce: Uint8Array, authTag: Uint8Array, aadDigest?: Digest);
102
+ ciphertext(): Uint8Array;
103
+ nonce(): Uint8Array;
104
+ authTag(): Uint8Array;
105
+ aadDigest(): Digest | undefined;
106
+ digest(): Digest;
107
+ }
108
+ declare function registerEncryptExtension(): void;
451
109
  //#endregion
452
110
  //#region src/extension/signature.d.ts
453
111
  /**
@@ -585,66 +243,6 @@ declare class SignatureMetadata {
585
243
  */
586
244
  hasAssertions(): boolean;
587
245
  }
588
- /**
589
- * Support for signing envelopes and verifying signatures.
590
- */
591
- declare module "../base/envelope" {
592
- interface Envelope {
593
- /**
594
- * Creates a signature for the envelope's subject and returns a new
595
- * envelope with a 'signed': Signature assertion.
596
- *
597
- * @param signer - The signing key
598
- * @returns The signed envelope
599
- *
600
- * @example
601
- * ```typescript
602
- * const privateKey = SigningPrivateKey.generate();
603
- * const envelope = Envelope.new("Hello, world!");
604
- * const signed = envelope.addSignature(privateKey);
605
- * ```
606
- */
607
- addSignature(signer: Signer): Envelope;
608
- /**
609
- * Creates a signature for the envelope's subject with optional metadata.
610
- *
611
- * @param signer - The signing key
612
- * @param metadata - Optional metadata to attach to the signature
613
- * @returns The signed envelope
614
- */
615
- addSignatureWithMetadata(signer: Signer, metadata?: SignatureMetadata): Envelope;
616
- /**
617
- * Creates multiple signatures for the envelope's subject.
618
- *
619
- * @param signers - Array of signing keys
620
- * @returns The envelope with multiple signatures
621
- */
622
- addSignatures(signers: Signer[]): Envelope;
623
- /**
624
- * Returns whether this envelope has a valid signature from the given verifier.
625
- *
626
- * @param verifier - The public key to verify against
627
- * @returns True if a valid signature from this verifier exists
628
- */
629
- hasSignatureFrom(verifier: Verifier): boolean;
630
- /**
631
- * Verifies that this envelope has a valid signature from the given verifier
632
- * and returns the envelope.
633
- *
634
- * @param verifier - The public key to verify against
635
- * @returns The verified envelope
636
- * @throws {EnvelopeError} If no valid signature is found
637
- */
638
- verifySignatureFrom(verifier: Verifier): Envelope;
639
- /**
640
- * Returns all signature assertions in this envelope.
641
- *
642
- * @returns Array of signature envelopes
643
- */
644
- signatures(): Envelope[];
645
- }
646
- }
647
- //# sourceMappingURL=signature.d.ts.map
648
246
  //#endregion
649
247
  //#region src/extension/attachment.d.ts
650
248
  /**
@@ -685,14 +283,14 @@ declare class Attachments {
685
283
  * @param digest - The unique digest of the attachment to retrieve
686
284
  * @returns The envelope if found, or undefined
687
285
  */
688
- get(digest: Digest): Envelope$1 | undefined;
286
+ get(digest: Digest): Envelope | undefined;
689
287
  /**
690
288
  * Removes an attachment by its digest.
691
289
  *
692
290
  * @param digest - The unique digest of the attachment to remove
693
291
  * @returns The removed envelope if found, or undefined
694
292
  */
695
- remove(digest: Digest): Envelope$1 | undefined;
293
+ remove(digest: Digest): Envelope | undefined;
696
294
  /**
697
295
  * Removes all attachments from the container.
698
296
  */
@@ -707,94 +305,15 @@ declare class Attachments {
707
305
  * @param envelope - The envelope to add attachments to
708
306
  * @returns A new envelope with all attachments added as assertions
709
307
  */
710
- addToEnvelope(envelope: Envelope$1): Envelope$1;
308
+ addToEnvelope(envelope: Envelope): Envelope;
711
309
  /**
712
310
  * Creates an Attachments container from an envelope's attachment assertions.
713
311
  *
714
312
  * @param envelope - The envelope to extract attachments from
715
313
  * @returns A new Attachments container with the envelope's attachments
716
314
  */
717
- static fromEnvelope(envelope: Envelope$1): Attachments;
718
- }
719
- /**
720
- * Support for attachments in envelopes.
721
- */
722
- declare module "../base/envelope" {
723
- interface Envelope {
724
- /**
725
- * Creates a new envelope with an attachment as its subject.
726
- *
727
- * The attachment consists of:
728
- * - The predicate 'attachment'
729
- * - An object that is a wrapped envelope containing:
730
- * - The payload (as the subject)
731
- * - A required 'vendor': String assertion
732
- * - An optional 'conformsTo': String assertion
733
- *
734
- * @param payload - The content of the attachment
735
- * @param vendor - A string identifying the entity (typically reverse domain name)
736
- * @param conformsTo - Optional URI identifying the format of the attachment
737
- * @returns A new attachment envelope
738
- *
739
- * @example
740
- * ```typescript
741
- * const attachment = Envelope.newAttachment(
742
- * "Custom data",
743
- * "com.example",
744
- * "https://example.com/format/v1"
745
- * );
746
- * ```
747
- */
748
- addAttachment(payload: EnvelopeEncodableValue, vendor: string, conformsTo?: string): Envelope$1;
749
- /**
750
- * Returns the payload of an attachment envelope.
751
- *
752
- * @returns The payload envelope
753
- * @throws {EnvelopeError} If the envelope is not a valid attachment
754
- */
755
- attachmentPayload(): Envelope$1;
756
- /**
757
- * Returns the vendor identifier of an attachment envelope.
758
- *
759
- * @returns The vendor string
760
- * @throws {EnvelopeError} If the envelope is not a valid attachment
761
- */
762
- attachmentVendor(): string;
763
- /**
764
- * Returns the optional conformsTo URI of an attachment envelope.
765
- *
766
- * @returns The conformsTo string if present, or undefined
767
- * @throws {EnvelopeError} If the envelope is not a valid attachment
768
- */
769
- attachmentConformsTo(): string | undefined;
770
- /**
771
- * Returns all attachment assertions in this envelope.
772
- *
773
- * @returns Array of attachment envelopes
774
- */
775
- attachments(): Envelope$1[];
776
- /**
777
- * Searches for attachments matching the given vendor and conformsTo.
778
- *
779
- * @param vendor - Optional vendor identifier to match
780
- * @param conformsTo - Optional conformsTo URI to match
781
- * @returns Array of matching attachment envelopes
782
- */
783
- attachmentsWithVendorAndConformsTo(vendor?: string, conformsTo?: string): Envelope$1[];
784
- }
785
- namespace Envelope {
786
- /**
787
- * Creates a new attachment envelope.
788
- *
789
- * @param payload - The content of the attachment
790
- * @param vendor - A string identifying the entity
791
- * @param conformsTo - Optional URI identifying the format
792
- * @returns A new attachment envelope
793
- */
794
- function newAttachment(payload: EnvelopeEncodableValue, vendor: string, conformsTo?: string): Envelope$1;
795
- }
315
+ static fromEnvelope(envelope: Envelope): Attachments;
796
316
  }
797
- //# sourceMappingURL=attachment.d.ts.map
798
317
  //#endregion
799
318
  //#region src/extension/recipient.d.ts
800
319
  declare const HAS_RECIPIENT = "hasRecipient";
@@ -825,17 +344,6 @@ declare class SealedMessage {
825
344
  hex(): string;
826
345
  static fromHex(hex: string): SealedMessage;
827
346
  }
828
- declare module "../base/envelope" {
829
- interface Envelope {
830
- encryptSubjectToRecipient(recipientPublicKey: PublicKeyBase): Envelope;
831
- encryptSubjectToRecipients(recipients: PublicKeyBase[]): Envelope;
832
- addRecipient(recipientPublicKey: PublicKeyBase, contentKey: SymmetricKey): Envelope;
833
- decryptSubjectToRecipient(recipientPrivateKey: PrivateKeyBase): Envelope;
834
- decryptToRecipient(recipientPrivateKey: PrivateKeyBase): Envelope;
835
- encryptToRecipients(recipients: PublicKeyBase[]): Envelope;
836
- recipients(): SealedMessage[];
837
- }
838
- }
839
347
  //#endregion
840
348
  //#region src/extension/expression.d.ts
841
349
  declare const CBOR_TAG_FUNCTION = 40006;
@@ -872,7 +380,7 @@ declare class Function {
872
380
  id(): FunctionID;
873
381
  isNumeric(): boolean;
874
382
  isString(): boolean;
875
- envelope(): Envelope$1;
383
+ envelope(): Envelope;
876
384
  withParameter(param: ParameterID, value: EnvelopeEncodableValue): Expression;
877
385
  static fromNumeric(id: number): Function;
878
386
  static fromString(name: string): Function;
@@ -880,12 +388,12 @@ declare class Function {
880
388
  }
881
389
  declare class Parameter {
882
390
  #private;
883
- constructor(id: ParameterID, value: Envelope$1);
391
+ constructor(id: ParameterID, value: Envelope);
884
392
  id(): ParameterID;
885
- value(): Envelope$1;
393
+ value(): Envelope;
886
394
  isNumeric(): boolean;
887
395
  isString(): boolean;
888
- envelope(): Envelope$1;
396
+ envelope(): Envelope;
889
397
  static blank(value: EnvelopeEncodableValue): Parameter;
890
398
  static lhs(value: EnvelopeEncodableValue): Parameter;
891
399
  static rhs(value: EnvelopeEncodableValue): Parameter;
@@ -898,10 +406,10 @@ declare class Expression {
898
406
  parameters(): Parameter[];
899
407
  withParameter(param: ParameterID, value: EnvelopeEncodableValue): Expression;
900
408
  withParameters(params: Record<string, EnvelopeEncodableValue>): Expression;
901
- getParameter(param: ParameterID): Envelope$1 | undefined;
409
+ getParameter(param: ParameterID): Envelope | undefined;
902
410
  hasParameter(param: ParameterID): boolean;
903
- envelope(): Envelope$1;
904
- static fromEnvelope(envelope: Envelope$1): Expression;
411
+ envelope(): Envelope;
412
+ static fromEnvelope(envelope: Envelope): Expression;
905
413
  toString(): string;
906
414
  }
907
415
  declare function add(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
@@ -916,14 +424,310 @@ declare function and(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue):
916
424
  declare function or(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
917
425
  declare function not(value: EnvelopeEncodableValue): Expression;
918
426
  //#endregion
919
- //#region src/extension/proof.d.ts
920
- declare module "../base/envelope" {
921
- interface Envelope {
922
- proofContainsSet(target: Set<Digest>): Envelope | undefined;
923
- proofContainsTarget(target: Envelope): Envelope | undefined;
924
- confirmContainsSet(target: Set<Digest>, proof: Envelope): boolean;
925
- confirmContainsTarget(target: Envelope, proof: Envelope): boolean;
926
- }
427
+ //#region src/base/envelope.d.ts
428
+ type EnvelopeCase = {
429
+ type: "node";
430
+ subject: Envelope;
431
+ assertions: Envelope[];
432
+ digest: Digest;
433
+ } | {
434
+ type: "leaf";
435
+ cbor: Cbor;
436
+ digest: Digest;
437
+ } | {
438
+ type: "wrapped";
439
+ envelope: Envelope;
440
+ digest: Digest;
441
+ } | {
442
+ type: "assertion";
443
+ assertion: Assertion;
444
+ } | {
445
+ type: "elided";
446
+ digest: Digest;
447
+ } | {
448
+ type: "knownValue";
449
+ value: KnownValue;
450
+ digest: Digest;
451
+ } | {
452
+ type: "encrypted";
453
+ message: EncryptedMessage;
454
+ } | {
455
+ type: "compressed";
456
+ value: Compressed;
457
+ };
458
+ declare class Envelope implements DigestProvider {
459
+ #private;
460
+ private constructor();
461
+ case(): EnvelopeCase;
462
+ static new(subject: EnvelopeEncodableValue): Envelope;
463
+ static newOrNull(subject: EnvelopeEncodableValue | undefined): Envelope;
464
+ static newOrNone(subject: EnvelopeEncodableValue | undefined): Envelope | undefined;
465
+ static fromCase(envelopeCase: EnvelopeCase): Envelope;
466
+ static newAssertion(predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue): Envelope;
467
+ static null(): Envelope;
468
+ static newWithUncheckedAssertions(subject: Envelope, uncheckedAssertions: Envelope[]): Envelope;
469
+ static newWithAssertions(subject: Envelope, assertions: Envelope[]): Envelope;
470
+ static newWithAssertion(assertion: Assertion): Envelope;
471
+ static newWithKnownValue(value: KnownValue | number | bigint): Envelope;
472
+ static newWithEncrypted(encryptedMessage: EncryptedMessage): Envelope;
473
+ static newWithCompressed(compressed: Compressed): Envelope;
474
+ static newElided(digest: Digest): Envelope;
475
+ static newLeaf(value: unknown): Envelope;
476
+ static newWrapped(envelope: Envelope): Envelope;
477
+ digest(): Digest;
478
+ subject(): Envelope;
479
+ isSubjectAssertion(): boolean;
480
+ isSubjectObscured(): boolean;
481
+ private static valueToCbor;
482
+ private static cborToBytes;
483
+ untaggedCbor(): Cbor;
484
+ taggedCbor(): Cbor;
485
+ static fromUntaggedCbor(cbor: Cbor): Envelope;
486
+ static fromTaggedCbor(cbor: Cbor): Envelope;
487
+ addAssertion(predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue): Envelope;
488
+ addAssertionEnvelope(assertion: Envelope): Envelope;
489
+ toString(): string;
490
+ clone(): Envelope;
491
+ treeFormat: (options?: {
492
+ hideNodes?: boolean;
493
+ highlightDigests?: Set<string>;
494
+ digestDisplay?: "short" | "full";
495
+ }) => string;
496
+ shortId: (format?: "short" | "full") => string;
497
+ summary: (maxLength?: number) => string;
498
+ hex: () => string;
499
+ cborBytes: () => Uint8Array;
500
+ diagnostic: () => string;
501
+ addAssertionEnvelopes: (assertions: Envelope[]) => Envelope;
502
+ addOptionalAssertionEnvelope: (assertion: Envelope | undefined) => Envelope;
503
+ addOptionalAssertion: (predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue | undefined) => Envelope;
504
+ addNonemptyStringAssertion: (predicate: EnvelopeEncodableValue, str: string) => Envelope;
505
+ addAssertions: (envelopes: Envelope[]) => Envelope;
506
+ addAssertionIf: (condition: boolean, predicate: EnvelopeEncodableValue, object: EnvelopeEncodableValue) => Envelope;
507
+ addAssertionEnvelopeIf: (condition: boolean, assertionEnvelope: Envelope) => Envelope;
508
+ removeAssertion: (target: Envelope) => Envelope;
509
+ replaceAssertion: (assertion: Envelope, newAssertion: Envelope) => Envelope;
510
+ replaceSubject: (subject: Envelope) => Envelope;
511
+ elide: () => Envelope;
512
+ elideRemovingSetWithAction: (target: Set<Digest>, action: ObscureAction) => Envelope;
513
+ elideRemovingSet: (target: Set<Digest>) => Envelope;
514
+ elideRemovingArrayWithAction: (target: DigestProvider[], action: ObscureAction) => Envelope;
515
+ elideRemovingArray: (target: DigestProvider[]) => Envelope;
516
+ elideRemovingTargetWithAction: (target: DigestProvider, action: ObscureAction) => Envelope;
517
+ elideRemovingTarget: (target: DigestProvider) => Envelope;
518
+ elideRevealingSetWithAction: (target: Set<Digest>, action: ObscureAction) => Envelope;
519
+ elideRevealingSet: (target: Set<Digest>) => Envelope;
520
+ elideRevealingArrayWithAction: (target: DigestProvider[], action: ObscureAction) => Envelope;
521
+ elideRevealingArray: (target: DigestProvider[]) => Envelope;
522
+ elideRevealingTargetWithAction: (target: DigestProvider, action: ObscureAction) => Envelope;
523
+ elideRevealingTarget: (target: DigestProvider) => Envelope;
524
+ unelide: (envelope: Envelope) => Envelope;
525
+ nodesMatching: (targetDigests: Set<Digest> | undefined, obscureTypes: ObscureType[]) => Set<Digest>;
526
+ walkUnelide: (envelopes: Envelope[]) => Envelope;
527
+ walkReplace: (target: Set<Digest>, replacement: Envelope) => Envelope;
528
+ isIdenticalTo: (other: Envelope) => boolean;
529
+ tryLeaf: () => Cbor;
530
+ extractString: () => string;
531
+ extractNumber: () => number;
532
+ extractBoolean: () => boolean;
533
+ extractBytes: () => Uint8Array;
534
+ extractNull: () => null;
535
+ isFalse: () => boolean;
536
+ isTrue: () => boolean;
537
+ isBool: () => boolean;
538
+ isNumber: () => boolean;
539
+ isSubjectNumber: () => boolean;
540
+ isNaN: () => boolean;
541
+ isSubjectNaN: () => boolean;
542
+ isNull: () => boolean;
543
+ tryByteString: () => Uint8Array;
544
+ asByteString: () => Uint8Array | undefined;
545
+ asArray: () => readonly Cbor[] | undefined;
546
+ asMap: () => CborMap | undefined;
547
+ asText: () => string | undefined;
548
+ asLeaf: () => Cbor | undefined;
549
+ hasAssertions: () => boolean;
550
+ asAssertion: () => Envelope | undefined;
551
+ tryAssertion: () => Envelope;
552
+ asPredicate: () => Envelope | undefined;
553
+ tryPredicate: () => Envelope;
554
+ asObject: () => Envelope | undefined;
555
+ tryObject: () => Envelope;
556
+ isAssertion: () => boolean;
557
+ isElided: () => boolean;
558
+ isLeaf: () => boolean;
559
+ isNode: () => boolean;
560
+ isWrapped: () => boolean;
561
+ isInternal: () => boolean;
562
+ isObscured: () => boolean;
563
+ assertions: () => Envelope[];
564
+ assertionsWithPredicate: (predicate: EnvelopeEncodableValue) => Envelope[];
565
+ assertionWithPredicate: (predicate: EnvelopeEncodableValue) => Envelope;
566
+ optionalAssertionWithPredicate: (predicate: EnvelopeEncodableValue) => Envelope | undefined;
567
+ objectForPredicate: (predicate: EnvelopeEncodableValue) => Envelope;
568
+ optionalObjectForPredicate: (predicate: EnvelopeEncodableValue) => Envelope | undefined;
569
+ objectsForPredicate: (predicate: EnvelopeEncodableValue) => Envelope[];
570
+ elementsCount: () => number;
571
+ walk: <State>(hideNodes: boolean, state: State, visit: Visitor<State>) => void;
572
+ wrap: () => Envelope;
573
+ tryUnwrap: () => Envelope;
574
+ unwrap: () => Envelope;
575
+ addAttachment: (payload: EnvelopeEncodableValue, vendor: string, conformsTo?: string) => Envelope;
576
+ attachmentPayload: () => Envelope;
577
+ attachmentVendor: () => string;
578
+ attachmentConformsTo: () => string | undefined;
579
+ attachments: () => Envelope[];
580
+ attachmentsWithVendorAndConformsTo: (vendor?: string, conformsTo?: string) => Envelope[];
581
+ compress: () => Envelope;
582
+ decompress: () => Envelope;
583
+ compressSubject: () => Envelope;
584
+ decompressSubject: () => Envelope;
585
+ isCompressed: () => boolean;
586
+ encryptSubject: (key: SymmetricKey) => Envelope;
587
+ decryptSubject: (key: SymmetricKey) => Envelope;
588
+ encrypt: (key: SymmetricKey) => Envelope;
589
+ decrypt: (key: SymmetricKey) => Envelope;
590
+ isEncrypted: () => boolean;
591
+ proofContainsSet: (target: Set<Digest>) => Envelope | undefined;
592
+ proofContainsTarget: (target: Envelope) => Envelope | undefined;
593
+ confirmContainsSet: (target: Set<Digest>, proof: Envelope) => boolean;
594
+ confirmContainsTarget: (target: Envelope, proof: Envelope) => boolean;
595
+ encryptSubjectToRecipient: (recipientPublicKey: PublicKeyBase) => Envelope;
596
+ encryptSubjectToRecipients: (recipients: PublicKeyBase[]) => Envelope;
597
+ addRecipient: (recipientPublicKey: PublicKeyBase, contentKey: SymmetricKey) => Envelope;
598
+ decryptSubjectToRecipient: (recipientPrivateKey: PrivateKeyBase) => Envelope;
599
+ decryptToRecipient: (recipientPrivateKey: PrivateKeyBase) => Envelope;
600
+ encryptToRecipients: (recipients: PublicKeyBase[]) => Envelope;
601
+ recipients: () => SealedMessage[];
602
+ addSalt: () => Envelope;
603
+ addSaltWithLength: (count: number) => Envelope;
604
+ addSaltBytes: (saltBytes: Uint8Array) => Envelope;
605
+ addSaltInRange: (min: number, max: number) => Envelope;
606
+ addSignature: (signer: Signer) => Envelope;
607
+ addSignatureWithMetadata: (signer: Signer, metadata?: SignatureMetadata) => Envelope;
608
+ addSignatures: (signers: Signer[]) => Envelope;
609
+ hasSignatureFrom: (verifier: Verifier) => boolean;
610
+ verifySignatureFrom: (verifier: Verifier) => Envelope;
611
+ signatures: () => Envelope[];
612
+ addType: (object: EnvelopeEncodableValue) => Envelope;
613
+ types: () => Envelope[];
614
+ getType: () => Envelope;
615
+ hasType: (t: EnvelopeEncodableValue) => boolean;
616
+ checkType: (t: EnvelopeEncodableValue) => void;
617
+ static newAttachment: (payload: EnvelopeEncodableValue, vendor: string, conformsTo?: string) => Envelope;
618
+ }
619
+ //#endregion
620
+ //#region src/base/error.d.ts
621
+ declare enum ErrorCode {
622
+ ALREADY_ELIDED = "ALREADY_ELIDED",
623
+ AMBIGUOUS_PREDICATE = "AMBIGUOUS_PREDICATE",
624
+ INVALID_DIGEST = "INVALID_DIGEST",
625
+ INVALID_FORMAT = "INVALID_FORMAT",
626
+ MISSING_DIGEST = "MISSING_DIGEST",
627
+ NONEXISTENT_PREDICATE = "NONEXISTENT_PREDICATE",
628
+ NOT_WRAPPED = "NOT_WRAPPED",
629
+ NOT_LEAF = "NOT_LEAF",
630
+ NOT_ASSERTION = "NOT_ASSERTION",
631
+ INVALID_ASSERTION = "INVALID_ASSERTION",
632
+ INVALID_ATTACHMENT = "INVALID_ATTACHMENT",
633
+ NONEXISTENT_ATTACHMENT = "NONEXISTENT_ATTACHMENT",
634
+ AMBIGUOUS_ATTACHMENT = "AMBIGUOUS_ATTACHMENT",
635
+ ALREADY_COMPRESSED = "ALREADY_COMPRESSED",
636
+ NOT_COMPRESSED = "NOT_COMPRESSED",
637
+ ALREADY_ENCRYPTED = "ALREADY_ENCRYPTED",
638
+ NOT_ENCRYPTED = "NOT_ENCRYPTED",
639
+ NOT_KNOWN_VALUE = "NOT_KNOWN_VALUE",
640
+ UNKNOWN_RECIPIENT = "UNKNOWN_RECIPIENT",
641
+ UNKNOWN_SECRET = "UNKNOWN_SECRET",
642
+ UNVERIFIED_SIGNATURE = "UNVERIFIED_SIGNATURE",
643
+ INVALID_OUTER_SIGNATURE_TYPE = "INVALID_OUTER_SIGNATURE_TYPE",
644
+ INVALID_INNER_SIGNATURE_TYPE = "INVALID_INNER_SIGNATURE_TYPE",
645
+ UNVERIFIED_INNER_SIGNATURE = "UNVERIFIED_INNER_SIGNATURE",
646
+ INVALID_SIGNATURE_TYPE = "INVALID_SIGNATURE_TYPE",
647
+ INVALID_SHARES = "INVALID_SHARES",
648
+ SSKR = "SSKR",
649
+ INVALID_TYPE = "INVALID_TYPE",
650
+ AMBIGUOUS_TYPE = "AMBIGUOUS_TYPE",
651
+ UNEXPECTED_RESPONSE_ID = "UNEXPECTED_RESPONSE_ID",
652
+ INVALID_RESPONSE = "INVALID_RESPONSE",
653
+ CBOR = "CBOR",
654
+ COMPONENTS = "COMPONENTS",
655
+ GENERAL = "GENERAL",
656
+ }
657
+ declare class EnvelopeError extends Error {
658
+ readonly code: ErrorCode;
659
+ readonly cause?: Error;
660
+ constructor(code: ErrorCode, message: string, cause?: Error);
661
+ static alreadyElided(): EnvelopeError;
662
+ static ambiguousPredicate(): EnvelopeError;
663
+ static invalidDigest(): EnvelopeError;
664
+ static invalidFormat(): EnvelopeError;
665
+ static missingDigest(): EnvelopeError;
666
+ static nonexistentPredicate(): EnvelopeError;
667
+ static notWrapped(): EnvelopeError;
668
+ static notLeaf(): EnvelopeError;
669
+ static notAssertion(): EnvelopeError;
670
+ static invalidAssertion(): EnvelopeError;
671
+ static invalidAttachment(): EnvelopeError;
672
+ static nonexistentAttachment(): EnvelopeError;
673
+ static ambiguousAttachment(): EnvelopeError;
674
+ static alreadyCompressed(): EnvelopeError;
675
+ static notCompressed(): EnvelopeError;
676
+ static alreadyEncrypted(): EnvelopeError;
677
+ static notEncrypted(): EnvelopeError;
678
+ static notKnownValue(): EnvelopeError;
679
+ static unknownRecipient(): EnvelopeError;
680
+ static unknownSecret(): EnvelopeError;
681
+ static unverifiedSignature(): EnvelopeError;
682
+ static invalidOuterSignatureType(): EnvelopeError;
683
+ static invalidInnerSignatureType(): EnvelopeError;
684
+ static unverifiedInnerSignature(): EnvelopeError;
685
+ static invalidSignatureType(): EnvelopeError;
686
+ static invalidShares(): EnvelopeError;
687
+ static sskr(message: string, cause?: Error): EnvelopeError;
688
+ static invalidType(): EnvelopeError;
689
+ static ambiguousType(): EnvelopeError;
690
+ static unexpectedResponseId(): EnvelopeError;
691
+ static invalidResponse(): EnvelopeError;
692
+ static cbor(message: string, cause?: Error): EnvelopeError;
693
+ static components(message: string, cause?: Error): EnvelopeError;
694
+ static general(message: string, cause?: Error): EnvelopeError;
695
+ static msg(message: string): EnvelopeError;
696
+ }
697
+ //#endregion
698
+ //#region src/base/cbor.d.ts
699
+ declare class EnvelopeCBORTagged implements CborTagged {
700
+ cborTags(): ReturnType<typeof tagsForValues>;
701
+ static cborTags(): number[];
702
+ }
703
+ declare class EnvelopeCBORTaggedEncodable implements CborTaggedEncodable {
704
+ private readonly envelope;
705
+ constructor(envelope: Envelope);
706
+ cborTags(): ReturnType<typeof tagsForValues>;
707
+ untaggedCbor(): Cbor;
708
+ taggedCbor(): Cbor;
709
+ }
710
+ declare class EnvelopeCBORTaggedDecodable<T = Envelope> implements CborTaggedDecodable<T> {
711
+ cborTags(): ReturnType<typeof tagsForValues>;
712
+ static fromUntaggedCbor(cbor: Cbor): Envelope;
713
+ static fromTaggedCbor(cbor: Cbor): Envelope;
714
+ fromUntaggedCbor(cbor: Cbor): T;
715
+ fromTaggedCbor(cbor: Cbor): T;
716
+ }
717
+ declare function envelopeToCbor(envelope: Envelope): Cbor;
718
+ declare function envelopeFromCbor(cbor: Cbor): Envelope;
719
+ declare function envelopeToBytes(envelope: Envelope): Uint8Array;
720
+ declare function envelopeFromBytes(bytes: Uint8Array): Envelope;
721
+ //#endregion
722
+ //#region src/base/envelope-decodable.d.ts
723
+ declare function extractString(envelope: Envelope): string;
724
+ declare function extractNumber(envelope: Envelope): number;
725
+ declare function extractBoolean(envelope: Envelope): boolean;
726
+ declare function extractBytes(envelope: Envelope): Uint8Array;
727
+ declare function extractNull(envelope: Envelope): null;
728
+ declare class EnvelopeDecoder {
729
+ static tryFromCbor(cbor: Cbor): Envelope;
730
+ static tryFromCborData(data: Uint8Array): Envelope;
927
731
  }
928
732
  //#endregion
929
733
  //#region src/format/tree.d.ts
@@ -974,5 +778,5 @@ declare global {
974
778
  //#region src/index.d.ts
975
779
  declare const VERSION = "0.37.0";
976
780
  //#endregion
977
- export { ATTACHMENT, Assertion, Attachments, CBOR_TAG_FUNCTION, CBOR_TAG_PARAMETER, CBOR_TAG_PLACEHOLDER, CBOR_TAG_REPLACEMENT, CONFORMS_TO, Compressed, Digest, type DigestProvider, EdgeType, EncryptedMessage, Envelope$1 as Envelope, EnvelopeCBORTagged, EnvelopeCBORTaggedDecodable, EnvelopeCBORTaggedEncodable, type EnvelopeCase, EnvelopeDecoder, type EnvelopeEncodable, type EnvelopeEncodableValue, EnvelopeError, ErrorCode, Expression, FUNCTION_IDS, Function, type FunctionID, HAS_RECIPIENT, IS_A, NOTE, type ObscureAction, ObscureType, PARAMETER_IDS, Parameter, type ParameterID, PrivateKeyBase, PublicKeyBase, SALT, SIGNED, SealedMessage, Signature, SignatureMetadata, type Signer, SigningPrivateKey, SigningPublicKey, SymmetricKey, TreeFormatOptions, VENDOR, VERIFIED_BY, VERSION, type Verifier, type Visitor, add, and, div, edgeLabel, elideAction, envelopeFromBytes, envelopeFromCbor, envelopeToBytes, envelopeToCbor, eq, extractBoolean, extractBytes, extractNull, extractNumber, extractString, flanked, gt, isEnvelopeEncodable, lt, mul, neg, not, or, registerCompressExtension, registerEncryptExtension, sub };
781
+ export { ATTACHMENT, Assertion, Attachments, CBOR_TAG_FUNCTION, CBOR_TAG_PARAMETER, CBOR_TAG_PLACEHOLDER, CBOR_TAG_REPLACEMENT, CONFORMS_TO, Compressed, Digest, DigestProvider, EdgeType, EncryptedMessage, Envelope, EnvelopeCBORTagged, EnvelopeCBORTaggedDecodable, EnvelopeCBORTaggedEncodable, EnvelopeCase, EnvelopeDecoder, EnvelopeEncodable, EnvelopeEncodableValue, EnvelopeError, ErrorCode, Expression, FUNCTION_IDS, Function, FunctionID, HAS_RECIPIENT, IS_A, NOTE, ObscureAction, ObscureType, PARAMETER_IDS, Parameter, ParameterID, PrivateKeyBase, PublicKeyBase, SALT, SIGNED, SealedMessage, Signature, SignatureMetadata, Signer, SigningPrivateKey, SigningPublicKey, SymmetricKey, TreeFormatOptions, VENDOR, VERIFIED_BY, VERSION, Verifier, Visitor, add, and, div, edgeLabel, elideAction, envelopeFromBytes, envelopeFromCbor, envelopeToBytes, envelopeToCbor, eq, extractBoolean, extractBytes, extractNull, extractNumber, extractString, flanked, gt, isEnvelopeEncodable, lt, mul, neg, not, or, registerCompressExtension, registerEncryptExtension, sub };
978
782
  //# sourceMappingURL=index.d.cts.map