@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.
Files changed (44) hide show
  1. package/LICENSE +48 -0
  2. package/README.md +23 -0
  3. package/dist/index.cjs +2646 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +782 -0
  6. package/dist/index.d.cts.map +1 -0
  7. package/dist/index.d.mts +782 -0
  8. package/dist/index.d.mts.map +1 -0
  9. package/dist/index.iife.js +2644 -0
  10. package/dist/index.iife.js.map +1 -0
  11. package/dist/index.mjs +2552 -0
  12. package/dist/index.mjs.map +1 -0
  13. package/package.json +84 -0
  14. package/src/base/assertion.ts +179 -0
  15. package/src/base/assertions.ts +153 -0
  16. package/src/base/cbor.ts +122 -0
  17. package/src/base/digest.ts +204 -0
  18. package/src/base/elide.ts +390 -0
  19. package/src/base/envelope-decodable.ts +186 -0
  20. package/src/base/envelope-encodable.ts +71 -0
  21. package/src/base/envelope.ts +988 -0
  22. package/src/base/error.ts +421 -0
  23. package/src/base/index.ts +56 -0
  24. package/src/base/leaf.ts +147 -0
  25. package/src/base/queries.ts +244 -0
  26. package/src/base/walk.ts +215 -0
  27. package/src/base/wrap.ts +26 -0
  28. package/src/extension/attachment.ts +280 -0
  29. package/src/extension/compress.ts +176 -0
  30. package/src/extension/encrypt.ts +297 -0
  31. package/src/extension/expression.ts +404 -0
  32. package/src/extension/index.ts +72 -0
  33. package/src/extension/proof.ts +227 -0
  34. package/src/extension/recipient.ts +440 -0
  35. package/src/extension/salt.ts +114 -0
  36. package/src/extension/signature.ts +398 -0
  37. package/src/extension/types.ts +92 -0
  38. package/src/format/diagnostic.ts +116 -0
  39. package/src/format/hex.ts +25 -0
  40. package/src/format/index.ts +13 -0
  41. package/src/format/tree.ts +168 -0
  42. package/src/index.ts +32 -0
  43. package/src/utils/index.ts +8 -0
  44. package/src/utils/string.ts +48 -0
package/LICENSE ADDED
@@ -0,0 +1,48 @@
1
+ Copyright © 2023 Blockchain Commons, LLC
2
+ Copyright © 2025 Leonardo Amoroso Custodio
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ Subject to the terms and conditions of this license, each copyright holder and
15
+ contributor hereby grants to those receiving rights under this license a
16
+ perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
17
+ (except for failure to satisfy the conditions of this license) patent license to
18
+ make, have made, use, offer to sell, sell, import, and otherwise transfer this
19
+ software, where such license applies only to those patent claims, already
20
+ acquired or hereafter acquired, licensable by such copyright holder or
21
+ contributor that are necessarily infringed by:
22
+
23
+ (a) their Contribution(s) (the licensed copyrights of copyright holders and
24
+ non-copyrightable additions of contributors, in source or binary form)
25
+ alone; or
26
+
27
+ (b) combination of their Contribution(s) with the work of authorship to
28
+ which such Contribution(s) was added by such copyright holder or
29
+ contributor, if, at the time the Contribution is added, such addition causes
30
+ such combination to be necessarily infringed. The patent license shall not
31
+ apply to any other combinations which include the Contribution.
32
+
33
+ Except as expressly stated above, no rights or licenses from any copyright
34
+ holder or contributor is granted under this license, whether expressly, by
35
+ implication, estoppel or otherwise.
36
+
37
+ DISCLAIMER
38
+
39
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
40
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
43
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
47
+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
48
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Blockchain Commons Gordian Envelope for TypeScript
2
+
3
+ > Disclaimer: This package is under active development and APIs may change.
4
+
5
+ ## Introduction
6
+
7
+ [Gordian Envelope](https://www.blockchaincommons.com/introduction/Envelope-Intro/) is a structured format for hierarchical binary data focused on privacy. The TypeScript implementation provides a feature-rich reference implementation.
8
+
9
+ Envelopes are designed to facilitate "smart documents" with a number of unique features:
10
+
11
+ - **Hierarchical structure**: Easy representation of a variety of semantic structures, from simple key-value pairs to complex property graphs
12
+ - **Merkle-like digest tree**: Built-in integrity verification at any level of the structure
13
+ - **Deterministic representation**: Uses CBOR with deterministic encoding rules for consistent serialization
14
+ - **Privacy-focused**: The holder of a document can selectively encrypt or elide specific parts without invalidating the structure, signatures, or digest tree
15
+ - **Progressive trust**: Holders can reveal information incrementally to build trust with verifiers
16
+
17
+ ## Specification
18
+
19
+ Gordian Envelope is formally specified in the [IETF Internet Draft](https://datatracker.ietf.org/doc/draft-mcnally-envelope/).
20
+
21
+ ## Rust Reference Implementation
22
+
23
+ This TypeScript implementation is based on [bc-envelope-rust](https://github.com/BlockchainCommons/bc-envelope-rust) **v0.39.0** ([commit](https://github.com/BlockchainCommons/bc-envelope-rust/tree/6c1ee07ee25f5edc098cb6e1118c60def880ab26)).