jcc_wallet 4.0.0 → 4.0.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.
Files changed (79) hide show
  1. package/dist/jcc-wallet.min.js +21 -26
  2. package/lib/constant.js +0 -1
  3. package/lib/eccrypto.d.ts +12 -0
  4. package/lib/eccrypto.js +116 -0
  5. package/lib/hd/constant.js +0 -1
  6. package/lib/hd/eos.plugin.d.ts +1 -0
  7. package/lib/hd/eos.plugin.js +36 -25
  8. package/lib/hd/ethereum.plugin.d.ts +1 -1
  9. package/lib/hd/ethereum.plugin.js +21 -26
  10. package/lib/hd/index.js +0 -1
  11. package/lib/hd/plugins.js +0 -1
  12. package/lib/hd/swtc.plugin.js +0 -1
  13. package/lib/hd/tron.plugin.js +0 -1
  14. package/lib/index.d.ts +2 -2
  15. package/lib/index.js +2 -4
  16. package/lib/jingchangWallet.d.ts +1 -1
  17. package/lib/jingchangWallet.js +70 -54
  18. package/lib/minify-eosjs/PrivateKey.d.ts +27 -0
  19. package/lib/minify-eosjs/PrivateKey.js +77 -0
  20. package/lib/minify-eosjs/PublicKey.d.ts +25 -0
  21. package/lib/minify-eosjs/PublicKey.js +61 -0
  22. package/lib/minify-eosjs/Signature.d.ts +34 -0
  23. package/lib/minify-eosjs/Signature.js +100 -0
  24. package/lib/minify-eosjs/bn-utils.d.ts +2 -0
  25. package/lib/minify-eosjs/bn-utils.js +17 -0
  26. package/lib/minify-eosjs/eosjs-key-conversions.d.ts +12 -0
  27. package/lib/minify-eosjs/eosjs-key-conversions.js +25 -0
  28. package/lib/minify-eosjs/eosjs-numeric.d.ts +48 -0
  29. package/lib/minify-eosjs/eosjs-numeric.js +303 -0
  30. package/lib/minify-ethereumjs-util/account.js +0 -1
  31. package/lib/minify-ethereumjs-util/bytes.js +0 -1
  32. package/lib/minify-ethereumjs-util/constants.js +0 -1
  33. package/lib/minify-ethereumjs-util/helper.js +0 -1
  34. package/lib/minify-ethereumjs-util/internal.js +0 -1
  35. package/lib/minify-ethereumjs-util/signature.js +0 -1
  36. package/lib/minify-swtc-keypair/address-codec.js +0 -1
  37. package/lib/minify-swtc-keypair/index.js +7 -7
  38. package/lib/minify-swtc-keypair/sha512.js +0 -1
  39. package/lib/minify-swtc-keypair/utils.js +0 -1
  40. package/lib/minify-tron/address.js +0 -1
  41. package/lib/minify-tron/base58.js +0 -1
  42. package/lib/minify-tron/bytes.js +0 -1
  43. package/lib/minify-tron/code.d.ts +1 -1
  44. package/lib/minify-tron/code.js +0 -1
  45. package/lib/minify-tron/crypto.js +3 -4
  46. package/lib/minify-tron/message.d.ts +2 -2
  47. package/lib/minify-tron/message.js +8 -9
  48. package/lib/types.js +0 -1
  49. package/lib/util/index.d.ts +5 -4
  50. package/lib/util/index.js +28 -21
  51. package/package.json +23 -41
  52. package/lib/constant.js.map +0 -1
  53. package/lib/hd/constant.js.map +0 -1
  54. package/lib/hd/eos.plugin.js.map +0 -1
  55. package/lib/hd/ethereum.plugin.js.map +0 -1
  56. package/lib/hd/index.js.map +0 -1
  57. package/lib/hd/plugins.js.map +0 -1
  58. package/lib/hd/swtc.plugin.js.map +0 -1
  59. package/lib/hd/tron.plugin.js.map +0 -1
  60. package/lib/index.js.map +0 -1
  61. package/lib/jingchangWallet.js.map +0 -1
  62. package/lib/minify-ethereumjs-util/account.js.map +0 -1
  63. package/lib/minify-ethereumjs-util/bytes.js.map +0 -1
  64. package/lib/minify-ethereumjs-util/constants.js.map +0 -1
  65. package/lib/minify-ethereumjs-util/helper.js.map +0 -1
  66. package/lib/minify-ethereumjs-util/internal.js.map +0 -1
  67. package/lib/minify-ethereumjs-util/signature.js.map +0 -1
  68. package/lib/minify-swtc-keypair/address-codec.js.map +0 -1
  69. package/lib/minify-swtc-keypair/index.js.map +0 -1
  70. package/lib/minify-swtc-keypair/sha512.js.map +0 -1
  71. package/lib/minify-swtc-keypair/utils.js.map +0 -1
  72. package/lib/minify-tron/address.js.map +0 -1
  73. package/lib/minify-tron/base58.js.map +0 -1
  74. package/lib/minify-tron/bytes.js.map +0 -1
  75. package/lib/minify-tron/code.js.map +0 -1
  76. package/lib/minify-tron/crypto.js.map +0 -1
  77. package/lib/minify-tron/message.js.map +0 -1
  78. package/lib/types.js.map +0 -1
  79. package/lib/util/index.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ /**
2
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
3
+ *
4
+ * rewrite curves
5
+ */
6
+ import BN from "bn.js";
7
+ import { Key, KeyType } from "./eosjs-numeric";
8
+ import { ProjPointType, CurveFn } from "@noble/curves/abstract/weierstrass";
9
+ import { PublicKey, Signature } from "./eosjs-key-conversions";
10
+ /** Represents/stores a private key and provides easy conversion for use with `elliptic` lib */
11
+ export declare class PrivateKey {
12
+ private key;
13
+ private ec;
14
+ constructor(key: Key, ec: CurveFn);
15
+ /** Instantiate private key from an EOSIO-format private key */
16
+ static fromString(keyString: string, ec?: CurveFn): PrivateKey;
17
+ /** Export private key as `elliptic`-format private key */
18
+ toPoint(): ProjPointType<bigint>;
19
+ /** Get key type from key */
20
+ getType(): KeyType;
21
+ /** Retrieve the public key from a private key */
22
+ getPublicKey(): PublicKey;
23
+ /** Sign a message or hashed message digest with private key */
24
+ sign(data: BN, shouldHash?: boolean, encoding?: BufferEncoding): Signature;
25
+ /** Validate a private key */
26
+ isValid(): boolean;
27
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ /**
3
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
4
+ *
5
+ * rewrite curves
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PrivateKey = void 0;
9
+ const eosjs_numeric_1 = require("./eosjs-numeric");
10
+ const eosjs_key_conversions_1 = require("./eosjs-key-conversions");
11
+ /** Represents/stores a private key and provides easy conversion for use with `elliptic` lib */
12
+ class PrivateKey {
13
+ constructor(key, ec) {
14
+ this.key = key;
15
+ this.ec = ec;
16
+ }
17
+ /** Instantiate private key from an EOSIO-format private key */
18
+ static fromString(keyString, ec) {
19
+ const privateKey = (0, eosjs_numeric_1.stringToPrivateKey)(keyString);
20
+ if (!ec) {
21
+ ec = (0, eosjs_key_conversions_1.constructElliptic)(privateKey.type);
22
+ }
23
+ return new PrivateKey(privateKey, ec);
24
+ }
25
+ /** Export private key as `elliptic`-format private key */
26
+ toPoint() {
27
+ return this.ec.ProjectivePoint.fromPrivateKey(this.key.data);
28
+ }
29
+ /** Get key type from key */
30
+ getType() {
31
+ return this.key.type;
32
+ }
33
+ /** Retrieve the public key from a private key */
34
+ getPublicKey() {
35
+ const ellipticPrivateKey = this.toPoint();
36
+ return eosjs_key_conversions_1.PublicKey.fromPoint(ellipticPrivateKey, this.getType(), this.ec);
37
+ }
38
+ /** Sign a message or hashed message digest with private key */
39
+ sign(data, shouldHash = true, encoding = "utf8") {
40
+ if (shouldHash) {
41
+ if (typeof data === "string") {
42
+ data = Buffer.from(data, encoding);
43
+ }
44
+ data = this.ec.CURVE.hash(data);
45
+ }
46
+ let tries = 0;
47
+ let signature;
48
+ const isCanonical = (sigData) => !(sigData[1] & 0x80) &&
49
+ !(sigData[1] === 0 && !(sigData[2] & 0x80)) &&
50
+ !(sigData[33] & 0x80) &&
51
+ !(sigData[33] === 0 && !(sigData[34] & 0x80));
52
+ const constructSignature = (options) => {
53
+ const ellipticSignature = this.ec.sign(data, this.key.data, options);
54
+ return eosjs_key_conversions_1.Signature.fromSignature(ellipticSignature, this.getType(), this.ec);
55
+ };
56
+ if (this.key.type === eosjs_numeric_1.KeyType.k1) {
57
+ do {
58
+ signature = constructSignature({ lowS: true, extraEntropy: Buffer.from([++tries]) });
59
+ } while (!isCanonical(signature.toBinary()));
60
+ }
61
+ else {
62
+ signature = constructSignature({ lowS: true });
63
+ }
64
+ return signature;
65
+ }
66
+ /** Validate a private key */
67
+ isValid() {
68
+ try {
69
+ this.toPoint();
70
+ return true;
71
+ }
72
+ catch (_a) {
73
+ return false;
74
+ }
75
+ }
76
+ }
77
+ exports.PrivateKey = PrivateKey;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
3
+ *
4
+ * rewrite curves
5
+ */
6
+ import { Key, KeyType } from "./eosjs-numeric";
7
+ import { ProjPointType, CurveFn } from "@noble/curves/abstract/weierstrass";
8
+ /** Represents/stores a public key and provides easy conversion for use with `elliptic` lib */
9
+ export declare class PublicKey {
10
+ private key;
11
+ private ec;
12
+ constructor(key: Key, ec: CurveFn);
13
+ /** Instantiate public key from an EOSIO-format public key */
14
+ static fromString(publicKeyStr: string, ec?: CurveFn): PublicKey;
15
+ /** Instantiate public key from an `elliptic`-format public key */
16
+ static fromPoint(publicKey: ProjPointType<bigint>, keyType: KeyType, ec?: CurveFn): PublicKey;
17
+ /** Export public key as Legacy EOSIO-format public key */
18
+ toLegacyString(): string;
19
+ /** Export public key as `elliptic`-format public key */
20
+ toPoint(): ProjPointType<bigint>;
21
+ /** Get key type from key */
22
+ getType(): KeyType;
23
+ /** Validate a public key */
24
+ isValid(): boolean;
25
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
4
+ *
5
+ * rewrite curves
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PublicKey = void 0;
9
+ const eosjs_numeric_1 = require("./eosjs-numeric");
10
+ const eosjs_key_conversions_1 = require("./eosjs-key-conversions");
11
+ const bn_utils_1 = require("./bn-utils");
12
+ /** Represents/stores a public key and provides easy conversion for use with `elliptic` lib */
13
+ class PublicKey {
14
+ constructor(key, ec) {
15
+ this.key = key;
16
+ this.ec = ec;
17
+ }
18
+ /** Instantiate public key from an EOSIO-format public key */
19
+ static fromString(publicKeyStr, ec) {
20
+ const key = (0, eosjs_numeric_1.stringToPublicKey)(publicKeyStr);
21
+ if (!ec) {
22
+ ec = (0, eosjs_key_conversions_1.constructElliptic)(key.type);
23
+ }
24
+ return new PublicKey(key, ec);
25
+ }
26
+ /** Instantiate public key from an `elliptic`-format public key */
27
+ static fromPoint(publicKey, keyType, ec) {
28
+ const x = (0, bn_utils_1.toBEArray)(publicKey.x, 32);
29
+ const y = (0, bn_utils_1.toBEArray)(publicKey.y, 32);
30
+ if (!ec) {
31
+ ec = (0, eosjs_key_conversions_1.constructElliptic)(keyType);
32
+ }
33
+ return new PublicKey({
34
+ type: keyType,
35
+ data: new Uint8Array([y[31] & 1 ? 3 : 2].concat(x))
36
+ }, ec);
37
+ }
38
+ /** Export public key as Legacy EOSIO-format public key */
39
+ toLegacyString() {
40
+ return (0, eosjs_numeric_1.publicKeyToLegacyString)(this.key);
41
+ }
42
+ /** Export public key as `elliptic`-format public key */
43
+ toPoint() {
44
+ return this.ec.ProjectivePoint.fromHex(this.key.data);
45
+ }
46
+ /** Get key type from key */
47
+ getType() {
48
+ return this.key.type;
49
+ }
50
+ /** Validate a public key */
51
+ isValid() {
52
+ try {
53
+ this.toPoint();
54
+ return true;
55
+ }
56
+ catch (_a) {
57
+ return false;
58
+ }
59
+ }
60
+ }
61
+ exports.PublicKey = PublicKey;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
3
+ *
4
+ * rewrite curves
5
+ */
6
+ import { Key, KeyType } from "./eosjs-numeric";
7
+ import { PublicKey } from "./eosjs-key-conversions";
8
+ import { BN } from "bn.js";
9
+ import { CurveFn, SignatureType, RecoveredSignatureType } from "@noble/curves/abstract/weierstrass";
10
+ /** Represents/stores a Signature and provides easy conversion for use with `elliptic` lib */
11
+ export declare class Signature {
12
+ private signature;
13
+ private ec;
14
+ constructor(signature: Key, ec: CurveFn);
15
+ /** Instantiate Signature from an EOSIO-format Signature */
16
+ static fromString(sig: string, ec?: CurveFn): Signature;
17
+ /** Instantiate Signature from an `elliptic`-format Signature */
18
+ static fromSignature(ellipticSig: SignatureType, keyType: KeyType, ec?: CurveFn): Signature;
19
+ /** Export Signature as `elliptic`-format Signature
20
+ * NOTE: This isn't an actual elliptic-format Signature, as ec.Signature is not exported by the library.
21
+ * That's also why the return type is `any`. We're *actually* returning an object with the 3 params
22
+ * not an ec.Signature.
23
+ * Further NOTE: @types/elliptic shows ec.Signature as exported; it is *not*. Hence the `any`.
24
+ */
25
+ toRecoveredSignature(): RecoveredSignatureType;
26
+ /** Export Signature as EOSIO-format Signature */
27
+ toString(): string;
28
+ /** Export Signature in binary format */
29
+ toBinary(): Uint8Array;
30
+ /** Get key type from signature */
31
+ getType(): KeyType;
32
+ /** Recover a public key from a message or hashed message digest and signature */
33
+ recover(data: BN, shouldHash?: boolean, encoding?: BufferEncoding): PublicKey;
34
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /**
3
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
4
+ *
5
+ * rewrite curves
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Signature = void 0;
9
+ const eosjs_numeric_1 = require("./eosjs-numeric");
10
+ const eosjs_key_conversions_1 = require("./eosjs-key-conversions");
11
+ const bn_utils_1 = require("./bn-utils");
12
+ /** Represents/stores a Signature and provides easy conversion for use with `elliptic` lib */
13
+ class Signature {
14
+ constructor(signature, ec) {
15
+ this.signature = signature;
16
+ this.ec = ec;
17
+ }
18
+ /** Instantiate Signature from an EOSIO-format Signature */
19
+ static fromString(sig, ec) {
20
+ const signature = (0, eosjs_numeric_1.stringToSignature)(sig);
21
+ if (!ec) {
22
+ ec = (0, eosjs_key_conversions_1.constructElliptic)(signature.type);
23
+ }
24
+ return new Signature(signature, ec);
25
+ }
26
+ /** Instantiate Signature from an `elliptic`-format Signature */
27
+ static fromSignature(ellipticSig, keyType, ec) {
28
+ const r = (0, bn_utils_1.toBEArray)(ellipticSig.r, 32);
29
+ const s = (0, bn_utils_1.toBEArray)(ellipticSig.s, 32);
30
+ let eosioRecoveryParam;
31
+ if (keyType === eosjs_numeric_1.KeyType.k1 || keyType === eosjs_numeric_1.KeyType.r1) {
32
+ eosioRecoveryParam = ellipticSig.recovery + 27;
33
+ if (ellipticSig.recovery <= 3) {
34
+ eosioRecoveryParam += 4;
35
+ }
36
+ }
37
+ else if (keyType === eosjs_numeric_1.KeyType.wa) {
38
+ eosioRecoveryParam = ellipticSig.recovery;
39
+ }
40
+ const sigData = new Uint8Array([eosioRecoveryParam].concat(r, s));
41
+ if (!ec) {
42
+ ec = (0, eosjs_key_conversions_1.constructElliptic)(keyType);
43
+ }
44
+ return new Signature({
45
+ type: keyType,
46
+ data: sigData
47
+ }, ec);
48
+ }
49
+ /** Export Signature as `elliptic`-format Signature
50
+ * NOTE: This isn't an actual elliptic-format Signature, as ec.Signature is not exported by the library.
51
+ * That's also why the return type is `any`. We're *actually* returning an object with the 3 params
52
+ * not an ec.Signature.
53
+ * Further NOTE: @types/elliptic shows ec.Signature as exported; it is *not*. Hence the `any`.
54
+ */
55
+ toRecoveredSignature() {
56
+ const lengthOfR = 32;
57
+ const lengthOfS = 32;
58
+ const r = (0, bn_utils_1.toBigInt)(this.signature.data.slice(1, lengthOfR + 1));
59
+ const s = (0, bn_utils_1.toBigInt)(this.signature.data.slice(lengthOfR + 1, lengthOfR + lengthOfS + 1));
60
+ let ellipticRecoveryBitField;
61
+ if (this.signature.type === eosjs_numeric_1.KeyType.k1 || this.signature.type === eosjs_numeric_1.KeyType.r1) {
62
+ ellipticRecoveryBitField = this.signature.data[0] - 27;
63
+ if (ellipticRecoveryBitField > 3) {
64
+ ellipticRecoveryBitField -= 4;
65
+ }
66
+ }
67
+ else if (this.signature.type === eosjs_numeric_1.KeyType.wa) {
68
+ ellipticRecoveryBitField = this.signature.data[0];
69
+ }
70
+ const recoveryParam = ellipticRecoveryBitField & 3;
71
+ const sig = new this.ec.Signature(BigInt(r), BigInt(s));
72
+ return sig.addRecoveryBit(recoveryParam);
73
+ }
74
+ /** Export Signature as EOSIO-format Signature */
75
+ toString() {
76
+ return (0, eosjs_numeric_1.signatureToString)(this.signature);
77
+ }
78
+ /** Export Signature in binary format */
79
+ toBinary() {
80
+ return this.signature.data;
81
+ }
82
+ /** Get key type from signature */
83
+ getType() {
84
+ return this.signature.type;
85
+ }
86
+ /** Recover a public key from a message or hashed message digest and signature */
87
+ recover(data, shouldHash = true, encoding = "utf8") {
88
+ if (shouldHash) {
89
+ if (typeof data === "string") {
90
+ data = Buffer.from(data, encoding);
91
+ }
92
+ data = this.ec.CURVE.hash(data);
93
+ }
94
+ const sig = this.toRecoveredSignature();
95
+ const recoveredPublicKey = sig.recoverPublicKey(data);
96
+ const ellipticKPub = this.ec.ProjectivePoint.fromHex(recoveredPublicKey.toHex());
97
+ return eosjs_key_conversions_1.PublicKey.fromPoint(ellipticKPub, this.getType(), this.ec);
98
+ }
99
+ }
100
+ exports.Signature = Signature;
@@ -0,0 +1,2 @@
1
+ export declare const toBEArray: (num: bigint, width: number) => number[];
2
+ export declare const toBigInt: (data: Uint8Array) => bigint;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toBigInt = exports.toBEArray = void 0;
4
+ const toBEArray = (num, width) => {
5
+ const hex = num.toString(16);
6
+ const buf = Buffer.from(hex.padStart(width * 2, "0").slice(0, width * 2), "hex");
7
+ return Array.prototype.slice.call(buf, 0);
8
+ };
9
+ exports.toBEArray = toBEArray;
10
+ const toBigInt = (data) => {
11
+ let encoded = BigInt(0);
12
+ for (let i = 0, l = data.length; i < l; i++) {
13
+ encoded |= BigInt(data[i]) << ((BigInt(l) - BigInt(i) - BigInt(1)) * BigInt(8));
14
+ }
15
+ return encoded;
16
+ };
17
+ exports.toBigInt = toBigInt;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
3
+ *
4
+ * rewrite curves
5
+ */
6
+ import { KeyType } from "./eosjs-numeric";
7
+ export { PrivateKey } from "./PrivateKey";
8
+ export { PublicKey } from "./PublicKey";
9
+ export { Signature } from "./Signature";
10
+ import { CurveFn } from "@noble/curves/abstract/weierstrass";
11
+ /** Construct the elliptic curve object based on key type */
12
+ export declare const constructElliptic: (type: KeyType) => CurveFn;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
4
+ *
5
+ * rewrite curves
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.constructElliptic = exports.Signature = exports.PublicKey = exports.PrivateKey = void 0;
9
+ const eosjs_numeric_1 = require("./eosjs-numeric");
10
+ var PrivateKey_1 = require("./PrivateKey");
11
+ Object.defineProperty(exports, "PrivateKey", { enumerable: true, get: function () { return PrivateKey_1.PrivateKey; } });
12
+ var PublicKey_1 = require("./PublicKey");
13
+ Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return PublicKey_1.PublicKey; } });
14
+ var Signature_1 = require("./Signature");
15
+ Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return Signature_1.Signature; } });
16
+ const secp256k1_1 = require("@noble/curves/secp256k1");
17
+ const p256_1 = require("@noble/curves/p256");
18
+ /** Construct the elliptic curve object based on key type */
19
+ const constructElliptic = (type) => {
20
+ if (type === eosjs_numeric_1.KeyType.k1) {
21
+ return secp256k1_1.secp256k1;
22
+ }
23
+ return p256_1.p256;
24
+ };
25
+ exports.constructElliptic = constructElliptic;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * forked from https://github.com/EOSIO/eosjs/blob/master/src/eosjs-key-conversions.ts
3
+ *
4
+ * rewrite ripemd160
5
+ *
6
+ */
7
+ /**
8
+ * Convert an unsigned base-58 number in `s` to a bignum
9
+ *
10
+ * @param size bignum size (bytes)
11
+ */
12
+ export declare const base58ToBinary: (size: number, s: string) => Uint8Array;
13
+ /**
14
+ * Convert `bignum` to a base-58 number
15
+ *
16
+ * @param minDigits 0-pad result to this many digits
17
+ */
18
+ export declare const binaryToBase58: (bignum: Uint8Array) => string;
19
+ /** Key types this library supports */
20
+ export declare enum KeyType {
21
+ k1 = 0,
22
+ r1 = 1,
23
+ wa = 2
24
+ }
25
+ /** Public key data size, excluding type field */
26
+ export declare const publicKeyDataSize = 33;
27
+ /** Private key data size, excluding type field */
28
+ export declare const privateKeyDataSize = 32;
29
+ /** Signature data size, excluding type field */
30
+ export declare const signatureDataSize = 65;
31
+ /** Public key, private key, or signature in binary form */
32
+ export interface Key {
33
+ type: KeyType;
34
+ data: Uint8Array;
35
+ }
36
+ /** Convert key in `s` to binary form */
37
+ export declare const stringToPublicKey: (s: string) => Key;
38
+ /** Convert public `key` to legacy string (base-58) form */
39
+ export declare const publicKeyToLegacyString: (key: Key) => string;
40
+ /** Convert key in `s` to binary form */
41
+ export declare const stringToPrivateKey: (s: string) => Key;
42
+ /** Convert key in `s` to binary form */
43
+ export declare const stringToSignature: (s: string) => Key;
44
+ /** Convert `signature` to string (base-58) form */
45
+ export declare const signatureToString: (signature: Key) => string;
46
+ export declare const privateKeyToLegacyString: (key: Key) => string;
47
+ /** Convert `key` to string (base-58) form */
48
+ export declare const privateKeyToString: (key: Key) => string;