@bcts/envelope 1.0.0-alpha.10
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/LICENSE +48 -0
- package/README.md +23 -0
- package/dist/index.cjs +2646 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +782 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +782 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.iife.js +2644 -0
- package/dist/index.iife.js.map +1 -0
- package/dist/index.mjs +2552 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +84 -0
- package/src/base/assertion.ts +179 -0
- package/src/base/assertions.ts +153 -0
- package/src/base/cbor.ts +122 -0
- package/src/base/digest.ts +204 -0
- package/src/base/elide.ts +390 -0
- package/src/base/envelope-decodable.ts +186 -0
- package/src/base/envelope-encodable.ts +71 -0
- package/src/base/envelope.ts +988 -0
- package/src/base/error.ts +421 -0
- package/src/base/index.ts +56 -0
- package/src/base/leaf.ts +147 -0
- package/src/base/queries.ts +244 -0
- package/src/base/walk.ts +215 -0
- package/src/base/wrap.ts +26 -0
- package/src/extension/attachment.ts +280 -0
- package/src/extension/compress.ts +176 -0
- package/src/extension/encrypt.ts +297 -0
- package/src/extension/expression.ts +404 -0
- package/src/extension/index.ts +72 -0
- package/src/extension/proof.ts +227 -0
- package/src/extension/recipient.ts +440 -0
- package/src/extension/salt.ts +114 -0
- package/src/extension/signature.ts +398 -0
- package/src/extension/types.ts +92 -0
- package/src/format/diagnostic.ts +116 -0
- package/src/format/hex.ts +25 -0
- package/src/format/index.ts +13 -0
- package/src/format/tree.ts +168 -0
- package/src/index.ts +32 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/string.ts +48 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import { Cbor, CborMap, CborTagged, CborTaggedDecodable, CborTaggedEncodable, tagsForValues } from "@bcts/dcbor";
|
|
2
|
+
import { KnownValue } from "@bcts/known-values";
|
|
3
|
+
|
|
4
|
+
//#region src/base/digest.d.ts
|
|
5
|
+
declare class Digest {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(data: Uint8Array);
|
|
8
|
+
data(): Uint8Array;
|
|
9
|
+
static fromImage(image: Uint8Array): Digest;
|
|
10
|
+
static fromDigests(digests: Digest[]): Digest;
|
|
11
|
+
hex(): string;
|
|
12
|
+
short(): string;
|
|
13
|
+
static fromHex(hex: string): Digest;
|
|
14
|
+
equals(other: Digest): boolean;
|
|
15
|
+
toString(): string;
|
|
16
|
+
clone(): Digest;
|
|
17
|
+
}
|
|
18
|
+
interface DigestProvider {
|
|
19
|
+
digest(): Digest;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/base/envelope-encodable.d.ts
|
|
23
|
+
interface EnvelopeEncodable {
|
|
24
|
+
intoEnvelope(): Envelope;
|
|
25
|
+
}
|
|
26
|
+
declare function isEnvelopeEncodable(value: unknown): value is EnvelopeEncodable;
|
|
27
|
+
type EnvelopeEncodableValue = EnvelopeEncodable | string | number | boolean | bigint | Uint8Array | null | undefined | Envelope;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/base/assertion.d.ts
|
|
30
|
+
declare class Assertion implements DigestProvider {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(predicate: EnvelopeEncodable | Envelope, object: EnvelopeEncodable | Envelope);
|
|
33
|
+
predicate(): Envelope;
|
|
34
|
+
object(): Envelope;
|
|
35
|
+
digest(): Digest;
|
|
36
|
+
equals(other: Assertion): boolean;
|
|
37
|
+
toCbor(): Cbor;
|
|
38
|
+
static fromCbor(cbor: Cbor): Assertion;
|
|
39
|
+
static fromCborMap(map: CborMap): Assertion;
|
|
40
|
+
toString(): string;
|
|
41
|
+
clone(): Assertion;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/base/elide.d.ts
|
|
45
|
+
declare enum ObscureType {
|
|
46
|
+
Elided = "elided",
|
|
47
|
+
Encrypted = "encrypted",
|
|
48
|
+
Compressed = "compressed",
|
|
49
|
+
}
|
|
50
|
+
type ObscureAction = {
|
|
51
|
+
type: "elide";
|
|
52
|
+
} | {
|
|
53
|
+
type: "encrypt";
|
|
54
|
+
key: unknown;
|
|
55
|
+
} | {
|
|
56
|
+
type: "compress";
|
|
57
|
+
};
|
|
58
|
+
declare function elideAction(): ObscureAction;
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/base/walk.d.ts
|
|
61
|
+
declare enum EdgeType {
|
|
62
|
+
None = "none",
|
|
63
|
+
Subject = "subject",
|
|
64
|
+
Assertion = "assertion",
|
|
65
|
+
Predicate = "predicate",
|
|
66
|
+
Object = "object",
|
|
67
|
+
Content = "content",
|
|
68
|
+
}
|
|
69
|
+
declare function edgeLabel(edgeType: EdgeType): string | undefined;
|
|
70
|
+
type Visitor<State> = (envelope: Envelope, level: number, incomingEdge: EdgeType, state: State) => [State, boolean];
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/extension/types.d.ts
|
|
73
|
+
declare const IS_A = "isA";
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/extension/salt.d.ts
|
|
76
|
+
declare const SALT = "salt";
|
|
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;
|
|
86
|
+
}
|
|
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;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/extension/signature.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Signature Extension for Gordian Envelope
|
|
113
|
+
*
|
|
114
|
+
* Provides functionality for digitally signing Envelopes and verifying signatures,
|
|
115
|
+
* with optional metadata support.
|
|
116
|
+
*
|
|
117
|
+
* The signature extension allows:
|
|
118
|
+
* - Signing envelope subjects to validate their authenticity
|
|
119
|
+
* - Adding metadata to signatures (e.g., signer identity, date, purpose)
|
|
120
|
+
* - Verification of signatures, both with and without metadata
|
|
121
|
+
* - Support for multiple signatures on a single envelope
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* Known value for the 'signed' predicate.
|
|
125
|
+
* This is the standard predicate used for signature assertions.
|
|
126
|
+
*/
|
|
127
|
+
declare const SIGNED = "signed";
|
|
128
|
+
/**
|
|
129
|
+
* Known value for the 'verifiedBy' predicate.
|
|
130
|
+
* Used to indicate verification status.
|
|
131
|
+
*/
|
|
132
|
+
declare const VERIFIED_BY = "verifiedBy";
|
|
133
|
+
/**
|
|
134
|
+
* Known value for the 'note' predicate.
|
|
135
|
+
* Used for adding notes/comments to signatures.
|
|
136
|
+
*/
|
|
137
|
+
declare const NOTE = "note";
|
|
138
|
+
/**
|
|
139
|
+
* Represents a cryptographic signature.
|
|
140
|
+
*/
|
|
141
|
+
declare class Signature {
|
|
142
|
+
#private;
|
|
143
|
+
constructor(data: Uint8Array);
|
|
144
|
+
/**
|
|
145
|
+
* Returns the raw signature bytes.
|
|
146
|
+
*/
|
|
147
|
+
data(): Uint8Array;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the hex-encoded signature.
|
|
150
|
+
*/
|
|
151
|
+
hex(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Creates a Signature from hex string.
|
|
154
|
+
*/
|
|
155
|
+
static fromHex(hex: string): Signature;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Interface for types that can sign data.
|
|
159
|
+
*/
|
|
160
|
+
interface Signer {
|
|
161
|
+
/**
|
|
162
|
+
* Signs the provided data and returns a Signature.
|
|
163
|
+
*/
|
|
164
|
+
sign(data: Uint8Array): Signature;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Interface for types that can verify signatures.
|
|
168
|
+
*/
|
|
169
|
+
interface Verifier {
|
|
170
|
+
/**
|
|
171
|
+
* Verifies a signature against the provided data.
|
|
172
|
+
* Returns true if the signature is valid.
|
|
173
|
+
*/
|
|
174
|
+
verify(data: Uint8Array, signature: Signature): boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* ECDSA signing key using secp256k1 curve.
|
|
178
|
+
* Uses @bcts/crypto functions.
|
|
179
|
+
*/
|
|
180
|
+
declare class SigningPrivateKey implements Signer {
|
|
181
|
+
#private;
|
|
182
|
+
constructor(privateKey: Uint8Array);
|
|
183
|
+
/**
|
|
184
|
+
* Generates a new random private key.
|
|
185
|
+
*/
|
|
186
|
+
static generate(): SigningPrivateKey;
|
|
187
|
+
/**
|
|
188
|
+
* Creates a private key from hex string.
|
|
189
|
+
*/
|
|
190
|
+
static fromHex(hex: string): SigningPrivateKey;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the corresponding public key.
|
|
193
|
+
*/
|
|
194
|
+
publicKey(): SigningPublicKey;
|
|
195
|
+
/**
|
|
196
|
+
* Signs data and returns a Signature.
|
|
197
|
+
*/
|
|
198
|
+
sign(data: Uint8Array): Signature;
|
|
199
|
+
/**
|
|
200
|
+
* Returns the raw private key bytes.
|
|
201
|
+
*/
|
|
202
|
+
data(): Uint8Array;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* ECDSA public key for signature verification using secp256k1 curve.
|
|
206
|
+
* Uses @bcts/crypto functions.
|
|
207
|
+
*/
|
|
208
|
+
declare class SigningPublicKey implements Verifier {
|
|
209
|
+
#private;
|
|
210
|
+
constructor(publicKey: Uint8Array);
|
|
211
|
+
/**
|
|
212
|
+
* Creates a public key from hex string.
|
|
213
|
+
*/
|
|
214
|
+
static fromHex(hex: string): SigningPublicKey;
|
|
215
|
+
/**
|
|
216
|
+
* Verifies a signature against the provided data.
|
|
217
|
+
*/
|
|
218
|
+
verify(data: Uint8Array, signature: Signature): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Returns the raw public key bytes.
|
|
221
|
+
*/
|
|
222
|
+
data(): Uint8Array;
|
|
223
|
+
/**
|
|
224
|
+
* Returns the hex-encoded public key.
|
|
225
|
+
*/
|
|
226
|
+
hex(): string;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Metadata that can be attached to a signature.
|
|
230
|
+
*/
|
|
231
|
+
declare class SignatureMetadata {
|
|
232
|
+
#private;
|
|
233
|
+
/**
|
|
234
|
+
* Adds an assertion to the metadata.
|
|
235
|
+
*/
|
|
236
|
+
withAssertion(predicate: string, object: unknown): SignatureMetadata;
|
|
237
|
+
/**
|
|
238
|
+
* Returns all assertions in the metadata.
|
|
239
|
+
*/
|
|
240
|
+
assertions(): [string, unknown][];
|
|
241
|
+
/**
|
|
242
|
+
* Returns true if this metadata has any assertions.
|
|
243
|
+
*/
|
|
244
|
+
hasAssertions(): boolean;
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/extension/attachment.d.ts
|
|
248
|
+
/**
|
|
249
|
+
* Known value for the 'attachment' predicate.
|
|
250
|
+
*/
|
|
251
|
+
declare const ATTACHMENT = "attachment";
|
|
252
|
+
/**
|
|
253
|
+
* Known value for the 'vendor' predicate.
|
|
254
|
+
*/
|
|
255
|
+
declare const VENDOR = "vendor";
|
|
256
|
+
/**
|
|
257
|
+
* Known value for the 'conformsTo' predicate.
|
|
258
|
+
*/
|
|
259
|
+
declare const CONFORMS_TO = "conformsTo";
|
|
260
|
+
/**
|
|
261
|
+
* A container for vendor-specific metadata attachments.
|
|
262
|
+
*
|
|
263
|
+
* Attachments provides a flexible mechanism for attaching arbitrary metadata
|
|
264
|
+
* to envelopes without modifying their core structure.
|
|
265
|
+
*/
|
|
266
|
+
declare class Attachments {
|
|
267
|
+
#private;
|
|
268
|
+
/**
|
|
269
|
+
* Creates a new empty attachments container.
|
|
270
|
+
*/
|
|
271
|
+
constructor();
|
|
272
|
+
/**
|
|
273
|
+
* Adds a new attachment with the specified payload and metadata.
|
|
274
|
+
*
|
|
275
|
+
* @param payload - The data to attach
|
|
276
|
+
* @param vendor - A string identifying the entity that defined the attachment format
|
|
277
|
+
* @param conformsTo - Optional URI identifying the structure the payload conforms to
|
|
278
|
+
*/
|
|
279
|
+
add(payload: EnvelopeEncodableValue, vendor: string, conformsTo?: string): void;
|
|
280
|
+
/**
|
|
281
|
+
* Retrieves an attachment by its digest.
|
|
282
|
+
*
|
|
283
|
+
* @param digest - The unique digest of the attachment to retrieve
|
|
284
|
+
* @returns The envelope if found, or undefined
|
|
285
|
+
*/
|
|
286
|
+
get(digest: Digest): Envelope | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* Removes an attachment by its digest.
|
|
289
|
+
*
|
|
290
|
+
* @param digest - The unique digest of the attachment to remove
|
|
291
|
+
* @returns The removed envelope if found, or undefined
|
|
292
|
+
*/
|
|
293
|
+
remove(digest: Digest): Envelope | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* Removes all attachments from the container.
|
|
296
|
+
*/
|
|
297
|
+
clear(): void;
|
|
298
|
+
/**
|
|
299
|
+
* Returns whether the container has any attachments.
|
|
300
|
+
*/
|
|
301
|
+
isEmpty(): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Adds all attachments from this container to an envelope.
|
|
304
|
+
*
|
|
305
|
+
* @param envelope - The envelope to add attachments to
|
|
306
|
+
* @returns A new envelope with all attachments added as assertions
|
|
307
|
+
*/
|
|
308
|
+
addToEnvelope(envelope: Envelope): Envelope;
|
|
309
|
+
/**
|
|
310
|
+
* Creates an Attachments container from an envelope's attachment assertions.
|
|
311
|
+
*
|
|
312
|
+
* @param envelope - The envelope to extract attachments from
|
|
313
|
+
* @returns A new Attachments container with the envelope's attachments
|
|
314
|
+
*/
|
|
315
|
+
static fromEnvelope(envelope: Envelope): Attachments;
|
|
316
|
+
}
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/extension/recipient.d.ts
|
|
319
|
+
declare const HAS_RECIPIENT = "hasRecipient";
|
|
320
|
+
declare class PublicKeyBase {
|
|
321
|
+
#private;
|
|
322
|
+
constructor(publicKey: Uint8Array);
|
|
323
|
+
data(): Uint8Array;
|
|
324
|
+
hex(): string;
|
|
325
|
+
static fromHex(hex: string): PublicKeyBase;
|
|
326
|
+
}
|
|
327
|
+
declare class PrivateKeyBase {
|
|
328
|
+
#private;
|
|
329
|
+
private constructor();
|
|
330
|
+
static generate(): PrivateKeyBase;
|
|
331
|
+
static fromBytes(privateKey: Uint8Array, publicKey: Uint8Array): PrivateKeyBase;
|
|
332
|
+
static fromHex(privateHex: string, publicHex: string): PrivateKeyBase;
|
|
333
|
+
publicKeys(): PublicKeyBase;
|
|
334
|
+
data(): Uint8Array;
|
|
335
|
+
hex(): string;
|
|
336
|
+
unseal(sealedMessage: SealedMessage): SymmetricKey;
|
|
337
|
+
}
|
|
338
|
+
declare class SealedMessage {
|
|
339
|
+
#private;
|
|
340
|
+
constructor(data: Uint8Array);
|
|
341
|
+
static seal(contentKey: SymmetricKey, recipientPublicKey: PublicKeyBase): SealedMessage;
|
|
342
|
+
decrypt(recipientPrivate: Uint8Array, _recipientPublic: Uint8Array): Uint8Array;
|
|
343
|
+
data(): Uint8Array;
|
|
344
|
+
hex(): string;
|
|
345
|
+
static fromHex(hex: string): SealedMessage;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/extension/expression.d.ts
|
|
349
|
+
declare const CBOR_TAG_FUNCTION = 40006;
|
|
350
|
+
declare const CBOR_TAG_PARAMETER = 40007;
|
|
351
|
+
declare const CBOR_TAG_PLACEHOLDER = 40008;
|
|
352
|
+
declare const CBOR_TAG_REPLACEMENT = 40009;
|
|
353
|
+
declare const FUNCTION_IDS: {
|
|
354
|
+
readonly ADD: 1;
|
|
355
|
+
readonly SUB: 2;
|
|
356
|
+
readonly MUL: 3;
|
|
357
|
+
readonly DIV: 4;
|
|
358
|
+
readonly NEG: 5;
|
|
359
|
+
readonly LT: 6;
|
|
360
|
+
readonly LE: 7;
|
|
361
|
+
readonly GT: 8;
|
|
362
|
+
readonly GE: 9;
|
|
363
|
+
readonly EQ: 10;
|
|
364
|
+
readonly NE: 11;
|
|
365
|
+
readonly AND: 12;
|
|
366
|
+
readonly OR: 13;
|
|
367
|
+
readonly XOR: 14;
|
|
368
|
+
readonly NOT: 15;
|
|
369
|
+
};
|
|
370
|
+
declare const PARAMETER_IDS: {
|
|
371
|
+
readonly BLANK: 1;
|
|
372
|
+
readonly LHS: 2;
|
|
373
|
+
readonly RHS: 3;
|
|
374
|
+
};
|
|
375
|
+
type FunctionID = number | string;
|
|
376
|
+
type ParameterID = number | string;
|
|
377
|
+
declare class Function {
|
|
378
|
+
#private;
|
|
379
|
+
constructor(id: FunctionID);
|
|
380
|
+
id(): FunctionID;
|
|
381
|
+
isNumeric(): boolean;
|
|
382
|
+
isString(): boolean;
|
|
383
|
+
envelope(): Envelope;
|
|
384
|
+
withParameter(param: ParameterID, value: EnvelopeEncodableValue): Expression;
|
|
385
|
+
static fromNumeric(id: number): Function;
|
|
386
|
+
static fromString(name: string): Function;
|
|
387
|
+
toString(): string;
|
|
388
|
+
}
|
|
389
|
+
declare class Parameter {
|
|
390
|
+
#private;
|
|
391
|
+
constructor(id: ParameterID, value: Envelope);
|
|
392
|
+
id(): ParameterID;
|
|
393
|
+
value(): Envelope;
|
|
394
|
+
isNumeric(): boolean;
|
|
395
|
+
isString(): boolean;
|
|
396
|
+
envelope(): Envelope;
|
|
397
|
+
static blank(value: EnvelopeEncodableValue): Parameter;
|
|
398
|
+
static lhs(value: EnvelopeEncodableValue): Parameter;
|
|
399
|
+
static rhs(value: EnvelopeEncodableValue): Parameter;
|
|
400
|
+
toString(): string;
|
|
401
|
+
}
|
|
402
|
+
declare class Expression {
|
|
403
|
+
#private;
|
|
404
|
+
constructor(func: Function);
|
|
405
|
+
function(): Function;
|
|
406
|
+
parameters(): Parameter[];
|
|
407
|
+
withParameter(param: ParameterID, value: EnvelopeEncodableValue): Expression;
|
|
408
|
+
withParameters(params: Record<string, EnvelopeEncodableValue>): Expression;
|
|
409
|
+
getParameter(param: ParameterID): Envelope | undefined;
|
|
410
|
+
hasParameter(param: ParameterID): boolean;
|
|
411
|
+
envelope(): Envelope;
|
|
412
|
+
static fromEnvelope(envelope: Envelope): Expression;
|
|
413
|
+
toString(): string;
|
|
414
|
+
}
|
|
415
|
+
declare function add(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
416
|
+
declare function sub(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
417
|
+
declare function mul(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
418
|
+
declare function div(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
419
|
+
declare function neg(value: EnvelopeEncodableValue): Expression;
|
|
420
|
+
declare function lt(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
421
|
+
declare function gt(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
422
|
+
declare function eq(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
423
|
+
declare function and(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
424
|
+
declare function or(lhs: EnvelopeEncodableValue, rhs: EnvelopeEncodableValue): Expression;
|
|
425
|
+
declare function not(value: EnvelopeEncodableValue): Expression;
|
|
426
|
+
//#endregion
|
|
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;
|
|
731
|
+
}
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region src/format/tree.d.ts
|
|
734
|
+
interface TreeFormatOptions {
|
|
735
|
+
hideNodes?: boolean;
|
|
736
|
+
highlightDigests?: Set<string>;
|
|
737
|
+
digestDisplay?: "short" | "full";
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/utils/string.d.ts
|
|
741
|
+
/**
|
|
742
|
+
* String utility functions used throughout the envelope library.
|
|
743
|
+
*
|
|
744
|
+
* Provides helper methods for string formatting and manipulation.
|
|
745
|
+
*/
|
|
746
|
+
/**
|
|
747
|
+
* Flanks a string with specified left and right delimiters.
|
|
748
|
+
*
|
|
749
|
+
* @param str - The string to flank
|
|
750
|
+
* @param left - The left delimiter
|
|
751
|
+
* @param right - The right delimiter
|
|
752
|
+
* @returns The flanked string
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```typescript
|
|
756
|
+
* flanked('hello', '"', '"') // Returns: "hello"
|
|
757
|
+
* flanked('name', "'", "'") // Returns: 'name'
|
|
758
|
+
* flanked('item', '[', ']') // Returns: [item]
|
|
759
|
+
* ```
|
|
760
|
+
*/
|
|
761
|
+
declare function flanked(str: string, left: string, right: string): string;
|
|
762
|
+
/**
|
|
763
|
+
* Extension methods for String objects to support fluent API style.
|
|
764
|
+
*/
|
|
765
|
+
declare global {
|
|
766
|
+
interface String {
|
|
767
|
+
/**
|
|
768
|
+
* Flanks this string with specified left and right delimiters.
|
|
769
|
+
*
|
|
770
|
+
* @param left - The left delimiter
|
|
771
|
+
* @param right - The right delimiter
|
|
772
|
+
* @returns The flanked string
|
|
773
|
+
*/
|
|
774
|
+
flankedBy(left: string, right: string): string;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
//#endregion
|
|
778
|
+
//#region src/index.d.ts
|
|
779
|
+
declare const VERSION = "0.37.0";
|
|
780
|
+
//#endregion
|
|
781
|
+
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, 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 };
|
|
782
|
+
//# sourceMappingURL=index.d.mts.map
|