@smartledger/bsv 3.4.0 → 3.4.2
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 +64 -0
- package/README.md +60 -32
- package/bsv-anchor.min.js +12 -0
- package/bsv-covenant.min.js +8 -8
- package/bsv-didweb.min.js +12 -0
- package/bsv-gdaf.min.js +9 -9
- package/bsv-ltp.min.js +9 -9
- package/bsv-mnemonic.min.js +2 -2
- package/bsv-shamir.min.js +3 -3
- package/bsv-smartcontract.min.js +5 -5
- package/bsv-statuslist.min.js +18 -0
- package/bsv-vcjwt.min.js +12 -0
- package/bsv.bundle.js +9 -9
- package/bsv.min.js +5 -5
- package/build/webpack.anchor.config.js +9 -13
- package/build/webpack.didweb.config.js +10 -14
- package/build/webpack.statuslist.config.js +9 -14
- package/build/webpack.vcjwt.config.js +9 -13
- package/examples/legacy/README.md +11 -0
- package/index.js +24 -6
- package/lib/browser-utxo-manager-es5.js +11 -4
- package/lib/browser-utxo-manager.js +15 -8
- package/lib/ltp/claim.js +1 -0
- package/lib/ltp/obligation.js +1 -0
- package/lib/ltp/registry.js +2 -0
- package/lib/ltp/right.js +1 -0
- package/lib/transaction/transaction.js +1 -1
- package/lib/util/_.js +7 -1
- package/package.json +9 -11
- package/demos/gdaf_core_test.js +0 -131
- package/examples/scripts/custom_script_signature_test.js +0 -344
- package/tests/browser-compatibility/README.md +0 -35
- package/tests/browser-compatibility/test-cdn-vs-local.html +0 -186
- package/tests/browser-compatibility/test-pbkdf2.html +0 -51
- package/tests/bundle-completeness-test.html +0 -131
- package/tests/bundle-demo.html +0 -476
- package/tests/smartcontract-test.html +0 -239
- package/tests/standalone-modules-test.html +0 -260
- package/tests/test.html +0 -612
- package/tests/test_standalone_shamir.html +0 -83
- package/tests/unpkg-demo.html +0 -194
- package/utilities/blockchain-state.json +0 -118565
- /package/{lib/smart_contract/test_integration.js → examples/legacy/smart_contract_test_integration.js} +0 -0
- /package/{tests → examples/legacy}/test_builtin_verify.js +0 -0
- /package/{tests → examples/legacy}/test_debug_integration.js +0 -0
- /package/{tests → examples/legacy}/test_ecdsa_little.js +0 -0
- /package/{tests → examples/legacy}/test_shamir.js +0 -0
- /package/{tests → examples/legacy}/test_smartverify_der.js +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>BSV Shamir Secret Sharing - Standalone Test</title>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>BSV Shamir Secret Sharing - Standalone Module Test</h1>
|
|
9
|
-
<div id="output"></div>
|
|
10
|
-
|
|
11
|
-
<script src="bsv-shamir.min.js"></script>
|
|
12
|
-
<script>
|
|
13
|
-
function log(message) {
|
|
14
|
-
document.getElementById('output').innerHTML += message + '<br>';
|
|
15
|
-
console.log(message);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
log('=== BSV Shamir Standalone Module Test ===');
|
|
19
|
-
log('');
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
if (typeof bsvShamir === 'undefined') {
|
|
23
|
-
log('❌ bsvShamir not available');
|
|
24
|
-
} else {
|
|
25
|
-
log('✅ bsvShamir loaded successfully');
|
|
26
|
-
log('Version: ' + bsvShamir.version);
|
|
27
|
-
log('Algorithm: ' + bsvShamir.algorithm);
|
|
28
|
-
log('');
|
|
29
|
-
|
|
30
|
-
// Test basic functionality
|
|
31
|
-
var secret = 'Hello from Browser!';
|
|
32
|
-
var threshold = 2;
|
|
33
|
-
var shares = 4;
|
|
34
|
-
|
|
35
|
-
log('🔐 Testing secret splitting...');
|
|
36
|
-
log('Secret: ' + secret);
|
|
37
|
-
log('Threshold: ' + threshold + ', Total shares: ' + shares);
|
|
38
|
-
|
|
39
|
-
var splitShares = bsvShamir.split(secret, threshold, shares);
|
|
40
|
-
log('✅ Split into ' + splitShares.length + ' shares');
|
|
41
|
-
|
|
42
|
-
// Test reconstruction
|
|
43
|
-
log('');
|
|
44
|
-
log('🔓 Testing secret reconstruction...');
|
|
45
|
-
var reconstructed = bsvShamir.combine(splitShares.slice(0, threshold));
|
|
46
|
-
var reconstructedSecret = reconstructed.toString();
|
|
47
|
-
|
|
48
|
-
log('Reconstructed: ' + reconstructedSecret);
|
|
49
|
-
|
|
50
|
-
if (reconstructedSecret === secret) {
|
|
51
|
-
log('✅ Reconstruction successful!');
|
|
52
|
-
} else {
|
|
53
|
-
log('❌ Reconstruction failed');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Test share verification
|
|
57
|
-
log('');
|
|
58
|
-
log('🔍 Testing share verification...');
|
|
59
|
-
var validShares = 0;
|
|
60
|
-
for (var i = 0; i < splitShares.length; i++) {
|
|
61
|
-
if (bsvShamir.verifyShare(splitShares[i])) {
|
|
62
|
-
validShares++;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
log('Valid shares: ' + validShares + '/' + splitShares.length);
|
|
66
|
-
|
|
67
|
-
// Run demo
|
|
68
|
-
log('');
|
|
69
|
-
log('🚀 Running demo...');
|
|
70
|
-
var demoResult = bsvShamir.demo();
|
|
71
|
-
log('Demo completed: ' + (demoResult.success ? 'SUCCESS' : 'FAILED'));
|
|
72
|
-
|
|
73
|
-
log('');
|
|
74
|
-
log('🎉 All tests completed successfully!');
|
|
75
|
-
log('📦 BSV Shamir Secret Sharing standalone module is working correctly.');
|
|
76
|
-
}
|
|
77
|
-
} catch (error) {
|
|
78
|
-
log('❌ Error: ' + error.message);
|
|
79
|
-
console.error('Full error:', error);
|
|
80
|
-
}
|
|
81
|
-
</script>
|
|
82
|
-
</body>
|
|
83
|
-
</html>
|
package/tests/unpkg-demo.html
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>SmartLedger BSV - unpkg CDN Demo</title>
|
|
7
|
-
<style>
|
|
8
|
-
body {
|
|
9
|
-
font-family: Arial, sans-serif;
|
|
10
|
-
max-width: 800px;
|
|
11
|
-
margin: 0 auto;
|
|
12
|
-
padding: 20px;
|
|
13
|
-
background: #f5f5f5;
|
|
14
|
-
}
|
|
15
|
-
.demo-section {
|
|
16
|
-
background: white;
|
|
17
|
-
padding: 20px;
|
|
18
|
-
margin: 20px 0;
|
|
19
|
-
border-radius: 8px;
|
|
20
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
21
|
-
}
|
|
22
|
-
h1 { color: #6B46C1; }
|
|
23
|
-
h2 { color: #4C1D95; }
|
|
24
|
-
.result {
|
|
25
|
-
background: #f8f9fa;
|
|
26
|
-
padding: 10px;
|
|
27
|
-
border-left: 4px solid #6B46C1;
|
|
28
|
-
margin: 10px 0;
|
|
29
|
-
font-family: monospace;
|
|
30
|
-
}
|
|
31
|
-
.button {
|
|
32
|
-
background: #6B46C1;
|
|
33
|
-
color: white;
|
|
34
|
-
border: none;
|
|
35
|
-
padding: 10px 20px;
|
|
36
|
-
border-radius: 4px;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
margin: 5px;
|
|
39
|
-
}
|
|
40
|
-
.button:hover { background: #4C1D95; }
|
|
41
|
-
</style>
|
|
42
|
-
</head>
|
|
43
|
-
<body>
|
|
44
|
-
<h1>🚀 SmartLedger BSV v3.0 - unpkg CDN Demo</h1>
|
|
45
|
-
|
|
46
|
-
<div class="demo-section">
|
|
47
|
-
<h2>📦 Loaded from unpkg CDN</h2>
|
|
48
|
-
<p>This page demonstrates SmartLedger BSV loaded directly from unpkg:</p>
|
|
49
|
-
<div class="result">
|
|
50
|
-
<strong>CDN URL:</strong> https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js<br>
|
|
51
|
-
<strong>Package:</strong> smartledger-bsv@3.0.0<br>
|
|
52
|
-
<strong>Size:</strong> ~349KB (minified)
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div class="demo-section">
|
|
57
|
-
<h2>🔐 Security Information</h2>
|
|
58
|
-
<div id="security-info" class="result">Loading...</div>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div class="demo-section">
|
|
62
|
-
<h2>🔑 Generate Bitcoin SV Keys</h2>
|
|
63
|
-
<button class="button" onclick="generateKeys()">Generate New Keys</button>
|
|
64
|
-
<div id="key-results" class="result">Click button to generate keys...</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div class="demo-section">
|
|
68
|
-
<h2>💬 Message Signing (Requires Message Module)</h2>
|
|
69
|
-
<button class="button" onclick="loadMessageModule()">Load Message Module</button>
|
|
70
|
-
<button class="button" onclick="signMessage()">Sign Message</button>
|
|
71
|
-
<div id="message-results" class="result">Load message module first...</div>
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<div class="demo-section">
|
|
75
|
-
<h2>🎲 HD Wallet & Mnemonic (Requires Mnemonic Module)</h2>
|
|
76
|
-
<button class="button" onclick="loadMnemonicModule()">Load Mnemonic Module</button>
|
|
77
|
-
<button class="button" onclick="generateMnemonic()">Generate Mnemonic</button>
|
|
78
|
-
<div id="mnemonic-results" class="result">Load mnemonic module first...</div>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<!-- Main BSV library from unpkg -->
|
|
82
|
-
<script src="https://unpkg.com/smartledger-bsv@3.0.0/bsv.min.js"></script>
|
|
83
|
-
|
|
84
|
-
<script>
|
|
85
|
-
// Display security information
|
|
86
|
-
function showSecurityInfo() {
|
|
87
|
-
const info = document.getElementById('security-info');
|
|
88
|
-
info.innerHTML = `
|
|
89
|
-
<strong>Library:</strong> ${bsv.hardenedBy} BSV ${bsv.version}<br>
|
|
90
|
-
<strong>Base Version:</strong> ${bsv.baseVersion}<br>
|
|
91
|
-
<strong>Security Features:</strong> ${bsv.securityFeatures.join(', ')}<br>
|
|
92
|
-
<strong>Hardened:</strong> ${bsv.isHardened ? 'Yes' : 'No'}<br>
|
|
93
|
-
<strong>SmartLedger Available:</strong> ${bsv.SmartLedger ? 'Yes' : 'No'}
|
|
94
|
-
`;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Generate BSV keys
|
|
98
|
-
function generateKeys() {
|
|
99
|
-
try {
|
|
100
|
-
const privateKey = new bsv.PrivateKey();
|
|
101
|
-
const publicKey = privateKey.toPublicKey();
|
|
102
|
-
const address = privateKey.toAddress();
|
|
103
|
-
|
|
104
|
-
document.getElementById('key-results').innerHTML = `
|
|
105
|
-
<strong>Private Key:</strong> ${privateKey.toString()}<br>
|
|
106
|
-
<strong>Public Key:</strong> ${publicKey.toString()}<br>
|
|
107
|
-
<strong>Address:</strong> ${address.toString()}<br>
|
|
108
|
-
<strong>Network:</strong> ${address.network.name}
|
|
109
|
-
`;
|
|
110
|
-
} catch (error) {
|
|
111
|
-
document.getElementById('key-results').innerHTML = `Error: ${error.message}`;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Load message module dynamically
|
|
116
|
-
function loadMessageModule() {
|
|
117
|
-
const script = document.createElement('script');
|
|
118
|
-
script.src = 'https://unpkg.com/smartledger-bsv@3.0.0/bsv-message.min.js';
|
|
119
|
-
script.onload = () => {
|
|
120
|
-
document.getElementById('message-results').innerHTML = 'Message module loaded! Click "Sign Message" to test.';
|
|
121
|
-
};
|
|
122
|
-
script.onerror = () => {
|
|
123
|
-
document.getElementById('message-results').innerHTML = 'Failed to load message module.';
|
|
124
|
-
};
|
|
125
|
-
document.head.appendChild(script);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Sign a message
|
|
129
|
-
function signMessage() {
|
|
130
|
-
try {
|
|
131
|
-
if (typeof bsvMessage === 'undefined') {
|
|
132
|
-
document.getElementById('message-results').innerHTML = 'Message module not loaded yet.';
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const privateKey = new bsv.PrivateKey();
|
|
137
|
-
const message = new bsvMessage('Hello SmartLedger BSV from unpkg!');
|
|
138
|
-
const signature = message.sign(privateKey);
|
|
139
|
-
|
|
140
|
-
document.getElementById('message-results').innerHTML = `
|
|
141
|
-
<strong>Message:</strong> "Hello SmartLedger BSV from unpkg!"<br>
|
|
142
|
-
<strong>Signature:</strong> ${signature}<br>
|
|
143
|
-
<strong>Address:</strong> ${privateKey.toAddress().toString()}<br>
|
|
144
|
-
<strong>Verified:</strong> ${message.verify(privateKey.toAddress(), signature) ? 'Yes' : 'No'}
|
|
145
|
-
`;
|
|
146
|
-
} catch (error) {
|
|
147
|
-
document.getElementById('message-results').innerHTML = `Error: ${error.message}`;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Load mnemonic module dynamically
|
|
152
|
-
function loadMnemonicModule() {
|
|
153
|
-
const script = document.createElement('script');
|
|
154
|
-
script.src = 'https://unpkg.com/smartledger-bsv@3.0.0/bsv-mnemonic.min.js';
|
|
155
|
-
script.onload = () => {
|
|
156
|
-
document.getElementById('mnemonic-results').innerHTML = 'Mnemonic module loaded! Click "Generate Mnemonic" to test.';
|
|
157
|
-
};
|
|
158
|
-
script.onerror = () => {
|
|
159
|
-
document.getElementById('mnemonic-results').innerHTML = 'Failed to load mnemonic module.';
|
|
160
|
-
};
|
|
161
|
-
document.head.appendChild(script);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Generate mnemonic
|
|
165
|
-
function generateMnemonic() {
|
|
166
|
-
try {
|
|
167
|
-
if (typeof bsvMnemonic === 'undefined') {
|
|
168
|
-
document.getElementById('mnemonic-results').innerHTML = 'Mnemonic module not loaded yet.';
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const mnemonic = new bsvMnemonic();
|
|
173
|
-
const hdPrivateKey = mnemonic.toHDPrivateKey();
|
|
174
|
-
const firstAddress = hdPrivateKey.deriveChild(0).privateKey.toAddress();
|
|
175
|
-
|
|
176
|
-
document.getElementById('mnemonic-results').innerHTML = `
|
|
177
|
-
<strong>Mnemonic:</strong> ${mnemonic.toString()}<br>
|
|
178
|
-
<strong>Word Count:</strong> ${mnemonic.toString().split(' ').length}<br>
|
|
179
|
-
<strong>HD Master Key:</strong> ${hdPrivateKey.toString().substring(0, 50)}...<br>
|
|
180
|
-
<strong>First Address:</strong> ${firstAddress.toString()}
|
|
181
|
-
`;
|
|
182
|
-
} catch (error) {
|
|
183
|
-
document.getElementById('mnemonic-results').innerHTML = `Error: ${error.message}`;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Initialize on page load
|
|
188
|
-
window.addEventListener('load', () => {
|
|
189
|
-
showSecurityInfo();
|
|
190
|
-
console.log('SmartLedger BSV loaded from unpkg:', bsv);
|
|
191
|
-
});
|
|
192
|
-
</script>
|
|
193
|
-
</body>
|
|
194
|
-
</html>
|