@smartledger/bsv 9.16.0 → 9.18.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 +189 -0
- package/README.md +19 -19
- package/bsv-ecies.min.js +1 -1
- package/bsv-gdaf.min.js +68 -68
- package/bsv-ltp.min.js +47 -47
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +68 -68
- package/bsv.d.ts +28 -2
- package/bsv.min.js +68 -68
- package/docs/AUDIT_SCOPE.md +8 -8
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/audit-rfq/cure53.txt +2 -2
- package/docs/audit-rfq/ncc-group.txt +2 -2
- package/docs/audit-rfq/trail-of-bits.txt +2 -2
- 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 +31 -5
- package/lib/notaryhash/index.js +44 -1
- package/lib/script/interpreter.js +53 -34
- package/lib/script/script.js +32 -0
- package/package.json +4 -4
- package/version.js +1 -1
package/lib/script/script.js
CHANGED
|
@@ -12,6 +12,7 @@ var Networks = require('../networks')
|
|
|
12
12
|
var $ = require('../util/preconditions')
|
|
13
13
|
var _ = require('../util/_')
|
|
14
14
|
var errors = require('../errors')
|
|
15
|
+
var deprecate = require('../util/deprecate')
|
|
15
16
|
var buffer = require('buffer')
|
|
16
17
|
var JSUtil = require('../util/js')
|
|
17
18
|
|
|
@@ -244,7 +245,38 @@ Script.fromASM = function (str) {
|
|
|
244
245
|
return script
|
|
245
246
|
}
|
|
246
247
|
|
|
248
|
+
// A pair of hex digits per byte, or nothing. One test covers both ways a string can
|
|
249
|
+
// fail to decode whole: a character that is not hex, and an odd number of digits.
|
|
250
|
+
// `JSUtil.isHexa` is not enough on its own — it accepts '76a91', which drops its last
|
|
251
|
+
// nibble.
|
|
252
|
+
var FULL_HEX = /^(?:[0-9a-fA-F]{2})*$/
|
|
253
|
+
|
|
247
254
|
Script.fromHex = function (str) {
|
|
255
|
+
// `Buffer.from(str, 'hex')` stops at the first character it cannot decode and returns
|
|
256
|
+
// what it had, so a malformed string yields a SHORTER script, or none, instead of an
|
|
257
|
+
// error. `Script.fromString` just below has always refused that with `JSUtil.isHexa`;
|
|
258
|
+
// this function never did. A caller that builds an output from the result pays to a
|
|
259
|
+
// truncated script and nothing tells it:
|
|
260
|
+
//
|
|
261
|
+
// Script.fromHex('<p2pkh hex>' + '\n...') -> the 25-byte prefix, still a valid P2PKH
|
|
262
|
+
// Script.fromHex('<html>503</html>') -> 0 bytes, and addOutput accepts it
|
|
263
|
+
//
|
|
264
|
+
// Truncation can only ever drop a suffix — it cannot change the bytes it did decode —
|
|
265
|
+
// so an address derived from the result is always the one the input's leading bytes
|
|
266
|
+
// named, never a third party's. That bounds the damage but does not make it correct.
|
|
267
|
+
//
|
|
268
|
+
// Refusing it outright is a breaking change, so this marks it and 10.0.0 throws
|
|
269
|
+
// (STABILITY.md: no major before 2027-09-01). Callers who want the strict behaviour
|
|
270
|
+
// now should test the round trip: `Script.fromHex(h).toHex() === h.toLowerCase()`.
|
|
271
|
+
if (typeof str === 'string' && !FULL_HEX.test(str)) {
|
|
272
|
+
deprecate({
|
|
273
|
+
what: 'Script.fromHex() with a string that is not whole hex',
|
|
274
|
+
since: '9.17.0',
|
|
275
|
+
removeIn: '10.0.0',
|
|
276
|
+
why: 'Buffer.from() stops at the first character it cannot decode, so the script is silently truncated',
|
|
277
|
+
use: 'a round-trip check, Script.fromHex(h).toHex() === h.toLowerCase()'
|
|
278
|
+
})
|
|
279
|
+
}
|
|
248
280
|
return new Script(buffer.Buffer.from(str, 'hex'))
|
|
249
281
|
}
|
|
250
282
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartledger/bsv",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.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",
|
|
@@ -214,9 +214,9 @@
|
|
|
214
214
|
"request": "browser-request"
|
|
215
215
|
},
|
|
216
216
|
"dependencies": {
|
|
217
|
-
"@noble/ciphers": "^2.
|
|
218
|
-
"@noble/curves": "^2.
|
|
219
|
-
"@noble/hashes": "^2.
|
|
217
|
+
"@noble/ciphers": "^2.4.0",
|
|
218
|
+
"@noble/curves": "^2.4.0",
|
|
219
|
+
"@noble/hashes": "^2.4.0",
|
|
220
220
|
"@types/node": "^20.19.0",
|
|
221
221
|
"bn.js": "=4.12.5",
|
|
222
222
|
"secrets.js-grempe": "^2.0.0"
|
package/version.js
CHANGED