@bcts/envelope 1.0.0-alpha.20 → 1.0.0-alpha.22

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.
Files changed (55) hide show
  1. package/LICENSE +2 -1
  2. package/dist/index.cjs +142 -0
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +37 -2
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +37 -2
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.iife.js +142 -0
  9. package/dist/index.iife.js.map +1 -1
  10. package/dist/index.mjs +142 -0
  11. package/dist/index.mjs.map +1 -1
  12. package/package.json +16 -27
  13. package/src/base/assertion.ts +6 -0
  14. package/src/base/assertions.ts +6 -0
  15. package/src/base/cbor.ts +6 -0
  16. package/src/base/digest.ts +4 -0
  17. package/src/base/elide.ts +6 -0
  18. package/src/base/envelope-decodable.ts +6 -0
  19. package/src/base/envelope-encodable.ts +6 -0
  20. package/src/base/envelope.ts +6 -0
  21. package/src/base/error.ts +6 -0
  22. package/src/base/index.ts +6 -0
  23. package/src/base/leaf.ts +6 -0
  24. package/src/base/queries.ts +6 -0
  25. package/src/base/ur.ts +6 -0
  26. package/src/base/walk.ts +6 -0
  27. package/src/base/wrap.ts +6 -0
  28. package/src/extension/attachment.ts +4 -0
  29. package/src/extension/compress.ts +6 -0
  30. package/src/extension/edge.ts +4 -0
  31. package/src/extension/encrypt.ts +6 -0
  32. package/src/extension/event.ts +4 -0
  33. package/src/extension/expression.ts +6 -0
  34. package/src/extension/index.ts +6 -0
  35. package/src/extension/proof.ts +6 -0
  36. package/src/extension/recipient.ts +4 -0
  37. package/src/extension/request.ts +4 -0
  38. package/src/extension/response.ts +4 -0
  39. package/src/extension/salt.ts +6 -0
  40. package/src/extension/secret.ts +6 -0
  41. package/src/extension/signature.ts +4 -0
  42. package/src/extension/sskr.ts +6 -0
  43. package/src/extension/types.ts +6 -0
  44. package/src/format/diagnostic.ts +6 -0
  45. package/src/format/envelope-summary.ts +6 -0
  46. package/src/format/format-context.ts +6 -0
  47. package/src/format/hex.ts +6 -0
  48. package/src/format/index.ts +6 -0
  49. package/src/format/mermaid.ts +6 -0
  50. package/src/format/notation.ts +6 -0
  51. package/src/format/tree.ts +6 -0
  52. package/src/index.ts +6 -0
  53. package/src/seal.ts +6 -0
  54. package/src/utils/index.ts +4 -0
  55. package/src/utils/string.ts +4 -0
package/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  Copyright © 2023-2026 Blockchain Commons, LLC
2
- Copyright © 2025-2026 Leonardo Amoroso Custodio
2
+ Copyright © 2025-2026 Parity Technologies
3
+
3
4
 
4
5
  Redistribution and use in source and binary forms, with or without modification,
5
6
  are permitted provided that the following conditions are met:
