dxs-stas-sdk 1.0.6 → 1.0.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.d.ts","sourceRoot":"","sources":["../../src/bitcoin/private-key.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"private-key.d.ts","sourceRoot":"","sources":["../../src/bitcoin/private-key.ts"],"names":[],"mappings":";AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO1C,qBAAa,UAAU;IACrB,OAAO,CAAC,GAAG,CAAS;IAEpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;gBAEN,EAAE,EAAE,MAAM;IAMtB,IAAI,YAAa,UAAU,YAC4B;IAEvD,MAAM,cAAe,MAAM,WAAW,MAAM,aACC;CAC9C;AAED,eAAO,MAAM,0BAA0B,YAC5B,MAAM,aACJ,MAAM,aACN,MAAM,YAalB,CAAC"}
|
|
@@ -10,10 +10,11 @@ const buffer_1 = require("../buffer");
|
|
|
10
10
|
const hashes_1 = require("../hashes");
|
|
11
11
|
var secp256k1_2 = require("@noble/secp256k1");
|
|
12
12
|
Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return secp256k1_2.verify; } });
|
|
13
|
-
secp256k1_1.
|
|
13
|
+
secp256k1_1.utils.hmacSha256Sync = (key, ...msgs) => (0, hmac_1.hmac)(sha256_1.sha256, key, secp256k1_1.utils.concatBytes(...msgs));
|
|
14
|
+
secp256k1_1.utils.sha256Sync = (...msgs) => (0, sha256_1.sha256)(secp256k1_1.utils.concatBytes(...msgs));
|
|
14
15
|
class PrivateKey {
|
|
15
16
|
constructor(pk) {
|
|
16
|
-
this.sign = (message) => (0, buffer_utils_1.toBuffer)((0, secp256k1_1.
|
|
17
|
+
this.sign = (message) => (0, buffer_utils_1.toBuffer)((0, secp256k1_1.signSync)(message, this._pk, { der: true }));
|
|
17
18
|
this.verify = (signature, message) => (0, secp256k1_1.verify)(signature, message, this.PublicKey);
|
|
18
19
|
this._pk = pk;
|
|
19
20
|
this.PublicKey = (0, buffer_utils_1.toBuffer)((0, secp256k1_1.getPublicKey)(this._pk, true));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-key.js","sourceRoot":"","sources":["../../src/bitcoin/private-key.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"private-key.js","sourceRoot":"","sources":["../../src/bitcoin/private-key.ts"],"names":[],"mappings":";;;AAAA,gDAM0B;AAC1B,6CAA0C;AAC1C,iDAA8C;AAC9C,yDAAgE;AAChE,uCAAoC;AACpC,sCAAyC;AACzC,sCAAoC;AAEpC,8CAA0C;AAAjC,mGAAA,MAAM,OAAA;AAEf,iBAAK,CAAC,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,CACtC,IAAA,WAAI,EAAC,eAAM,EAAE,GAAG,EAAE,iBAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAEhD,iBAAK,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAA,eAAM,EAAC,iBAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAEnE,MAAa,UAAU;IAMrB,YAAY,EAAU;QAMtB,SAAI,GAAG,CAAC,OAAmB,EAAE,EAAE,CAC7B,IAAA,uBAAQ,EAAC,IAAA,oBAAQ,EAAC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAEvD,WAAM,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,EAAE,CAC9C,IAAA,kBAAM,EAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAT3C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,SAAS,GAAG,IAAA,uBAAQ,EAAC,IAAA,wBAAY,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,iBAAO,CAAC,aAAa,CAAC,IAAA,uBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC;CAOF;AAjBD,gCAiBC;AAEM,MAAM,0BAA0B,GAAG,CACxC,OAAe,EACf,SAAiB,EACjB,SAAiB,EACjB,EAAE;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,qBAAY,CAAC,QAAQ,CAClC,IAAA,2BAAY,EAAC,MAAM,CAAC,GAAG,IAAA,2BAAY,EAAC,OAAO,CAAC,CAC7C,CAAC;IAEF,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAE9B,MAAM,GAAG,GAAG,qBAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAE7C,OAAO,IAAA,kBAAM,EAAC,GAAG,EAAE,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AACxD,CAAC,CAAC;AAhBW,QAAA,0BAA0B,8BAgBrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dxs-stas-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "BSV Stas",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"tslint-config-prettier": "^1.18.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@noble/hashes": "^1.
|
|
38
|
-
"@noble/secp256k1": "^
|
|
37
|
+
"@noble/hashes": "^1.2.0",
|
|
38
|
+
"@noble/secp256k1": "^1.7.1",
|
|
39
39
|
"@scure/base": "^1.1.1",
|
|
40
|
-
"@scure/bip32": "^1.
|
|
41
|
-
"@scure/bip39": "^1.
|
|
40
|
+
"@scure/bip32": "^1.1.5",
|
|
41
|
+
"@scure/bip39": "^1.1.1",
|
|
42
42
|
"buffer": "^6.0.3",
|
|
43
43
|
"typedarray-to-buffer": "^4.0.0"
|
|
44
44
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getPublicKey,
|
|
3
|
+
Signature,
|
|
4
|
+
signSync,
|
|
5
|
+
utils,
|
|
6
|
+
verify,
|
|
7
|
+
} from "@noble/secp256k1";
|
|
2
8
|
import { hmac } from "@noble/hashes/hmac";
|
|
3
9
|
import { sha256 } from "@noble/hashes/sha256";
|
|
4
10
|
import { getChunkSize, toBuffer } from "../buffer/buffer-utils";
|
|
@@ -8,10 +14,10 @@ import { hash256 } from "../hashes";
|
|
|
8
14
|
|
|
9
15
|
export { verify } from "@noble/secp256k1";
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
hmac(sha256, key,
|
|
17
|
+
utils.hmacSha256Sync = (key, ...msgs) =>
|
|
18
|
+
hmac(sha256, key, utils.concatBytes(...msgs));
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
utils.sha256Sync = (...msgs) => sha256(utils.concatBytes(...msgs));
|
|
15
21
|
|
|
16
22
|
export class PrivateKey {
|
|
17
23
|
private _pk: Buffer;
|
|
@@ -26,7 +32,7 @@ export class PrivateKey {
|
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
sign = (message: Uint8Array) =>
|
|
29
|
-
toBuffer(
|
|
35
|
+
toBuffer(signSync(message, this._pk, { der: true }));
|
|
30
36
|
|
|
31
37
|
verify = (signature: Buffer, message: Buffer) =>
|
|
32
38
|
verify(signature, message, this.PublicKey);
|