]>
Commit | Line | Data |
---|---|---|
8017442c IC |
1 | /* base-x */ |
2 | ||
3aa7677a | 3 | module.exports.basex = require('base-x') |
8017442c | 4 | |
6d2e2020 | 5 | /* base32 */ |
6 | ||
7 | module.exports.base32 = require('base32.js') | |
8 | ||
22f87669 IC |
9 | /* bchaddrjs */ |
10 | ||
3aa7677a | 11 | module.exports.bchaddr = require('bchaddrjs') |
22f87669 IC |
12 | |
13 | /* bchaddrjs slp */ | |
14 | ||
3aa7677a | 15 | module.exports.bchaddrSlp = require('bchaddrjs-slp') |
22f87669 | 16 | |
d9ad938b IC |
17 | /* bech32 */ |
18 | ||
19 | module.exports.bech32 = require('bech32') | |
20 | ||
22f87669 IC |
21 | /* biginteger */ |
22 | ||
3aa7677a | 23 | module.exports.BigInteger = require('javascript-biginteger') |
22f87669 | 24 | |
8017442c IC |
25 | /* bitcoinjs-bip38 */ |
26 | ||
3aa7677a | 27 | module.exports.bip38 = require('bip38') |
8017442c | 28 | |
5e211c69 A |
29 | /* bip85 */ |
30 | ||
31 | module.exports.bip85 = require('bip85') | |
32 | ||
8017442c IC |
33 | /* bitcoinjs-lib */ |
34 | ||
3aa7677a | 35 | module.exports.bitcoin = require('bitcoinjs-lib') |
8017442c | 36 | |
22f87669 IC |
37 | /* buffer */ |
38 | ||
3aa7677a | 39 | module.exports.buffer = require('buffer'); |
22f87669 IC |
40 | |
41 | /* elastos */ | |
42 | // See https://github.com/iancoleman/bip39/pull/368 | |
43 | // and https://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript/tree/iancoleman-bip39 | |
44 | ||
3aa7677a | 45 | module.exports.elastosjs = require('elastos-wallet-js') |
22f87669 | 46 | |
8017442c IC |
47 | /* ethereum-util */ |
48 | ||
3aa7677a | 49 | module.exports.ethUtil = require('ethereumjs-util') |
8017442c | 50 | |
22f87669 IC |
51 | /* fast-levenshtein */ |
52 | ||
3aa7677a | 53 | module.exports.levenshtein = require('fast-levenshtein') |
22f87669 IC |
54 | |
55 | /* groestlcoin */ | |
56 | ||
3aa7677a | 57 | module.exports.groestlcoinjs = require('groestlcoinjs-lib') |
22f87669 IC |
58 | |
59 | /* groestlcoin bip38 */ | |
60 | ||
3aa7677a | 61 | module.exports.groestlcoinjsBip38 = require('bip38grs') |
22f87669 IC |
62 | |
63 | /* kjua qr codes */ | |
64 | ||
3aa7677a | 65 | module.exports.kjua = require('kjua') |
22f87669 IC |
66 | |
67 | /* nebulas */ | |
68 | ||
d07983bc | 69 | try { |
3aa7677a | 70 | module.exports.nebulas = require('nebulas') |
d07983bc IC |
71 | } |
72 | catch (e) { | |
73 | console.warn("Error loading nebulas library"); | |
74 | console.warn(e); | |
75 | }; | |
22f87669 | 76 | |
8017442c IC |
77 | /* stellar-util */ |
78 | ||
79 | let StellarBase = require('stellar-base'); | |
80 | let edHd = require('ed25519-hd-key'); | |
3aa7677a | 81 | module.exports.stellarUtil = { |
8017442c IC |
82 | getKeypair: function (path, seed) { |
83 | const result = edHd.derivePath(path, seed); | |
84 | return StellarBase.Keypair.fromRawEd25519Seed(result.key); | |
85 | }, | |
86 | dummyNetwork: { | |
87 | bip32: {public: 0, private: 0}, | |
88 | messagePrefix: '', | |
89 | pubKeyHash: 0, | |
90 | scriptHash: 0, | |
91 | wif: 0, | |
92 | }, | |
93 | } | |
94 | ||
6d2e2020 | 95 | /* zoobc-util */ |
96 | ||
97 | let base32 = require('base32.js'); | |
98 | let nbl = require('nebulas'); | |
99 | module.exports.zoobcUtil = { | |
100 | getKeypair: function (path, seed) { | |
101 | const { key, chainCode} = edHd.derivePath(path, seed); | |
102 | const pubKey = edHd.getPublicKey(key); | |
103 | return {key,chainCode, pubKey}; | |
104 | }, | |
105 | getZBCAddress(publicKey, prefix = "ZBC") { | |
106 | const prefixDefault = ["ZBC", "ZNK", "ZBL", "ZTX"]; | |
107 | const valid = prefixDefault.indexOf(prefix) > -1; | |
108 | if (valid) { | |
109 | var bytes = new Uint8Array(35); | |
110 | for (let i = 0; i < 32; i++) bytes[i] = publicKey[i]; | |
111 | for (let i = 0; i < 3; i++) bytes[i + 32] = prefix.charCodeAt(i); | |
112 | const checksum = nbl.CryptoUtils.sha3(bytes); | |
113 | for (let i = 0; i < 3; i++) bytes[i + 32] = Number(checksum[i]); | |
114 | var segs = [prefix]; | |
115 | var b32 = base32.encode(bytes); | |
116 | for (let i = 0; i < 7; i++) segs.push(b32.substr(i * 8, 8)); | |
117 | return segs.join("_"); | |
118 | } else { | |
119 | throw new Error("The Prefix not available!"); | |
120 | } | |
121 | } | |
122 | } | |
123 | ||
e0863058 J |
124 | /* nano-util */ |
125 | ||
126 | let NanoBase = require('nanocurrency-web'); | |
127 | module.exports.nanoUtil = { | |
128 | getKeypair: function (index, seed) { | |
129 | const accounts = NanoBase.wallet.accounts(seed, index, index) | |
130 | return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address}; | |
131 | }, | |
132 | dummyNetwork: { | |
133 | bip32: {public: 0, private: 0}, | |
134 | messagePrefix: '', | |
135 | pubKeyHash: 0, | |
136 | scriptHash: 0, | |
137 | wif: 0, | |
138 | }, | |
139 | } | |
140 | ||
22f87669 IC |
141 | /* unorm */ |
142 | ||
3aa7677a | 143 | module.exports.unorm = require('unorm') |
22f87669 IC |
144 | |
145 | /* zxcvbn */ | |
146 | ||
3aa7677a | 147 | module.exports.zxcvbn = require('zxcvbn') |
0e1fd953 | 148 | |
d1d8699f | 149 | /* handshake */ |
0e1fd953 | 150 | module.exports.handshake = require('handshake-util') |
d1d8699f SA |
151 | |
152 | /* bs58 */ | |
153 | try { | |
154 | module.exports.bs58 = require('bs58') | |
155 | } | |
156 | catch (e) { | |
157 | console.warn("Error loading bs58 library"); | |
158 | console.warn(e); | |
159 | }; | |
160 | ||
161 | /* create-hash */ | |
162 | try { | |
163 | module.exports.createHash = require('create-hash') | |
164 | } | |
165 | catch (e) { | |
166 | console.warn("Error loading create-hash library"); | |
167 | console.warn(e); | |
168 | }; | |
169 |