package/dist/index.cjs CHANGED
@@ -43,6 +43,11 @@ _bcts_components.Digest.prototype.short = function() {
43
43
 
44
44
  //#endregion
45
45
  //#region src/base/error.ts
46
+ /**
47
+ * Copyright © 2023-2026 Blockchain Commons, LLC
48
+ * Copyright © 2025-2026 Parity Technologies
49
+ *
50
+ */
46
51
  let ErrorCode = /* @__PURE__ */ function(ErrorCode) {
47
52
  ErrorCode["ALREADY_ELIDED"] = "ALREADY_ELIDED";
48
53
  ErrorCode["AMBIGUOUS_PREDICATE"] = "AMBIGUOUS_PREDICATE";
@@ -238,6 +243,11 @@ var EnvelopeError = class EnvelopeError extends Error {
238
243
 
239
244
  //#endregion
240
245
  //#region src/base/assertion.ts
246
+ /**
247
+ * Copyright © 2023-2026 Blockchain Commons, LLC
248
+ * Copyright © 2025-2026 Parity Technologies
249
+ *
250
+ */
241
251
  var Assertion = class Assertion {
242
252
  _predicate;
243
253
  _object;
@@ -285,6 +295,11 @@ var Assertion = class Assertion {
285
295
 
286
296
  //#endregion
287
297
  //#region src/extension/compress.ts
298
+ /**
299
+ * Copyright © 2023-2026 Blockchain Commons, LLC
300
+ * Copyright © 2025-2026 Parity Technologies
301
+ *
302
+ */
288
303
  var Compressed = class Compressed {
289
304
  _compressedData;
290
305
  _digest;
@@ -352,6 +367,11 @@ function registerCompressExtension() {
352
367
  //#endregion
353
368
  //#region src/extension/encrypt.ts
354
369
  /**
370
+ * Copyright © 2023-2026 Blockchain Commons, LLC
371
+ * Copyright © 2025-2026 Parity Technologies
372
+ *
373
+ */
374
+ /**
355
375
  * Encrypts plaintext with a symmetric key using the given digest as AAD.
356
376
  * This is an envelope-specific helper function that returns an envelope EncryptedMessage.
357
377
  */
@@ -465,6 +485,11 @@ function encryptWholeEnvelope(envelope, key) {
465
485
 
466
486
  //#endregion
467
487
  //#region src/base/envelope.ts
488
+ /**
489
+ * Copyright © 2023-2026 Blockchain Commons, LLC
490
+ * Copyright © 2025-2026 Parity Technologies
491
+ *
492
+ */
468
493
  const TAG_ENVELOPE$1 = _bcts_components.ENVELOPE.value;
469
494
  const TAG_LEAF = _bcts_components.LEAF.value;
470
495
  const TAG_ENCRYPTED = _bcts_components.ENCRYPTED.value;
@@ -1145,6 +1170,11 @@ Envelope.prototype.isIdenticalTo = function(other) {
1145
1170
 
1146
1171
  //#endregion
1147
1172
  //#region src/base/walk.ts
1173
+ /**
1174
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1175
+ * Copyright © 2025-2026 Parity Technologies
1176
+ *
1177
+ */
1148
1178
  let EdgeType = /* @__PURE__ */ function(EdgeType) {
1149
1179
  EdgeType["None"] = "none";
1150
1180
  EdgeType["Subject"] = "subject";
@@ -1261,6 +1291,11 @@ Envelope.prototype.checkTypeValue = function(type) {
1261
1291
 
1262
1292
  //#endregion
1263
1293
  //#region src/base/assertions.ts
1294
+ /**
1295
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1296
+ * Copyright © 2025-2026 Parity Technologies
1297
+ *
1298
+ */
1264
1299
  Envelope.prototype.addAssertionEnvelopes = function(assertions) {
1265
1300
  return assertions.reduce((result, assertion) => result.addAssertionEnvelope(assertion), this);
1266
1301
  };
@@ -1424,6 +1459,11 @@ Envelope.prototype.checkSubjectUnit = function() {
1424
1459
 
1425
1460
  //#endregion
1426
1461
  //#region src/base/queries.ts
1462
+ /**
1463
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1464
+ * Copyright © 2025-2026 Parity Technologies
1465
+ *
1466
+ */
1427
1467
  Envelope.prototype.hasAssertions = function() {
1428
1468
  const c = this.case();
1429
1469
  return c.type === "node" && c.assertions.length > 0;
@@ -1571,6 +1611,11 @@ Envelope.prototype.removePosition = function() {
1571
1611
 
1572
1612
  //#endregion
1573
1613
  //#region src/base/wrap.ts
1614
+ /**
1615
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1616
+ * Copyright © 2025-2026 Parity Technologies
1617
+ *
1618
+ */
1574
1619
  Envelope.prototype.wrap = function() {
1575
1620
  return Envelope.newWrapped(this);
1576
1621
  };
@@ -1585,6 +1630,11 @@ Envelope.prototype.unwrap = function() {
1585
1630
 
1586
1631
  //#endregion
1587
1632
  //#region src/base/ur.ts
1633
+ /**
1634
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1635
+ * Copyright © 2025-2026 Parity Technologies
1636
+ *
1637
+ */
1588
1638
  Envelope.prototype.urString = function() {
1589
1639
  return _bcts_uniform_resources.UR.new("envelope", this.untaggedCbor()).string();
1590
1640
  };
@@ -1606,6 +1656,11 @@ Envelope.fromUR = function(ur) {
1606
1656
 
1607
1657
  //#endregion
1608
1658
  //#region src/extension/types.ts
1659
+ /**
1660
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1661
+ * Copyright © 2025-2026 Parity Technologies
1662
+ *
1663
+ */
1609
1664
  if (Envelope?.prototype) {
1610
1665
  Envelope.prototype.addType = function(object) {
1611
1666
  return this.addAssertion(_bcts_known_values.IS_A, object);
@@ -1630,6 +1685,11 @@ if (Envelope?.prototype) {
1630
1685
 
1631
1686
  //#endregion
1632
1687
  //#region src/extension/salt.ts
1688
+ /**
1689
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1690
+ * Copyright © 2025-2026 Parity Technologies
1691
+ *
1692
+ */
1633
1693
  const SALT = _bcts_known_values.SALT;
1634
1694
  const MIN_SALT_SIZE = 8;
1635
1695
  function createSecureRng() {
@@ -1699,6 +1759,10 @@ if (Envelope?.prototype) {
1699
1759
  //#endregion
1700
1760
  //#region src/extension/signature.ts
1701
1761
  /**
1762
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1763
+ * Copyright © 2025-2026 Parity Technologies
1764
+ *
1765
+ *
1702
1766
  * Signature Extension for Gordian Envelope
1703
1767
  *
1704
1768
  * Provides functionality for digitally signing Envelopes and verifying signatures,
@@ -1896,6 +1960,10 @@ Envelope.prototype.verifyReturningMetadata = function(verifier) {
1896
1960
  //#endregion
1897
1961
  //#region src/extension/attachment.ts
1898
1962
  /**
1963
+ * Copyright © 2023-2026 Blockchain Commons, LLC
1964
+ * Copyright © 2025-2026 Parity Technologies
1965
+ *
1966
+ *
1899
1967
  * Attachment Extension for Gordian Envelope
1900
1968
  *
1901
1969
  * Provides functionality for attaching vendor-specific metadata to envelopes.
@@ -2147,6 +2215,10 @@ if (Envelope?.prototype) {
2147
2215
  //#endregion
2148
2216
  //#region src/extension/edge.ts
2149
2217
  /**
2218
+ * Copyright © 2023-2026 Blockchain Commons, LLC
2219
+ * Copyright © 2025-2026 Parity Technologies
2220
+ *
2221
+ *
2150
2222
  * Edge Extension for Gordian Envelope (BCR-2026-003)
2151
2223
  *
2152
2224
  * Provides functionality for creating and managing edge envelopes that
@@ -2402,6 +2474,10 @@ Envelope.prototype.edgesMatching = function(isA, source, target, subject) {
2402
2474
  //#endregion
2403
2475
  //#region src/extension/recipient.ts
2404
2476
  /**
2477
+ * Copyright © 2023-2026 Blockchain Commons, LLC
2478
+ * Copyright © 2025-2026 Parity Technologies
2479
+ *
2480
+ *
2405
2481
  * Public key encryption extension for Gordian Envelope.
2406
2482
  *
2407
2483
  * This module implements public key encryption for Gordian Envelope, allowing
@@ -2626,6 +2702,11 @@ if (Envelope?.prototype) {
2626
2702
 
2627
2703
  //#endregion
2628
2704
  //#region src/extension/expression.ts
2705
+ /**
2706
+ * Copyright © 2023-2026 Blockchain Commons, LLC
2707
+ * Copyright © 2025-2026 Parity Technologies
2708
+ *
2709
+ */
2629
2710
  const CBOR_TAG_FUNCTION = 40006;
2630
2711
  const CBOR_TAG_PARAMETER = 40007;
2631
2712
  const CBOR_TAG_PLACEHOLDER = 40008;
@@ -3083,6 +3164,11 @@ function not(value) {
3083
3164
 
3084
3165
  //#endregion
3085
3166
  //#region src/extension/proof.ts
3167
+ /**
3168
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3169
+ * Copyright © 2025-2026 Parity Technologies
3170
+ *
3171
+ */
3086
3172
  if (Envelope?.prototype) {
3087
3173
  Envelope.prototype.proofContainsSet = function(target) {
3088
3174
  const revealSet = revealSetOfSet(this, target);
@@ -3166,6 +3252,11 @@ function registerProofExtension() {}
3166
3252
 
3167
3253
  //#endregion
3168
3254
  //#region src/extension/secret.ts
3255
+ /**
3256
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3257
+ * Copyright © 2025-2026 Parity Technologies
3258
+ *
3259
+ */
3169
3260
  Envelope.prototype.lockSubject = function(method, secret) {
3170
3261
  const contentKey = _bcts_components.SymmetricKey.new();
3171
3262
  const componentsKey = _bcts_components.SymmetricKey.fromData(contentKey.data());
@@ -3229,6 +3320,11 @@ const registerSecretExtension = () => {};
3229
3320
 
3230
3321
  //#endregion
3231
3322
  //#region src/extension/sskr.ts
3323
+ /**
3324
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3325
+ * Copyright © 2025-2026 Parity Technologies
3326
+ *
3327
+ */
3232
3328
  const addSskrShare = (envelope, share) => {
3233
3329
  return envelope.addAssertion(_bcts_known_values.SSKR_SHARE, share);
3234
3330
  };
@@ -3300,6 +3396,10 @@ const registerSskrExtension = () => {};
3300
3396
  //#endregion
3301
3397
  //#region src/extension/request.ts
3302
3398
  /**
3399
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3400
+ * Copyright © 2025-2026 Parity Technologies
3401
+ *
3402
+ *
3303
3403
  * Request type for distributed function calls.
3304
3404
  *
3305
3405
  * Ported from bc-envelope-rust/src/extension/expressions/request.rs
@@ -3464,6 +3564,10 @@ var Request = class Request {
3464
3564
  //#endregion
3465
3565
  //#region src/extension/response.ts
3466
3566
  /**
3567
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3568
+ * Copyright © 2025-2026 Parity Technologies
3569
+ *
3570
+ *
3467
3571
  * Response type for distributed function calls.
3468
3572
  *
3469
3573
  * Ported from bc-envelope-rust/src/extension/expressions/response.rs
@@ -3714,6 +3818,10 @@ var Response = class Response {
3714
3818
  //#endregion
3715
3819
  //#region src/extension/event.ts
3716
3820
  /**
3821
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3822
+ * Copyright © 2025-2026 Parity Technologies
3823
+ *
3824
+ *
3717
3825
  * Event type for notifications and messages.
3718
3826
  *
3719
3827
  * Ported from bc-envelope-rust/src/extension/expressions/event.rs
@@ -3870,6 +3978,11 @@ var Event = class Event {
3870
3978
  //#endregion
3871
3979
  //#region src/format/tree.ts
3872
3980
  /**
3981
+ * Copyright © 2023-2026 Blockchain Commons, LLC
3982
+ * Copyright © 2025-2026 Parity Technologies
3983
+ *
3984
+ */
3985
+ /**
3873
3986
  * Specifies the format for displaying envelope digests in tree output.
3874
3987
  *
3875
3988
  * Ported from bc-envelope-rust/src/format/tree/format/digest.rs
@@ -3960,6 +4073,11 @@ Envelope.prototype.treeFormat = function(options = {}) {
3960
4073
 
3961
4074
  //#endregion
3962
4075
  //#region src/format/format-context.ts
4076
+ /**
4077
+ * Copyright © 2023-2026 Blockchain Commons, LLC
4078
+ * Copyright © 2025-2026 Parity Technologies
4079
+ *
4080
+ */
3963
4081
  const formatContextNone = () => ({ type: "none" });
3964
4082
  const formatContextGlobal = () => ({ type: "global" });
3965
4083
  const formatContextCustom = (context) => ({
@@ -4586,6 +4704,11 @@ Envelope.prototype.formatFlat = function() {
4586
4704
 
4587
4705
  //#endregion
4588
4706
  //#region src/format/mermaid.ts
4707
+ /**
4708
+ * Copyright © 2023-2026 Blockchain Commons, LLC
4709
+ * Copyright © 2025-2026 Parity Technologies
4710
+ *
4711
+ */
4589
4712
  let MermaidOrientation = /* @__PURE__ */ function(MermaidOrientation) {
4590
4713
  MermaidOrientation["LeftToRight"] = "LR";
4591
4714
  MermaidOrientation["TopToBottom"] = "TB";
@@ -4740,6 +4863,11 @@ const registerMermaidExtension = () => {};
4740
4863
 
4741
4864
  //#endregion
4742
4865
  //#region src/format/hex.ts
4866
+ /**
4867
+ * Copyright © 2023-2026 Blockchain Commons, LLC
4868
+ * Copyright © 2025-2026 Parity Technologies
4869
+ *
4870
+ */
4743
4871
  Envelope.prototype.hex = function() {
4744
4872
  const bytes = this.cborBytes();
4745
4873
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
@@ -4750,6 +4878,11 @@ Envelope.prototype.cborBytes = function() {
4750
4878
 
4751
4879
  //#endregion
4752
4880
  //#region src/format/diagnostic.ts
4881
+ /**
4882
+ * Copyright © 2023-2026 Blockchain Commons, LLC
4883
+ * Copyright © 2025-2026 Parity Technologies
4884
+ *
4885
+ */
4753
4886
  function cborToDiagnostic(cbor, indent = 0) {
4754
4887
  if (typeof cbor === "object" && cbor !== null && "tag" in cbor && "value" in cbor) {
4755
4888
  const tagged = cbor;
@@ -4807,6 +4940,11 @@ Envelope.prototype.diagnostic = function() {
4807
4940
 
4808
4941
  //#endregion
4809
4942
  //#region src/seal.ts
4943
+ /**
4944
+ * Copyright © 2023-2026 Blockchain Commons, LLC
4945
+ * Copyright © 2025-2026 Parity Technologies
4946
+ *
4947
+ */
4810
4948
  Envelope.prototype.encryptToRecipient = function(recipient) {
4811
4949
  return this.wrap().encryptSubjectToRecipient(recipient);
4812
4950
  };
@@ -4821,6 +4959,10 @@ const registerSealExtension = () => {};
4821
4959
  //#endregion
4822
4960
  //#region src/utils/string.ts
4823
4961
  /**
4962
+ * Copyright © 2023-2026 Blockchain Commons, LLC
4963
+ * Copyright © 2025-2026 Parity Technologies
4964
+ *
4965
+ *
4824
4966
  * String utility functions used throughout the envelope library.
4825
4967
  *
4826
4968
  * Provides helper methods for string formatting and manipulation.