@smartledger/bsv 9.9.0 โ 9.10.0
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/CHANGELOG.md +35 -0
- package/README.md +19 -19
- package/bsv-gdaf.min.js +1 -1
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +2 -2
- package/bsv.d.ts +5 -0
- package/bsv.min.js +2 -2
- package/docs/AUDIT_SCOPE.md +6 -6
- package/docs/BRC220_BATCH_LEAF_AMENDMENT.md +8 -3
- package/docs/BRC220_CERTIFICATE_FIELDS_AMENDMENT.md +246 -0
- package/docs/BRC220_ENCODING_AMENDMENT.md +2 -1
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/audit-rfq/cure53.txt +1 -1
- package/docs/audit-rfq/ncc-group.txt +1 -1
- package/docs/audit-rfq/trail-of-bits.txt +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/notaryhash/certificate.js +9 -5
- package/lib/notaryhash/index.js +10 -0
- package/package.json +1 -1
- package/version.js +1 -1
|
@@ -159,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
|
|
|
159
159
|
### **New Modular Options**
|
|
160
160
|
```html
|
|
161
161
|
<!-- Core compatibility (same size as bsv@1.5.6) -->
|
|
162
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
162
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
|
|
163
163
|
|
|
164
164
|
<!-- Add smart contracts when ready -->
|
|
165
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
165
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-smartcontract.min.js"></script>
|
|
166
166
|
|
|
167
167
|
<!-- Add advanced features as needed -->
|
|
168
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
169
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
168
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-ltp.min.js"></script>
|
|
169
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-gdaf.min.js"></script>
|
|
170
170
|
|
|
171
171
|
<!-- Everything in one file -->
|
|
172
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
172
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.bundle.js"></script>
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
## ๐ **Testing Your Migration**
|
|
@@ -101,11 +101,11 @@ var LEGACY_VERSION = 1
|
|
|
101
101
|
var LEGACY_MODE = { 0: 'full', 1: 'hybrid', 2: 'full' }
|
|
102
102
|
|
|
103
103
|
var HEX_RE = /^[0-9a-fA-F]*$/
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
// skips
|
|
108
|
-
// error.
|
|
104
|
+
// Both RFC 4648 alphabets (ยง4 standard, ยง5 URL-safe) and missing padding are accepted, as
|
|
105
|
+
// the reference accepts them. What is NOT accepted is anything that is not base64: a
|
|
106
|
+
// character outside the alphabet, padding out of place, or a length no byte string
|
|
107
|
+
// encodes. Buffer.from skips the first and truncates the last, turning a corrupted field
|
|
108
|
+
// into different bytes instead of an error.
|
|
109
109
|
var BASE64_RE = /^[A-Za-z0-9+/_-]*={0,2}$/
|
|
110
110
|
|
|
111
111
|
/**
|
|
@@ -131,6 +131,10 @@ Certificate.decodeBytes = function (value, encoding, name) {
|
|
|
131
131
|
}
|
|
132
132
|
if (encoding === Certificate.ENCODING.BASE64) {
|
|
133
133
|
if (!BASE64_RE.test(value)) throw new Error(name + ' must be base64')
|
|
134
|
+
var body = value.replace(/=+$/, '')
|
|
135
|
+
if ((body.length !== value.length && value.length % 4 !== 0) || body.length % 4 === 1) {
|
|
136
|
+
throw new Error(name + ' is not a valid base64 length')
|
|
137
|
+
}
|
|
134
138
|
return Buffer.from(value, 'base64')
|
|
135
139
|
}
|
|
136
140
|
throw new Error('encoding must be "hex" or "base64", not ' + JSON.stringify(encoding))
|
package/lib/notaryhash/index.js
CHANGED
|
@@ -165,6 +165,8 @@ NotaryHash.recordMatchesCertificate = function (record, certificate) {
|
|
|
165
165
|
* @param {Object} certificate - must carry an `spv` envelope
|
|
166
166
|
* @param {Object} opts
|
|
167
167
|
* @param {String|Buffer|BlockHeader} opts.header - independently obtained
|
|
168
|
+
* @param {Number} [opts.height] - the height the header was obtained at. A header's 80
|
|
169
|
+
* bytes do not carry it, so it is checked against spv.blockHeight only when supplied.
|
|
168
170
|
* @param {Boolean} [opts.requirePow=true] - pass false only for test fixtures
|
|
169
171
|
* @returns {Object} { valid, errors }
|
|
170
172
|
*/
|
|
@@ -221,6 +223,13 @@ NotaryHash.verifyAnchorSPV = function (certificate, opts) {
|
|
|
221
223
|
errors.push('the supplied header is not the block the SPV envelope names')
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
// And "at spv.blockHeight". A header does not say what height it is at โ that comes
|
|
227
|
+
// from wherever the caller obtained it โ so a caller that knows passes it. It cannot be
|
|
228
|
+
// required without breaking every caller that holds only the 80 bytes.
|
|
229
|
+
if (opts.height !== undefined && opts.height !== spv.blockHeight) {
|
|
230
|
+
errors.push('the supplied header is not at the height the SPV envelope names')
|
|
231
|
+
}
|
|
232
|
+
|
|
224
233
|
return { valid: errors.length === 0, errors: errors }
|
|
225
234
|
} catch (e) {
|
|
226
235
|
return { valid: false, errors: ['anchor verification error: ' + e.message] }
|
|
@@ -303,6 +312,7 @@ function merkleFolds (c, failure) {
|
|
|
303
312
|
* @param {Object} certificate
|
|
304
313
|
* @param {Object} [opts]
|
|
305
314
|
* @param {String|Buffer} [opts.header] - an independently obtained block header
|
|
315
|
+
* @param {Number} [opts.height] - the height it was obtained at; see verifyAnchorSPV
|
|
306
316
|
* @param {Boolean} [opts.skipAnchor] - check 1 and 2 only; the result is NOT a valid
|
|
307
317
|
* certificate, and `valid` will be false. For offline triage.
|
|
308
318
|
* @returns {Object} { valid, signature, proofIntegrity, anchor, batchInclusion, shape,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartledger/bsv",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"description": "Bitcoin SV library with an interpreter-verified script engine: OP_PUSH_TX covenants, BIP-143 preimage tooling, and consensus flags that match what miners actually enforce. Also ships DID:web / W3C VC-JWT credentials and the Legal Token Protocol.",
|
|
5
5
|
"author": "SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",
|
|
6
6
|
"homepage": "https://github.com/codenlighten/smartledger-bsv#readme",
|
package/version.js
CHANGED