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