@exodus/bitcoin-api 2.9.4 → 2.9.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-api",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.5",
|
|
4
4
|
"description": "Exodus bitcoin-api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@exodus/asset-lib": "^4.1.0",
|
|
22
22
|
"@exodus/basic-utils": "^2.1.0",
|
|
23
|
-
"@exodus/bip-schnorr": "0.6.6-fork-1",
|
|
24
23
|
"@exodus/bip44-constants": "^195.0.0",
|
|
25
24
|
"@exodus/bitcoin-lib": "2.3.0",
|
|
26
25
|
"@exodus/currency": "^2.3.2",
|
|
@@ -58,5 +57,5 @@
|
|
|
58
57
|
"jest-when": "^3.5.1",
|
|
59
58
|
"safe-buffer": "^5.2.1"
|
|
60
59
|
},
|
|
61
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "fe502508d90e04ca63c4a7d134c7ef83082f7fce"
|
|
62
61
|
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { initEccLib } from 'bitcoinjs-lib'
|
|
2
|
-
import secp256k1 from '@exodus/secp256k1'
|
|
3
|
-
// TODO: temp import until '@noble/secp256k1' can be used
|
|
4
|
-
import { isPoint } from 'tiny-secp256k1'
|
|
5
|
-
import { common, toPubKey } from './common'
|
|
6
|
-
import schnorr from '@exodus/bip-schnorr'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Wrapper around `secp256k1` in order to follow the bitcoinjs-lib `TinySecp256k1Interface`
|
|
10
|
-
* Schnorr signatures are offered by @exodus/bip-schnorr
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const mobileEcc = {
|
|
15
|
-
...common,
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param message {Uint8Array}
|
|
20
|
-
* @param seckey {Uint8Array}
|
|
21
|
-
* @param extraEntropy {Uint8Array}
|
|
22
|
-
* @returns {Promise<(function(*): Uint8Array)|*>}
|
|
23
|
-
*/
|
|
24
|
-
signAsync: async (message, seckey, extraEntropy) =>
|
|
25
|
-
secp256k1.ecdsaSign(message, seckey, { data: extraEntropy }).signature,
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* @param message {Uint8Array}
|
|
30
|
-
* @param privateKey {Uint8Array}
|
|
31
|
-
* @param extraEntropy {Uint8Array}
|
|
32
|
-
* @returns {Buffer}
|
|
33
|
-
*/
|
|
34
|
-
signSchnorr: (message, privateKey, extraEntropy) =>
|
|
35
|
-
schnorr.sign(privateKey.toString('hex'), message, extraEntropy),
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param message {Uint8Array}
|
|
39
|
-
* @param privateKey {Uint8Array}
|
|
40
|
-
* @param extraEntropy {Uint8Array}
|
|
41
|
-
* @returns {Promise<Buffer>}
|
|
42
|
-
*/
|
|
43
|
-
signSchnorrAsync: async (message, privateKey, extraEntropy) =>
|
|
44
|
-
mobileEcc.signSchnorr(message, privateKey, extraEntropy),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param publicKey {Uint8Array}
|
|
48
|
-
* @param message {Uint8Array}
|
|
49
|
-
* @param signature {Uint8Array}
|
|
50
|
-
* @returns {boolean}
|
|
51
|
-
*/
|
|
52
|
-
verifySchnorr: (publicKey, message, signature) => {
|
|
53
|
-
try {
|
|
54
|
-
schnorr.verify(message, publicKey, signature)
|
|
55
|
-
return true
|
|
56
|
-
} catch {
|
|
57
|
-
return false
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param publicKey {Uint8Array}
|
|
63
|
-
* @param message {Uint8Array}
|
|
64
|
-
* @param signature {Uint8Array}
|
|
65
|
-
* @returns {Promise<boolean>}
|
|
66
|
-
*/
|
|
67
|
-
verifySchnorrAsync: async (publicKey, message, signature) =>
|
|
68
|
-
mobileEcc.verifySchnorr(publicKey, message, signature),
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @param publicKey {Uint8Array}
|
|
72
|
-
* @returns {boolean}
|
|
73
|
-
*/
|
|
74
|
-
isPoint: (publicKey) => {
|
|
75
|
-
try {
|
|
76
|
-
// temp solution secp256k1 does not actually verify the value range, only the data length
|
|
77
|
-
return isPoint(Buffer.from(publicKey))
|
|
78
|
-
} catch {
|
|
79
|
-
return false
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @param publicKey {Uint8Array}
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
*/
|
|
87
|
-
isXOnlyPoint: (publicKey) => {
|
|
88
|
-
try {
|
|
89
|
-
// temp solution secp256k1 does not actually verify the value range, only the data length
|
|
90
|
-
return isPoint(Buffer.from(toPubKey(publicKey)))
|
|
91
|
-
} catch {
|
|
92
|
-
return false
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @param publicKey {Uint8Array}
|
|
98
|
-
*/
|
|
99
|
-
pointCompress: (publicKey, compressed) => secp256k1.publicKeyConvert(publicKey, compressed),
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
initEccLib(mobileEcc)
|