smartledger-bsv 3.3.2 → 3.3.4
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 +220 -79
- package/README.md +283 -71
- package/bsv-covenant.min.js +26 -3
- package/bsv-gdaf.min.js +11 -9
- package/bsv-ltp.min.js +10 -8
- package/bsv-mnemonic.min.js +4 -4
- package/bsv-script-helper.min.js +2 -2
- package/bsv-security.min.js +3 -24
- package/bsv-shamir.min.js +2 -2
- package/bsv-smartcontract.min.js +10 -8
- package/bsv.bundle.js +9 -9
- package/bsv.min.js +10 -8
- package/build/webpack.bundle.config.js +2 -2
- package/build/webpack.config.js +2 -2
- package/build/webpack.covenant.config.js +2 -2
- package/build/webpack.gdaf.config.js +6 -43
- package/build/webpack.script-helper.config.js +2 -2
- package/build/webpack.security.config.js +2 -2
- package/build/webpack.smartcontract.config.js +2 -2
- package/bundle-entry.js +1 -341
- package/covenant-entry.js +1 -44
- package/demos/README.md +188 -0
- package/{architecture_demo.js → demos/architecture_demo.js} +2 -2
- package/demos/bsv_wallet_demo.js +242 -0
- package/{complete_ltp_demo.js → demos/complete_ltp_demo.js} +1 -1
- package/demos/debug_tools_demo.js +87 -0
- package/demos/demo_features.js +123 -0
- package/demos/easy_interface_demo.js +109 -0
- package/demos/ecies_demo.js +182 -0
- package/demos/gdaf_core_test.js +131 -0
- package/demos/gdaf_demo.js +237 -0
- package/demos/ltp_demo.js +361 -0
- package/demos/ltp_primitives_demo.js +403 -0
- package/demos/message_demo.js +209 -0
- package/demos/preimage_separation_demo.js +383 -0
- package/demos/script_helper_demo.js +289 -0
- package/demos/security_demo.js +287 -0
- package/{shamir_demo.js → demos/shamir_demo.js} +1 -1
- package/{simple_demo.js → demos/simple_demo.js} +1 -1
- package/demos/simple_p2pkh_demo.js +169 -0
- package/demos/simple_utxo_preimage_demo.js +196 -0
- package/demos/smart_contract_demo.html +1347 -0
- package/demos/smart_contract_demo.js +910 -0
- package/demos/utxo_generator_demo.js +244 -0
- package/demos/validation_pipeline_demo.js +155 -0
- package/demos/web3keys.html +740 -0
- package/docs/BUNDLE_UPDATE_SUMMARY.md +40 -0
- package/docs/DOCUMENTATION_REVIEW_REPORT.md +295 -0
- package/docs/FIX_CREATEHMAC_ISSUE.md +91 -0
- package/docs/MODULE_REFERENCE_COMPLETE.md +330 -0
- package/docs/README.md +107 -79
- package/docs/SMARTLEDGER_BSV_USAGE_ANSWERS.md +477 -0
- package/docs/SMARTLEDGER_BSV_USAGE_EXAMPLES.js +372 -0
- package/docs/SMARTLEDGER_BSV_USAGE_GUIDE.md +555 -0
- package/docs/SMART_CONTRACT_DEVELOPMENT_GUIDE.md +1459 -0
- package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +411 -0
- package/docs/advanced/SMART_CONTRACT_GUIDE.md +1255 -0
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +851 -0
- package/docs/api/LTP.md +334 -0
- package/docs/getting-started/INSTALLATION.md +410 -0
- package/docs/getting-started/QUICK_START.md +180 -0
- package/docs/migration/FROM_BSV_1_5_6.md +260 -0
- package/docs/technical/GDAF_DEVELOPER_INTERFACE.md +187 -0
- package/docs/technical/GDAF_IMPLEMENTATION_COMPLETE.md +190 -0
- package/docs/technical/SHAMIR_INTEGRATION_SUMMARY.md +165 -0
- package/docs/technical/roadmap.md +1250 -0
- package/docs/technical/trust_law.md +142 -0
- package/examples/complete_workflow_demo.js +783 -0
- package/examples/definitive_working_demo.js +261 -0
- package/examples/final_working_contracts.js +338 -0
- package/examples/smart_contract_templates.js +718 -0
- package/examples/working_smart_contracts.js +348 -0
- package/gdaf-entry.js +2 -54
- package/index.js +32 -0
- package/lib/mnemonic/pbkdf2.browser.js +69 -0
- package/lib/mnemonic/pbkdf2.js +2 -68
- package/lib/mnemonic/pbkdf2.node.js +68 -0
- package/ltp-entry.js +2 -92
- package/package.json +21 -8
- package/script-helper-entry.js +1 -49
- package/security-entry.js +1 -70
- package/shamir-entry.js +1 -173
- package/smartcontract-entry.js +1 -133
- package/tests/browser-compatibility/README.md +35 -0
- package/tests/browser-compatibility/test-cdn-vs-local.html +186 -0
- package/tests/browser-compatibility/test-pbkdf2.html +51 -0
- package/tests/test_builtin_verify.js +117 -0
- package/tests/test_debug_integration.js +71 -0
- package/tests/test_ecdsa_little.js +70 -0
- package/tests/test_smartverify_der.js +110 -0
- package/utilities/blockchain-state.js +155 -155
- package/utilities/blockchain-state.json +103293 -5244
- package/utilities/miner-simulator.js +354 -358
- package/utilities/mock-utxo-generator.js +54 -54
- package/utilities/raw-tx-examples.js +120 -122
- package/utilities/success-demo.js +104 -105
- package/utilities/transaction-examples.js +188 -188
- package/utilities/utxo-manager.js +91 -91
- package/utilities/wallet-setup.js +79 -80
- package/utilities/working-signature-demo.js +108 -110
- package/SECURITY.md +0 -75
- package/build/bsv-covenant.min.js +0 -10
- package/build/bsv-script-helper.min.js +0 -10
- package/build/bsv-security.min.js +0 -31
- package/build/bsv-smartcontract.min.js +0 -39
- package/build/bsv.bundle.js +0 -39
- package/build/bsv.min.js +0 -39
- package/validation_test.js +0 -97
- /package/docs/{ADVANCED_COVENANT_DEVELOPMENT.md → advanced/ADVANCED_COVENANT_DEVELOPMENT.md} +0 -0
- /package/docs/{CUSTOM_SCRIPT_DEVELOPMENT.md → advanced/CUSTOM_SCRIPT_DEVELOPMENT.md} +0 -0
- /package/docs/{block.md → api/BLOCKS.md} +0 -0
- /package/docs/{ecies.md → api/ECIES.md} +0 -0
- /package/docs/{networks.md → api/NETWORKS.md} +0 -0
- /package/docs/{script.md → api/SCRIPTS.md} +0 -0
- /package/docs/{transaction.md → api/TRANSACTIONS.md} +0 -0
- /package/docs/{unspentoutput.md → api/UTXO.md} +0 -0
- /package/{test_shamir.js → tests/test_shamir.js} +0 -0
- /package/{test_standalone_shamir.html → tests/test_standalone_shamir.html} +0 -0
package/validation_test.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SmartLedger-BSV Signature Verification Fix Validation
|
|
5
|
-
*
|
|
6
|
-
* This script validates that the signature verification bug has been fixed
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const bsv = require('./index.js');
|
|
10
|
-
|
|
11
|
-
console.log('🎯 SmartLedger-BSV Signature Verification Fix Validation');
|
|
12
|
-
console.log('=======================================================\n');
|
|
13
|
-
|
|
14
|
-
// Test with multiple different signatures
|
|
15
|
-
const testCases = [
|
|
16
|
-
{
|
|
17
|
-
name: 'Test Case 1: hello world',
|
|
18
|
-
privateKey: 'L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ',
|
|
19
|
-
message: 'hello world'
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'Test Case 2: BSV transaction',
|
|
23
|
-
privateKey: 'KzsjKq2FVqVuQv2ueHVFuB65A9uEZ6S1E6hrhGCi5LAFS9kBf7Nm',
|
|
24
|
-
message: 'BSV blockchain transaction data'
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'Test Case 3: empty message',
|
|
28
|
-
privateKey: 'L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY1',
|
|
29
|
-
message: ''
|
|
30
|
-
}
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
let passedTests = 0;
|
|
34
|
-
let totalTests = 0;
|
|
35
|
-
|
|
36
|
-
for (const testCase of testCases) {
|
|
37
|
-
console.log(`\n📝 ${testCase.name}:`);
|
|
38
|
-
console.log('='.repeat(testCase.name.length + 4));
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const privateKey = new bsv.PrivateKey(testCase.privateKey);
|
|
42
|
-
const publicKey = privateKey.publicKey;
|
|
43
|
-
const message = Buffer.from(testCase.message, 'utf8');
|
|
44
|
-
const hash = bsv.crypto.Hash.sha256(message);
|
|
45
|
-
|
|
46
|
-
// Create signature
|
|
47
|
-
const signature = bsv.crypto.ECDSA.sign(hash, privateKey);
|
|
48
|
-
const derSig = signature.toDER();
|
|
49
|
-
const canonicalSig = signature.toCanonical();
|
|
50
|
-
const canonicalDer = canonicalSig.toDER();
|
|
51
|
-
|
|
52
|
-
console.log(`Private Key: ${testCase.privateKey}`);
|
|
53
|
-
console.log(`Message: "${testCase.message}"`);
|
|
54
|
-
console.log(`Signature canonical: ${signature.isCanonical()}`);
|
|
55
|
-
|
|
56
|
-
// Test all verification methods
|
|
57
|
-
const tests = [
|
|
58
|
-
{ name: 'ECDSA.verify(hash, derSig, publicKey)', result: bsv.crypto.ECDSA.verify(hash, derSig, publicKey) },
|
|
59
|
-
{ name: 'ECDSA.verify(hash, canonicalDer, publicKey)', result: bsv.crypto.ECDSA.verify(hash, canonicalDer, publicKey) },
|
|
60
|
-
{ name: 'ECDSA.verify(hash, signature, publicKey)', result: bsv.crypto.ECDSA.verify(hash, signature, publicKey) },
|
|
61
|
-
{ name: 'SmartVerify.smartVerify(hash, derSig, publicKey)', result: bsv.SmartVerify.smartVerify(hash, derSig, publicKey) },
|
|
62
|
-
{ name: 'SmartVerify.smartVerify(hash, canonicalDer, publicKey)', result: bsv.SmartVerify.smartVerify(hash, canonicalDer, publicKey) },
|
|
63
|
-
{ name: 'SmartVerify.isCanonical(derSig)', result: bsv.SmartVerify.isCanonical(derSig) },
|
|
64
|
-
{ name: 'SmartVerify.isCanonical(canonicalDer)', result: bsv.SmartVerify.isCanonical(canonicalDer) }
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
for (const test of tests) {
|
|
68
|
-
totalTests++;
|
|
69
|
-
const status = test.result ? '✅ PASS' : '❌ FAIL';
|
|
70
|
-
console.log(`${status} ${test.name}: ${test.result}`);
|
|
71
|
-
if (test.result) passedTests++;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.log(`❌ Test failed with error: ${error.message}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
console.log('\n🏆 Summary:');
|
|
80
|
-
console.log('===========');
|
|
81
|
-
console.log(`Passed: ${passedTests}/${totalTests} tests`);
|
|
82
|
-
console.log(`Success rate: ${((passedTests / totalTests) * 100).toFixed(1)}%`);
|
|
83
|
-
|
|
84
|
-
if (passedTests === totalTests) {
|
|
85
|
-
console.log('\n🎉 ALL TESTS PASSED! Signature verification is now working correctly.');
|
|
86
|
-
console.log('✅ The SmartLedger-BSV v3.0.1 signature verification bug has been FIXED!');
|
|
87
|
-
} else {
|
|
88
|
-
console.log('\n⚠️ Some tests failed. The fix may not be complete.');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
console.log('\n📋 Fix Summary:');
|
|
92
|
-
console.log('===============');
|
|
93
|
-
console.log('1. Fixed ECDSA.set() to auto-parse DER buffers to Signature objects');
|
|
94
|
-
console.log('2. Fixed ECDSA.sigError() to handle canonical signature verification properly');
|
|
95
|
-
console.log('3. Fixed SmartVerify.smartVerify() to accept both DER buffers and Signature objects');
|
|
96
|
-
console.log('4. Fixed SmartVerify.isCanonical() to parse DER buffers correctly');
|
|
97
|
-
console.log('5. Enhanced compatibility with both canonical and non-canonical signature inputs');
|
/package/docs/{ADVANCED_COVENANT_DEVELOPMENT.md → advanced/ADVANCED_COVENANT_DEVELOPMENT.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|