@shieldfive/crypto 1.0.0-alpha.11

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 (124) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/LICENSE +201 -0
  3. package/README.md +275 -0
  4. package/SECURITY.md +130 -0
  5. package/dist/format/header.d.ts +73 -0
  6. package/dist/format/header.d.ts.map +1 -0
  7. package/dist/format/header.js +230 -0
  8. package/dist/format/header.js.map +1 -0
  9. package/dist/identity/index.d.ts +119 -0
  10. package/dist/identity/index.d.ts.map +1 -0
  11. package/dist/identity/index.js +217 -0
  12. package/dist/identity/index.js.map +1 -0
  13. package/dist/identity/sign.d.ts +92 -0
  14. package/dist/identity/sign.d.ts.map +1 -0
  15. package/dist/identity/sign.js +182 -0
  16. package/dist/identity/sign.js.map +1 -0
  17. package/dist/index.d.ts +58 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +146 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/internal/encoding.d.ts +33 -0
  22. package/dist/internal/encoding.d.ts.map +1 -0
  23. package/dist/internal/encoding.js +135 -0
  24. package/dist/internal/encoding.js.map +1 -0
  25. package/dist/internal/hkdf.d.ts +14 -0
  26. package/dist/internal/hkdf.d.ts.map +1 -0
  27. package/dist/internal/hkdf.js +27 -0
  28. package/dist/internal/hkdf.js.map +1 -0
  29. package/dist/internal/hmac.d.ts +9 -0
  30. package/dist/internal/hmac.d.ts.map +1 -0
  31. package/dist/internal/hmac.js +18 -0
  32. package/dist/internal/hmac.js.map +1 -0
  33. package/dist/internal/runtime.d.ts +29 -0
  34. package/dist/internal/runtime.d.ts.map +1 -0
  35. package/dist/internal/runtime.js +67 -0
  36. package/dist/internal/runtime.js.map +1 -0
  37. package/dist/internal/sodium.d.ts +12 -0
  38. package/dist/internal/sodium.d.ts.map +1 -0
  39. package/dist/internal/sodium.js +34 -0
  40. package/dist/internal/sodium.js.map +1 -0
  41. package/dist/internal/types.d.ts +98 -0
  42. package/dist/internal/types.d.ts.map +1 -0
  43. package/dist/internal/types.js +70 -0
  44. package/dist/internal/types.js.map +1 -0
  45. package/dist/kdf/argon2id.d.ts +72 -0
  46. package/dist/kdf/argon2id.d.ts.map +1 -0
  47. package/dist/kdf/argon2id.js +98 -0
  48. package/dist/kdf/argon2id.js.map +1 -0
  49. package/dist/migration/v0-bridge.d.ts +94 -0
  50. package/dist/migration/v0-bridge.d.ts.map +1 -0
  51. package/dist/migration/v0-bridge.js +203 -0
  52. package/dist/migration/v0-bridge.js.map +1 -0
  53. package/dist/streams/aes-gcm-v1.d.ts +144 -0
  54. package/dist/streams/aes-gcm-v1.d.ts.map +1 -0
  55. package/dist/streams/aes-gcm-v1.js +456 -0
  56. package/dist/streams/aes-gcm-v1.js.map +1 -0
  57. package/dist/streams/pq-hybrid-v1.d.ts +219 -0
  58. package/dist/streams/pq-hybrid-v1.d.ts.map +1 -0
  59. package/dist/streams/pq-hybrid-v1.js +473 -0
  60. package/dist/streams/pq-hybrid-v1.js.map +1 -0
  61. package/dist/suites/aes-gcm-v0/api.d.ts +48 -0
  62. package/dist/suites/aes-gcm-v0/api.d.ts.map +1 -0
  63. package/dist/suites/aes-gcm-v0/api.js +110 -0
  64. package/dist/suites/aes-gcm-v0/api.js.map +1 -0
  65. package/dist/suites/aes-gcm-v1/api.d.ts +54 -0
  66. package/dist/suites/aes-gcm-v1/api.d.ts.map +1 -0
  67. package/dist/suites/aes-gcm-v1/api.js +181 -0
  68. package/dist/suites/aes-gcm-v1/api.js.map +1 -0
  69. package/dist/suites/aes-gcm-v1/index.d.ts +59 -0
  70. package/dist/suites/aes-gcm-v1/index.d.ts.map +1 -0
  71. package/dist/suites/aes-gcm-v1/index.js +177 -0
  72. package/dist/suites/aes-gcm-v1/index.js.map +1 -0
  73. package/dist/suites/aes-gcm-v2/api.d.ts +44 -0
  74. package/dist/suites/aes-gcm-v2/api.d.ts.map +1 -0
  75. package/dist/suites/aes-gcm-v2/api.js +162 -0
  76. package/dist/suites/aes-gcm-v2/api.js.map +1 -0
  77. package/dist/suites/aes-gcm-v2/index.d.ts +63 -0
  78. package/dist/suites/aes-gcm-v2/index.d.ts.map +1 -0
  79. package/dist/suites/aes-gcm-v2/index.js +193 -0
  80. package/dist/suites/aes-gcm-v2/index.js.map +1 -0
  81. package/dist/suites/pq-hybrid-v1/api.d.ts +67 -0
  82. package/dist/suites/pq-hybrid-v1/api.d.ts.map +1 -0
  83. package/dist/suites/pq-hybrid-v1/api.js +190 -0
  84. package/dist/suites/pq-hybrid-v1/api.js.map +1 -0
  85. package/dist/suites/pq-hybrid-v1/index.d.ts +101 -0
  86. package/dist/suites/pq-hybrid-v1/index.d.ts.map +1 -0
  87. package/dist/suites/pq-hybrid-v1/index.js +225 -0
  88. package/dist/suites/pq-hybrid-v1/index.js.map +1 -0
  89. package/dist/suites/xchacha-v1/api.d.ts +29 -0
  90. package/dist/suites/xchacha-v1/api.d.ts.map +1 -0
  91. package/dist/suites/xchacha-v1/api.js +154 -0
  92. package/dist/suites/xchacha-v1/api.js.map +1 -0
  93. package/dist/suites/xchacha-v1/index.d.ts +50 -0
  94. package/dist/suites/xchacha-v1/index.d.ts.map +1 -0
  95. package/dist/suites/xchacha-v1/index.js +133 -0
  96. package/dist/suites/xchacha-v1/index.js.map +1 -0
  97. package/package.json +124 -0
  98. package/spec/format-v0.md +81 -0
  99. package/spec/format-v1.md +400 -0
  100. package/spec/key-derivation.md +167 -0
  101. package/spec/threat-model.md +242 -0
  102. package/src/format/header.ts +316 -0
  103. package/src/identity/index.ts +371 -0
  104. package/src/identity/sign.ts +221 -0
  105. package/src/index.ts +224 -0
  106. package/src/internal/encoding.ts +152 -0
  107. package/src/internal/hkdf.ts +47 -0
  108. package/src/internal/hmac.ts +33 -0
  109. package/src/internal/runtime.ts +80 -0
  110. package/src/internal/sodium.ts +38 -0
  111. package/src/internal/types.ts +134 -0
  112. package/src/kdf/argon2id.ts +165 -0
  113. package/src/migration/v0-bridge.ts +347 -0
  114. package/src/streams/aes-gcm-v1.ts +647 -0
  115. package/src/streams/pq-hybrid-v1.ts +722 -0
  116. package/src/suites/aes-gcm-v0/api.ts +155 -0
  117. package/src/suites/aes-gcm-v1/api.ts +292 -0
  118. package/src/suites/aes-gcm-v1/index.ts +269 -0
  119. package/src/suites/aes-gcm-v2/api.ts +268 -0
  120. package/src/suites/aes-gcm-v2/index.ts +289 -0
  121. package/src/suites/pq-hybrid-v1/api.ts +299 -0
  122. package/src/suites/pq-hybrid-v1/index.ts +343 -0
  123. package/src/suites/xchacha-v1/api.ts +254 -0
  124. package/src/suites/xchacha-v1/index.ts +213 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,228 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@shieldfive/crypto` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 1.0.0-alpha.11 — 2026-05-21
9
+
10
+ ### Added
11
+
12
+ - Cipher suite 0x04 `aes-gcm-v2`: 8-byte HKDF-derived nonce prefix
13
+ + 4-byte BE chunk counter. Widens the cross-file IV-collision
14
+ space from 2^32 to 2^64 while keeping the IV at 12 bytes. v1
15
+ (suite 0x01) stays decrypt-only on the umbrella export.
16
+ - Optional sender-attribution signatures (`src/identity/sign.ts`).
17
+ Detached Ed25519 (alg 0x01) over
18
+ `header_unauthenticated_bytes || concat(chunk_macs)`, appended as
19
+ a trailing signature block. Legacy files without the block keep
20
+ decrypting unchanged; the streaming API returns
21
+ `{signature: null}` in that case. Algorithm 0x02 is reserved for
22
+ ML-DSA-65.
23
+
24
+ ### Notes
25
+
26
+ - Default cipher suite is still PQ-hybrid
27
+ (`SUITE.PQ_HYBRID_XCHACHA_MLKEM1024_V1`). aes-gcm-v2 is opt-in
28
+ via the dedicated subpath import.
29
+ - Wire format updates documented in `spec/format-v1.md`.
30
+
31
+ ## [1.0.0-alpha.9] — 2026-05
32
+
33
+ ### Documentation
34
+
35
+ - docs(security): align SECURITY.md bug-bounty section with
36
+ shieldfive.com/security/bug-bounty. The previous wording said no
37
+ paid bounty existed for the open-source crypto library; the
38
+ operator-run program at shieldfive.com/security/bug-bounty has
39
+ always covered this library with €1000/€500/€250 tiers, so
40
+ SECURITY.md now points there instead of contradicting it. Audit
41
+ punch-list item P0-4.
42
+
43
+ ### Changed
44
+
45
+ - chore(package): drop "audited-ready" from the npm description.
46
+ No external audit has been performed; the project's audit
47
+ posture is documented in SECURITY.md and continues to be
48
+ "self-reviewed, external audit deferred". Audit punch-list
49
+ item P1-D.
50
+ - chore(license): replace "Copyright 2026 ShieldFive" with
51
+ "Copyright 2026 Cho Garcia" in LICENSE (Apache-2.0 attribution
52
+ block). Audit punch-list item P1-C.
53
+ - chore(crypto): bump `SHIELDFIVE_CRYPTO_VERSION` constant in
54
+ `src/index.ts` to match the published package version
55
+ (previously stale at 1.0.0-alpha.6).
56
+
57
+ ## [1.0.0-alpha.8] — 2026-05
58
+
59
+ ### Fixed
60
+
61
+ - fix(pq-hybrid-v1): re-export `generateMlKemKeypair` and
62
+ `deriveMlKemKeypair` from the public subpath so the README quick-start
63
+ compiles.
64
+
65
+ ## [1.0.0-alpha.7] — 2026-05
66
+
67
+ ### Dependencies
68
+
69
+ - Bump `@noble/post-quantum` from `^0.5.3` (resolved 0.5.4) to
70
+ `^0.6.0` (resolves to 0.6.1). The upstream maintainer self-audit
71
+ released alongside 0.6.1 (April 2026) covers the line ShieldFive
72
+ now ships; the 0.5.x line predates the self-audit. The pinned
73
+ `10_ml_kem_keypair_derivation` test vector in
74
+ `tests/vectors/vectors.json` is byte-identical under 0.6.1 and
75
+ 0.5.4 (both implement final FIPS 203 ML-KEM-1024), so no vector
76
+ refresh was required. Wire format and on-disk format are
77
+ byte-identical to prior alphas for the same plaintext, key, and
78
+ file_id inputs.
79
+
80
+ ### Documentation
81
+
82
+ - README dependency acknowledgement rewritten to accurately
83
+ describe the noble-post-quantum version (^0.6.0, resolving to
84
+ 0.6.1) and audit status (upstream self-audit April 2026; no
85
+ independent external audit of either the upstream library or
86
+ the ShieldFive PQ-hybrid construction on top of it). Closes the
87
+ audit punch-list item under `audit/launch/cho-deep-audit-2026-05-19`
88
+ § P0-7.
89
+
90
+ ## [1.0.0-alpha.6] — 2026-05
91
+
92
+ ### Added
93
+
94
+ - `./streams/pq-hybrid-v1` — `createPqHybridV1DecryptStream` now accepts
95
+ a pre-derived 32-byte combined key K via a new `combinedKey` option,
96
+ in lieu of the `recipientSecretKey` + `envelopeKey` pair. When present,
97
+ the stream skips ML-KEM decapsulation and uses K directly for header
98
+ MAC verification and per-chunk AEAD. The header MAC check still
99
+ cryptographically gates the rest of the stream, so a wrong K fails
100
+ fast. Unblocks Suite 0x03 share-link recipients: they unwrap K under
101
+ the share-link password and never touch ML-KEM material. The
102
+ `PqHybridV1DecryptStreamOptions` type is now a discriminated union
103
+ over the two key-input modes; existing callers that pass
104
+ `recipientSecretKey` + `envelopeKey` are unaffected.
105
+ - `./pq-hybrid-v1` (and `pqHybridV1` namespace on the umbrella entry) —
106
+ `decapsulateFromHeader`, `encapsulateForRecipient`, and the
107
+ `PQ_HYBRID_V1_SUITE_PAYLOAD_LENGTH` constant are now publicly
108
+ re-exported from the suite's public surface (`api.ts`). The previous
109
+ release exposed them only on the internal `index.js` path. Lets
110
+ callers that hold the parsed `suite_payload` + KEM material (e.g.,
111
+ share-link generators that need to derive K out-of-band) reach the
112
+ primitives without importing from a deep internal path.
113
+
114
+ ## [1.0.0-alpha.5] — 2026-05
115
+
116
+ ### Added
117
+
118
+ - `./streams/pq-hybrid-v1` — TransformStream factory for streaming
119
+ encrypt/decrypt under Suite 0x03 (ML-KEM-1024 + XChaCha20-Poly1305).
120
+ Same shape as `./streams/aes-gcm-v1`, suite primitive swapped. Unblocks
121
+ the web app's Phase 3 implementation (Step 14) per the design doc at
122
+ `web/docs/phase3-design.md`.
123
+
124
+ ## [1.0.0-alpha.4] — 2026-05
125
+
126
+ ### Changed
127
+
128
+ - Threat model (`spec/threat-model.md`) expanded to cover gaps surfaced
129
+ by internal review Task 3: explicit TLS-termination boundary in A2,
130
+ HKDF-structural splice-resistance prose (replacing the incorrect
131
+ "file_id AAD" wording that paralleled Task 1 Finding 1.1),
132
+ legacy-v0 AEAD-invariant carve-out under A2, A3
133
+ current-deployment-status subsection + comparison-table footnote
134
+ (suite `0x03` not yet wired into the web client), new "Trust
135
+ principals" section enumerating share-link recipients, expanded
136
+ metadata-leakage list, and a recovery-key-compromise paragraph
137
+ under "Out of scope". See
138
+ [crypto#4](https://github.com/shieldfive/crypto/commit/bb967cb) for the
139
+ detailed diff. Docs-only; no wire-format or code changes.
140
+
141
+ ## [1.0.0-alpha.3] — 2026-05
142
+
143
+ ### Fixed
144
+
145
+ - Repository URLs in `package.json`, README, and CHANGELOG now correctly
146
+ point at github.com/shieldfive/crypto. The previous metadata referenced
147
+ github.com/shieldfive-labs, which was never actually created.
148
+ Metadata-only fix; no code changes.
149
+
150
+ ## [1.0.0-alpha.2] — 2026-05
151
+
152
+ ### Fixed
153
+
154
+ - **Migration bridge accepts the production wire-name `process`.** The
155
+ v0 bridge previously only accepted `{ type: 'chunk_request', index }`
156
+ for chunk requests, but the existing ShieldFive production worker
157
+ uses `{ type: 'process', index }`. This made the bridge silently
158
+ drop messages from unmodified production callers — a Phase 1
159
+ regression. The bridge now accepts both names; `process` is the
160
+ canonical/documented wire name and `chunk_request` is preserved as
161
+ an alias for back-compat. Caught during the Phase 1 migration in
162
+ the ShieldFive main repository before any production rollout.
163
+
164
+ ### Added
165
+
166
+ - `./package.json` is now exposed via `exports`, so consumers can
167
+ read the package version with `require('@shieldfive/crypto/package.json')`
168
+ or `import('@shieldfive/crypto/package.json')`.
169
+
170
+ ## [1.0.0-alpha.1] — 2026-05
171
+
172
+ The first public release.
173
+
174
+ ### Added
175
+
176
+ - **Format v1**: self-describing on-disk encrypted-file format with
177
+ cipher-suite agility, file-id-bound chunk AAD, and authenticated header
178
+ MAC. Specification at `spec/format-v1.md`.
179
+ - **Suite 0x01 — `aes-256-gcm-v1`**: WebCrypto-only AES-256-GCM AEAD with
180
+ per-chunk file-id-bound AAD. No WASM dependency.
181
+ - **Suite 0x02 — `xchacha20-poly1305-v1`**: XChaCha20-Poly1305 AEAD via
182
+ libsodium (optional peer dependency).
183
+ - **Suite 0x03 — `pq-hybrid-xchacha-mlkem1024-v1`** (default): hybrid
184
+ ML-KEM-1024 + XChaCha20-Poly1305 with HKDF-SHA-256 share combination.
185
+ - **Legacy v0 reader**: read-only support for the pre-v1 ShieldFive
186
+ production format. There is no v0 writer.
187
+ - **Auto-routing decryptor**: `autoDecryptBlob` dispatches to the correct
188
+ suite based on the header.
189
+ - **Threat model document** at `spec/threat-model.md`.
190
+ - **64 tests** covering: round-trip encryption for all suites, truncation
191
+ detection, per-chunk tampering, header tampering, chunk reordering,
192
+ cross-file splice prevention, wrong-key rejection, and parser edge cases.
193
+ - Apache 2.0 license.
194
+ - `SECURITY.md` with safe-harbor clause and disclosure timelines.
195
+
196
+ ### Security architecture
197
+
198
+ - Every chunk's AEAD authenticator binds chunk index, total chunk count,
199
+ final-chunk flag, and file_id. Truncation, reordering, and cross-file
200
+ splice attacks fail at the AEAD layer.
201
+ - Header MAC is keyed by HKDF-derived material from the content key. A
202
+ successful header MAC verification proves the right content key was
203
+ supplied before any chunk is processed.
204
+ - Post-quantum hybrid construction: an adversary must break both
205
+ ML-KEM-1024 _and_ the classical wrap to compromise a file. ML-KEM-1024
206
+ is FIPS 203 (NIST PQC standard, security category 5).
207
+
208
+ ### Known limitations
209
+
210
+ - The streaming API (`src/streams/`) is not yet implemented; current API
211
+ reads/writes whole blobs.
212
+ - A formal third-party security audit has not yet been performed; planned
213
+ for v1.0.0 stable.
214
+ - No file-size obfuscation (padding) is applied. Padding may be added as
215
+ an optional flag in a future minor format version.
216
+ - ML-KEM keypair derivation from the user master secret is deterministic
217
+ via HKDF-SHA-256; this is an availability-vs-defense-in-depth tradeoff
218
+ documented in `spec/threat-model.md`.
219
+
220
+ [1.0.0-alpha.1]: https://github.com/shieldfive/crypto/releases/tag/v1.0.0-alpha.1
221
+ [1.0.0-alpha.2]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.1...v1.0.0-alpha.2
222
+ [1.0.0-alpha.3]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.2...v1.0.0-alpha.3
223
+ [1.0.0-alpha.4]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
224
+ [1.0.0-alpha.5]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.4...v1.0.0-alpha.5
225
+ [1.0.0-alpha.6]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.5...v1.0.0-alpha.6
226
+ [1.0.0-alpha.7]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.6...v1.0.0-alpha.7
227
+ [1.0.0-alpha.9]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.8...v1.0.0-alpha.9
228
+ [Unreleased]: https://github.com/shieldfive/crypto/compare/v1.0.0-alpha.7...HEAD
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Cho Garcia
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing permissions and
201
+ limitations under the License.