@transia/ripple-keypairs 1.1.6-alpha.3 → 2.0.0

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 (85) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +12 -11
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +42 -102
  5. package/dist/index.js.map +1 -1
  6. package/dist/signing-schemes/ed25519/index.d.ts +4 -0
  7. package/dist/signing-schemes/ed25519/index.d.ts.map +1 -0
  8. package/dist/signing-schemes/ed25519/index.js +38 -0
  9. package/dist/signing-schemes/ed25519/index.js.map +1 -0
  10. package/dist/signing-schemes/secp256k1/index.d.ts +4 -0
  11. package/dist/signing-schemes/secp256k1/index.d.ts.map +1 -0
  12. package/dist/signing-schemes/secp256k1/index.js +43 -0
  13. package/dist/signing-schemes/secp256k1/index.js.map +1 -0
  14. package/dist/{secp256k1.d.ts → signing-schemes/secp256k1/utils.d.ts} +5 -6
  15. package/dist/signing-schemes/secp256k1/utils.d.ts.map +1 -0
  16. package/dist/{secp256k1.js → signing-schemes/secp256k1/utils.js} +17 -43
  17. package/dist/signing-schemes/secp256k1/utils.js.map +1 -0
  18. package/dist/src/index.d.ts +17 -0
  19. package/dist/src/index.d.ts.map +1 -0
  20. package/dist/src/index.js +73 -0
  21. package/dist/src/index.js.map +1 -0
  22. package/dist/src/signing-schemes/ed25519/index.d.ts +4 -0
  23. package/dist/src/signing-schemes/ed25519/index.d.ts.map +1 -0
  24. package/dist/src/signing-schemes/ed25519/index.js +38 -0
  25. package/dist/src/signing-schemes/ed25519/index.js.map +1 -0
  26. package/dist/src/signing-schemes/secp256k1/index.d.ts +4 -0
  27. package/dist/src/signing-schemes/secp256k1/index.d.ts.map +1 -0
  28. package/dist/src/signing-schemes/secp256k1/index.js +43 -0
  29. package/dist/src/signing-schemes/secp256k1/index.js.map +1 -0
  30. package/dist/src/signing-schemes/secp256k1/utils.d.ts +14 -0
  31. package/dist/src/signing-schemes/secp256k1/utils.d.ts.map +1 -0
  32. package/dist/src/signing-schemes/secp256k1/utils.js +71 -0
  33. package/dist/src/signing-schemes/secp256k1/utils.js.map +1 -0
  34. package/dist/src/types.d.ts +17 -0
  35. package/dist/src/types.d.ts.map +1 -0
  36. package/dist/src/types.js +3 -0
  37. package/dist/src/types.js.map +1 -0
  38. package/dist/src/utils/Sha512.d.ts +12 -0
  39. package/dist/src/utils/Sha512.d.ts.map +1 -0
  40. package/dist/src/utils/Sha512.js +33 -0
  41. package/dist/src/utils/Sha512.js.map +1 -0
  42. package/dist/src/utils/assert.d.ts +5 -0
  43. package/dist/src/utils/assert.d.ts.map +1 -0
  44. package/dist/src/utils/assert.js +11 -0
  45. package/dist/src/utils/assert.js.map +1 -0
  46. package/dist/src/utils/getAlgorithmFromKey.d.ts +13 -0
  47. package/dist/src/utils/getAlgorithmFromKey.d.ts.map +1 -0
  48. package/dist/src/utils/getAlgorithmFromKey.js +104 -0
  49. package/dist/src/utils/getAlgorithmFromKey.js.map +1 -0
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/dist/types.d.ts +17 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +3 -0
  54. package/dist/types.js.map +1 -0
  55. package/dist/utils/Sha512.d.ts +12 -0
  56. package/dist/utils/Sha512.d.ts.map +1 -0
  57. package/dist/utils/Sha512.js +33 -0
  58. package/dist/utils/Sha512.js.map +1 -0
  59. package/dist/utils/assert.d.ts +5 -0
  60. package/dist/utils/assert.d.ts.map +1 -0
  61. package/dist/utils/assert.js +11 -0
  62. package/dist/utils/assert.js.map +1 -0
  63. package/dist/utils/getAlgorithmFromKey.d.ts +13 -0
  64. package/dist/utils/getAlgorithmFromKey.d.ts.map +1 -0
  65. package/dist/utils/getAlgorithmFromKey.js +104 -0
  66. package/dist/utils/getAlgorithmFromKey.js.map +1 -0
  67. package/package.json +19 -16
  68. package/src/index.ts +112 -0
  69. package/src/signing-schemes/ed25519/index.ts +56 -0
  70. package/src/signing-schemes/secp256k1/index.ts +64 -0
  71. package/src/signing-schemes/secp256k1/utils.ts +75 -0
  72. package/src/types.ts +35 -0
  73. package/src/utils/Sha512.ts +36 -0
  74. package/src/utils/assert.ts +11 -0
  75. package/src/utils/getAlgorithmFromKey.ts +121 -0
  76. package/dist/Sha512.d.ts +0 -10
  77. package/dist/Sha512.d.ts.map +0 -1
  78. package/dist/Sha512.js +0 -57
  79. package/dist/Sha512.js.map +0 -1
  80. package/dist/secp256k1.d.ts.map +0 -1
  81. package/dist/secp256k1.js.map +0 -1
  82. package/dist/utils.d.ts +0 -6
  83. package/dist/utils.d.ts.map +0 -1
  84. package/dist/utils.js +0 -51
  85. package/dist/utils.js.map +0 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ripple-keypairs [![NPM](https://img.shields.io/npm/v/ripple-keypairs.svg)](https://npmjs.org/package/ripple-keypairs) [![Build Status](https://img.shields.io/travis/ripple/ripple-keypairs/master.svg)](https://travis-ci.org/ripple/ripple-keypairs) ![Codecov](https://img.shields.io/codecov/c/github/ripple/ripple-keypairs)
2
2
 
3
3
  An implementation of XRP Ledger keypairs & wallet generation using
4
- [elliptic](https://github.com/indutny/elliptic) which supports rfc6979 and
4
+ [noble](https://paulmillr.com/noble) which supports rfc6979 and
5
5
  eddsa deterministic signatures.
6
6
 
7
7
  [![NPM](https://nodei.co/npm/ripple-keypairs.png)](https://www.npmjs.org/package/ripple-keypairs)
package/dist/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
- import * as addressCodec from '@transia/ripple-address-codec';
1
+ import { decodeSeed } from '@transia/ripple-address-codec';
2
+ import type { Algorithm, HexString, KeyPair } from './types';
2
3
  declare function generateSeed(options?: {
3
4
  entropy?: Uint8Array;
4
- algorithm?: 'ed25519' | 'ecdsa-secp256k1';
5
+ algorithm?: Algorithm;
5
6
  }): string;
6
- declare function deriveKeypair(seed: string, options?: object): {
7
- publicKey: string;
8
- privateKey: string;
9
- };
10
- declare function sign(messageHex: any, privateKey: any): string;
11
- declare function verify(messageHex: any, signature: any, publicKey: any): boolean;
12
- declare function deriveAddress(publicKey: any): string;
13
- declare function deriveNodeAddress(publicKey: any): string;
14
- declare const decodeSeed: typeof addressCodec.decodeSeed;
7
+ declare function deriveKeypair(seed: string, options?: {
8
+ algorithm?: Algorithm;
9
+ validator?: boolean;
10
+ accountIndex?: number;
11
+ }): KeyPair;
12
+ declare function sign(messageHex: HexString, privateKey: HexString): HexString;
13
+ declare function verify(messageHex: HexString, signature: HexString, publicKey: HexString): boolean;
14
+ declare function deriveAddress(publicKey: string): string;
15
+ declare function deriveNodeAddress(publicKey: string): string;
15
16
  export { generateSeed, deriveKeypair, sign, verify, deriveAddress, deriveNodeAddress, decodeSeed, };
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAA;AAU7D,iBAAS,YAAY,CACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,SAAS,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAA;CACrC,GACL,MAAM,CAQR;AA4ED,iBAAS,aAAa,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACf;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,CAYA;AASD,iBAAS,IAAI,CAAC,UAAU,KAAA,EAAE,UAAU,KAAA,GAAG,MAAM,CAG5C;AAED,iBAAS,MAAM,CAAC,UAAU,KAAA,EAAE,SAAS,KAAA,EAAE,SAAS,KAAA,GAAG,OAAO,CAGzD;AAQD,iBAAS,aAAa,CAAC,SAAS,KAAA,GAAG,MAAM,CAExC;AAED,iBAAS,iBAAiB,CAAC,SAAS,KAAA,GAAG,MAAM,CAI5C;AAED,QAAA,MAAQ,UAAU,gCAAiB,CAAA;AAEnC,OAAO,EACL,YAAY,EACZ,aAAa,EACb,IAAI,EACJ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,UAAU,GACX,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGX,MAAM,+BAA+B,CAAA;AAQtC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAiB,MAAM,SAAS,CAAA;AAc3E,iBAAS,YAAY,CACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,SAAS,CAAC,EAAE,SAAS,CAAA;CACjB,GACL,MAAM,CAUR;AAED,iBAAS,aAAa,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GACA,OAAO,CAcT;AAED,iBAAS,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,GAAG,SAAS,CAGrE;AAED,iBAAS,MAAM,CACb,UAAU,EAAE,SAAS,EACrB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT;AAUD,iBAAS,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,iBAAS,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED,OAAO,EACL,YAAY,EACZ,aAAa,EACb,IAAI,EACJ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,UAAU,GACX,CAAA"}
package/dist/index.js CHANGED
@@ -1,133 +1,73 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.decodeSeed = exports.deriveNodeAddress = exports.deriveAddress = exports.verify = exports.sign = exports.deriveKeypair = exports.generateSeed = void 0;
27
- const assert = __importStar(require("assert"));
28
- const brorand = require("brorand");
29
- const hashjs = __importStar(require("hash.js"));
30
- const elliptic = __importStar(require("elliptic"));
31
- const addressCodec = __importStar(require("@transia/ripple-address-codec"));
32
- const secp256k1_1 = require("./secp256k1");
33
- const utils = __importStar(require("./utils"));
34
- const Ed25519 = elliptic.eddsa('ed25519');
35
- const Secp256k1 = elliptic.ec('secp256k1');
36
- const { hexToBytes } = utils;
37
- const { bytesToHex } = utils;
7
+ const ripple_address_codec_1 = require("@transia/ripple-address-codec");
8
+ Object.defineProperty(exports, "decodeSeed", { enumerable: true, get: function () { return ripple_address_codec_1.decodeSeed; } });
9
+ const ripemd160_1 = require("@transia/isomorphic/ripemd160");
10
+ const sha256_1 = require("@transia/isomorphic/sha256");
11
+ const utils_1 = require("@transia/isomorphic/utils");
12
+ const utils_2 = require("./signing-schemes/secp256k1/utils");
13
+ const Sha512_1 = __importDefault(require("./utils/Sha512"));
14
+ const assert_1 = __importDefault(require("./utils/assert"));
15
+ const getAlgorithmFromKey_1 = require("./utils/getAlgorithmFromKey");
16
+ const secp256k1_1 = __importDefault(require("./signing-schemes/secp256k1"));
17
+ const ed25519_1 = __importDefault(require("./signing-schemes/ed25519"));
18
+ function getSigningScheme(algorithm) {
19
+ const schemes = { 'ecdsa-secp256k1': secp256k1_1.default, ed25519: ed25519_1.default };
20
+ return schemes[algorithm];
21
+ }
38
22
  function generateSeed(options = {}) {
39
- assert.ok(!options.entropy || options.entropy.length >= 16, 'entropy too short');
40
- const entropy = options.entropy ? options.entropy.slice(0, 16) : brorand(16);
23
+ assert_1.default.ok(!options.entropy || options.entropy.length >= 16, 'entropy too short');
24
+ const entropy = options.entropy
25
+ ? options.entropy.slice(0, 16)
26
+ : (0, utils_1.randomBytes)(16);
41
27
  const type = options.algorithm === 'ed25519' ? 'ed25519' : 'secp256k1';
42
- return addressCodec.encodeSeed(Buffer.from(entropy), type);
28
+ return (0, ripple_address_codec_1.encodeSeed)(entropy, type);
43
29
  }
44
30
  exports.generateSeed = generateSeed;
45
- function hash(message) {
46
- return hashjs.sha512().update(message).digest().slice(0, 32);
47
- }
48
- const secp256k1 = {
49
- deriveKeypair(entropy, options) {
50
- const prefix = '00';
51
- const privateKey = prefix + (0, secp256k1_1.derivePrivateKey)(entropy, options).toString(16, 64).toUpperCase();
52
- const publicKey = bytesToHex(Secp256k1.keyFromPrivate(privateKey.slice(2))
53
- .getPublic()
54
- .encodeCompressed());
55
- return { privateKey, publicKey };
56
- },
57
- sign(message, privateKey) {
58
- return bytesToHex(Secp256k1.sign(hash(message), hexToBytes(privateKey), {
59
- canonical: true,
60
- }).toDER());
61
- },
62
- verify(message, signature, publicKey) {
63
- return Secp256k1.verify(hash(message), signature, hexToBytes(publicKey));
64
- },
65
- };
66
- const ed25519 = {
67
- deriveKeypair(entropy) {
68
- const prefix = 'ED';
69
- const rawPrivateKey = hash(entropy);
70
- const privateKey = prefix + bytesToHex(rawPrivateKey);
71
- const publicKey = prefix + bytesToHex(Ed25519.keyFromSecret(rawPrivateKey).pubBytes());
72
- return { privateKey, publicKey };
73
- },
74
- sign(message, privateKey) {
75
- // caution: Ed25519.sign interprets all strings as hex, stripping
76
- // any non-hex characters without warning
77
- assert.ok(Array.isArray(message), 'message must be array of octets');
78
- return bytesToHex(Ed25519.sign(message, hexToBytes(privateKey).slice(1)).toBytes());
79
- },
80
- verify(message, signature, publicKey) {
81
- return Ed25519.verify(message, hexToBytes(signature), hexToBytes(publicKey).slice(1));
82
- },
83
- };
84
- function select(algorithm) {
85
- const methods = { 'ecdsa-secp256k1': secp256k1, ed25519 };
86
- return methods[algorithm];
87
- }
88
31
  function deriveKeypair(seed, options) {
89
- const decoded = addressCodec.decodeSeed(seed);
90
- const algorithm = decoded.type === 'ed25519' ? 'ed25519' : 'ecdsa-secp256k1';
91
- const method = select(algorithm);
92
- const keypair = method.deriveKeypair(decoded.bytes, options);
93
- const messageToVerify = hash('This test message should verify.');
94
- const signature = method.sign(messageToVerify, keypair.privateKey);
32
+ var _a;
33
+ const decoded = (0, ripple_address_codec_1.decodeSeed)(seed);
34
+ const proposedAlgorithm = (_a = options === null || options === void 0 ? void 0 : options.algorithm) !== null && _a !== void 0 ? _a : decoded.type;
35
+ const algorithm = proposedAlgorithm === 'ed25519' ? 'ed25519' : 'ecdsa-secp256k1';
36
+ const scheme = getSigningScheme(algorithm);
37
+ const keypair = scheme.deriveKeypair(decoded.bytes, options);
38
+ const messageToVerify = Sha512_1.default.half('This test message should verify.');
39
+ const signature = scheme.sign(messageToVerify, keypair.privateKey);
95
40
  /* istanbul ignore if */
96
- if (method.verify(messageToVerify, signature, keypair.publicKey) !== true) {
41
+ if (!scheme.verify(messageToVerify, signature, keypair.publicKey)) {
97
42
  throw new Error('derived keypair did not generate verifiable signature');
98
43
  }
99
44
  return keypair;
100
45
  }
101
46
  exports.deriveKeypair = deriveKeypair;
102
- function getAlgorithmFromKey(key) {
103
- const bytes = hexToBytes(key);
104
- return bytes.length === 33 && bytes[0] === 0xed
105
- ? 'ed25519'
106
- : 'ecdsa-secp256k1';
107
- }
108
47
  function sign(messageHex, privateKey) {
109
- const algorithm = getAlgorithmFromKey(privateKey);
110
- return select(algorithm).sign(hexToBytes(messageHex), privateKey);
48
+ const algorithm = (0, getAlgorithmFromKey_1.getAlgorithmFromPrivateKey)(privateKey);
49
+ return getSigningScheme(algorithm).sign((0, utils_1.hexToBytes)(messageHex), privateKey);
111
50
  }
112
51
  exports.sign = sign;
113
52
  function verify(messageHex, signature, publicKey) {
114
- const algorithm = getAlgorithmFromKey(publicKey);
115
- return select(algorithm).verify(hexToBytes(messageHex), signature, publicKey);
53
+ const algorithm = (0, getAlgorithmFromKey_1.getAlgorithmFromPublicKey)(publicKey);
54
+ return getSigningScheme(algorithm).verify((0, utils_1.hexToBytes)(messageHex), signature, publicKey);
116
55
  }
117
56
  exports.verify = verify;
57
+ function computePublicKeyHash(publicKeyBytes) {
58
+ return (0, ripemd160_1.ripemd160)((0, sha256_1.sha256)(publicKeyBytes));
59
+ }
118
60
  function deriveAddressFromBytes(publicKeyBytes) {
119
- return addressCodec.encodeAccountID(utils.computePublicKeyHash(publicKeyBytes));
61
+ return (0, ripple_address_codec_1.encodeAccountID)(computePublicKeyHash(publicKeyBytes));
120
62
  }
121
63
  function deriveAddress(publicKey) {
122
- return deriveAddressFromBytes(Buffer.from(hexToBytes(publicKey)));
64
+ return deriveAddressFromBytes((0, utils_1.hexToBytes)(publicKey));
123
65
  }
124
66
  exports.deriveAddress = deriveAddress;
125
67
  function deriveNodeAddress(publicKey) {
126
- const generatorBytes = addressCodec.decodeNodePublic(publicKey);
127
- const accountPublicBytes = (0, secp256k1_1.accountPublicFromPublicGenerator)(generatorBytes);
68
+ const generatorBytes = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
69
+ const accountPublicBytes = (0, utils_2.accountPublicFromPublicGenerator)(generatorBytes);
128
70
  return deriveAddressFromBytes(accountPublicBytes);
129
71
  }
130
72
  exports.deriveNodeAddress = deriveNodeAddress;
131
- const { decodeSeed } = addressCodec;
132
- exports.decodeSeed = decodeSeed;
133
73
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,mCAAmC;AACnC,gDAAiC;AACjC,mDAAoC;AAEpC,4EAA6D;AAC7D,2CAAgF;AAChF,+CAAgC;AAEhC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;AACzC,MAAM,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;AAE1C,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;AAC5B,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;AAE5B,SAAS,YAAY,CACnB,UAGI,EAAE;IAEN,MAAM,CAAC,EAAE,CACP,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,EAChD,mBAAmB,CACpB,CAAA;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC5E,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAA;IACtE,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAA;AAC5D,CAAC;AAoIC,oCAAY;AAlId,SAAS,IAAI,CAAC,OAAO;IACnB,OAAO,MAAM,CAAC,MAAM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,MAAM,CACb,UAAqB,EACrB,SAAoB,EACpB,SAAoB;IAEpB,MAAM,SAAS,GAAG,IAAA,+CAAyB,EAAC,SAAS,CAAC,CAAA;IACtD,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CACvC,IAAA,kBAAU,EAAC,UAAU,CAAC,EACtB,SAAS,EACT,SAAS,CACV,CAAA;AACH,CAAC;AAwBC,wBAAM;AAtBR,SAAS,oBAAoB,CAAC,cAA0B;IACtD,OAAO,IAAA,qBAAS,EAAC,IAAA,eAAM,EAAC,cAAc,CAAC,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,sBAAsB,CAAC,cAA0B;IACxD,OAAO,IAAA,sCAAe,EAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,OAAO,sBAAsB,CAAC,IAAA,kBAAU,EAAC,SAAS,CAAC,CAAC,CAAA;AACtD,CAAC;AAaC,sCAAa;AAXf,SAAS,iBAAiB,CAAC,SAAiB;IAC1C,MAAM,cAAc,GAAG,IAAA,uCAAgB,EAAC,SAAS,CAAC,CAAA;IAClD,MAAM,kBAAkB,GAAG,IAAA,wCAAgC,EAAC,cAAc,CAAC,CAAA;IAC3E,OAAO,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;AACnD,CAAC;AAQC,8CAAiB"}
@@ -0,0 +1,4 @@
1
+ import type { SigningScheme } from '../../types';
2
+ declare const ed25519: SigningScheme;
3
+ export default ed25519;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signing-schemes/ed25519/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,aAAa,CAAA;AAM3D,QAAA,MAAM,OAAO,EAAE,aA4Cd,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ed25519_1 = require("@noble/curves/ed25519");
7
+ const utils_1 = require("@transia/isomorphic/utils");
8
+ const assert_1 = __importDefault(require("../../utils/assert"));
9
+ const Sha512_1 = __importDefault(require("../../utils/Sha512"));
10
+ const ED_PREFIX = 'ED';
11
+ const ed25519 = {
12
+ deriveKeypair(entropy) {
13
+ const rawPrivateKey = Sha512_1.default.half(entropy);
14
+ const privateKey = ED_PREFIX + (0, utils_1.bytesToHex)(rawPrivateKey);
15
+ const publicKey = ED_PREFIX + (0, utils_1.bytesToHex)(ed25519_1.ed25519.getPublicKey(rawPrivateKey));
16
+ return { privateKey, publicKey };
17
+ },
18
+ sign(message, privateKey) {
19
+ assert_1.default.ok(message instanceof Uint8Array, 'message must be array of octets');
20
+ assert_1.default.ok(privateKey.length === 66, 'private key must be 33 bytes including prefix');
21
+ return (0, utils_1.bytesToHex)(ed25519_1.ed25519.sign(message, privateKey.slice(2)));
22
+ },
23
+ verify(message, signature, publicKey) {
24
+ // Unlikely to be triggered as these are internal and guarded by getAlgorithmFromKey
25
+ assert_1.default.ok(publicKey.length === 66, 'public key must be 33 bytes including prefix');
26
+ return ed25519_1.ed25519.verify(signature, message,
27
+ // Remove the 0xED prefix
28
+ publicKey.slice(2),
29
+ // By default, set zip215 to false for compatibility reasons.
30
+ // ZIP 215 is a stricter Ed25519 signature verification scheme.
31
+ // However, setting it to false adheres to the more commonly used
32
+ // RFC8032 / NIST186-5 standards, making it compatible with systems
33
+ // like the XRP Ledger.
34
+ { zip215: false });
35
+ },
36
+ };
37
+ exports.default = ed25519;
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signing-schemes/ed25519/index.ts"],"names":[],"mappings":";;;;;AAAA,mDAA+D;AAC/D,qDAAsD;AAGt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types';
2
+ declare const secp256k1: SigningScheme;
3
+ export default secp256k1;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signing-schemes/secp256k1/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGV,aAAa,EACd,MAAM,aAAa,CAAA;AAQpB,QAAA,MAAM,SAAS,EAAE,aA6ChB,CAAA;AAED,eAAe,SAAS,CAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("@noble/curves/abstract/utils");
7
+ const secp256k1_1 = require("@noble/curves/secp256k1");
8
+ const utils_2 = require("@transia/isomorphic/utils");
9
+ const utils_3 = require("./utils");
10
+ const assert_1 = __importDefault(require("../../utils/assert"));
11
+ const Sha512_1 = __importDefault(require("../../utils/Sha512"));
12
+ const SECP256K1_PREFIX = '00';
13
+ const secp256k1 = {
14
+ deriveKeypair(entropy, options) {
15
+ const derived = (0, utils_3.derivePrivateKey)(entropy, options);
16
+ const privateKey = SECP256K1_PREFIX + (0, utils_2.bytesToHex)((0, utils_1.numberToBytesBE)(derived, 32));
17
+ const publicKey = (0, utils_2.bytesToHex)(secp256k1_1.secp256k1.getPublicKey(derived, true));
18
+ return { privateKey, publicKey };
19
+ },
20
+ sign(message, privateKey) {
21
+ // Some callers pass the privateKey with the prefix, others without.
22
+ // @noble/curves will throw if the key is not exactly 32 bytes, so we
23
+ // normalize it before passing to the sign method.
24
+ assert_1.default.ok((privateKey.length === 66 && privateKey.startsWith(SECP256K1_PREFIX)) ||
25
+ privateKey.length === 64);
26
+ const normedPrivateKey = privateKey.length === 66 ? privateKey.slice(2) : privateKey;
27
+ return secp256k1_1.secp256k1
28
+ .sign(Sha512_1.default.half(message), normedPrivateKey, {
29
+ // "Canonical" signatures
30
+ lowS: true,
31
+ // Would fail tests if signatures aren't deterministic
32
+ extraEntropy: undefined,
33
+ })
34
+ .toDERHex(true)
35
+ .toUpperCase();
36
+ },
37
+ verify(message, signature, publicKey) {
38
+ const decoded = secp256k1_1.secp256k1.Signature.fromDER(signature);
39
+ return secp256k1_1.secp256k1.verify(decoded, Sha512_1.default.half(message), publicKey);
40
+ },
41
+ };
42
+ exports.default = secp256k1;
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signing-schemes/secp256k1/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA8D;AAC9D,uDAAqE;AACrE,qDAAsD;AAQtD,mCAA0C;AAC1C,gEAAuC;AACvC,gEAAuC;AAEvC,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAE7B,MAAM,SAAS,GAAkB;IAC/B,aAAa,CACX,OAAmB,EACnB,OAA8B;QAK9B,MAAM,OAAO,GAAG,IAAA,wBAAgB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClD,MAAM,UAAU,GACd,gBAAgB,GAAG,IAAA,kBAAU,EAAC,IAAA,uBAAe,EAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;QAE7D,MAAM,SAAS,GAAG,IAAA,kBAAU,EAAC,qBAAc,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;QACxE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA;IAClC,CAAC;IAED,IAAI,CAAC,OAAmB,EAAE,UAAqB;QAC7C,oEAAoE;QACpE,qEAAqE;QACrE,kDAAkD;QAClD,gBAAM,CAAC,EAAE,CACP,CAAC,UAAU,CAAC,MAAM,KAAK,EAAE,IAAI,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;YACnE,UAAU,CAAC,MAAM,KAAK,EAAE,CAC3B,CAAA;QACD,MAAM,gBAAgB,GACpB,UAAU,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAA;QAC7D,OAAO,qBAAc;aAClB,IAAI,CAAC,gBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB,EAAE;YAC5C,yBAAyB;YACzB,IAAI,EAAE,IAAI;YACV,sDAAsD;YACtD,YAAY,EAAE,SAAS;SACxB,CAAC;aACD,QAAQ,CAAC,IAAI,CAAC;aACd,WAAW,EAAE,CAAA;IAClB,CAAC;IAED,MAAM,CACJ,OAAmB,EACnB,SAAoB,EACpB,SAAoB;QAEpB,MAAM,OAAO,GAAG,qBAAc,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAC3D,OAAO,qBAAc,CAAC,MAAM,CAAC,OAAO,EAAE,gBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,SAAS,CAAA"}
@@ -4,12 +4,11 @@
4
4
  * @param [opts.accountIndex=0] - The account number to generate.
5
5
  * @param [opts.validator=false] - Generate root key-pair,
6
6
  * as used by validators.
7
- * @returns {bn.js} 256 bit scalar value.
8
- *
7
+ * @returns {bigint} 256 bit scalar value.
9
8
  */
10
- export declare function derivePrivateKey(seed: any, opts?: {
9
+ export declare function derivePrivateKey(seed: Uint8Array, opts?: {
11
10
  validator?: boolean;
12
11
  accountIndex?: number;
13
- }): any;
14
- export declare function accountPublicFromPublicGenerator(publicGenBytes: any): any;
15
- //# sourceMappingURL=secp256k1.d.ts.map
12
+ }): bigint;
13
+ export declare function accountPublicFromPublicGenerator(publicGenBytes: Uint8Array): Uint8Array;
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/signing-schemes/secp256k1/utils.ts"],"names":[],"mappings":"AAmCA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACjB,GACL,MAAM,CAiBR;AAED,wBAAgB,gCAAgC,CAAC,cAAc,EAAE,UAAU,cAM1E"}
@@ -1,39 +1,16 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.accountPublicFromPublicGenerator = exports.derivePrivateKey = void 0;
30
- const elliptic = __importStar(require("elliptic"));
31
- const Sha512_1 = __importDefault(require("./Sha512"));
32
- const secp256k1 = elliptic.ec('secp256k1');
7
+ const secp256k1_1 = require("@noble/curves/secp256k1");
8
+ const Sha512_1 = __importDefault(require("../../utils/Sha512"));
9
+ const ZERO = BigInt(0);
33
10
  function deriveScalar(bytes, discrim) {
34
- const order = secp256k1.curve.n;
35
- for (let i = 0; i <= 0xffffffff; i++) {
36
- // We hash the bytes to find a 256 bit number, looping until we are sure it
11
+ const order = secp256k1_1.secp256k1.CURVE.n;
12
+ for (let i = 0; i <= 4294967295; i++) {
13
+ // We hash the bytes to find a 256-bit number, looping until we are sure it
37
14
  // is less than the order of the curve.
38
15
  const hasher = new Sha512_1.default().add(bytes);
39
16
  // If the optional discriminator index was passed in, update the hash.
@@ -41,9 +18,9 @@ function deriveScalar(bytes, discrim) {
41
18
  hasher.addU32(discrim);
42
19
  }
43
20
  hasher.addU32(i);
44
- const key = hasher.first256BN();
21
+ const key = hasher.first256BigInt();
45
22
  /* istanbul ignore else */
46
- if (key.cmpn(0) > 0 && key.cmp(order) < 0) {
23
+ if (key > ZERO && key < order) {
47
24
  return key;
48
25
  }
49
26
  }
@@ -53,7 +30,7 @@ function deriveScalar(bytes, discrim) {
53
30
  // How often will an (essentially) random number generated by Sha512 be larger than that?
54
31
  // There's 2^32 chances (the for loop) to get a number smaller than the order,
55
32
  // and it's rare that you'll even get past the first loop iteration.
56
- // Note that in TypeScript we actually need the throw, otherwise the function signature would be BN | undefined
33
+ // Note that in TypeScript we actually need the throw, otherwise the function signature would be bigint | undefined
57
34
  //
58
35
  /* istanbul ignore next */
59
36
  throw new Error('impossible unicorn ;)');
@@ -64,12 +41,11 @@ function deriveScalar(bytes, discrim) {
64
41
  * @param [opts.accountIndex=0] - The account number to generate.
65
42
  * @param [opts.validator=false] - Generate root key-pair,
66
43
  * as used by validators.
67
- * @returns {bn.js} 256 bit scalar value.
68
- *
44
+ * @returns {bigint} 256 bit scalar value.
69
45
  */
70
46
  function derivePrivateKey(seed, opts = {}) {
71
47
  const root = opts.validator;
72
- const order = secp256k1.curve.n;
48
+ const order = secp256k1_1.secp256k1.CURVE.n;
73
49
  // This private generator represents the `root` private key, and is what's
74
50
  // used by validators for signing when a keypair is generated from a seed.
75
51
  const privateGen = deriveScalar(seed);
@@ -77,21 +53,19 @@ function derivePrivateKey(seed, opts = {}) {
77
53
  // As returned by validation_create for a given seed
78
54
  return privateGen;
79
55
  }
80
- const publicGen = secp256k1.g.mul(privateGen);
56
+ const publicGen = secp256k1_1.secp256k1.ProjectivePoint.BASE.multiply(privateGen).toRawBytes(true);
81
57
  // A seed can generate many keypairs as a function of the seed and a uint32.
82
58
  // Almost everyone just uses the first account, `0`.
83
59
  const accountIndex = opts.accountIndex || 0;
84
- return deriveScalar(publicGen.encodeCompressed(), accountIndex)
85
- .add(privateGen)
86
- .mod(order);
60
+ return (deriveScalar(publicGen, accountIndex) + privateGen) % order;
87
61
  }
88
62
  exports.derivePrivateKey = derivePrivateKey;
89
63
  function accountPublicFromPublicGenerator(publicGenBytes) {
90
- const rootPubPoint = secp256k1.curve.decodePoint(publicGenBytes);
64
+ const rootPubPoint = secp256k1_1.secp256k1.ProjectivePoint.fromHex(publicGenBytes);
91
65
  const scalar = deriveScalar(publicGenBytes, 0);
92
- const point = secp256k1.g.mul(scalar);
66
+ const point = secp256k1_1.secp256k1.ProjectivePoint.BASE.multiply(scalar);
93
67
  const offset = rootPubPoint.add(point);
94
- return offset.encodeCompressed();
68
+ return offset.toRawBytes(true);
95
69
  }
96
70
  exports.accountPublicFromPublicGenerator = accountPublicFromPublicGenerator;
97
- //# sourceMappingURL=secp256k1.js.map
71
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/signing-schemes/secp256k1/utils.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAmD;AAEnD,gEAAuC;AAEvC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;AAEtB,SAAS,YAAY,CAAC,KAAiB,EAAE,OAAgB;IACvD,MAAM,KAAK,GAAG,qBAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAW,EAAE,CAAC,EAAE,EAA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AU,CAAC,GAAG,KAAK,CAAA;AACrE,CAAC;AAvBD,4CAuBC;AAED,SAAgB,gCAAgC,CAAC,cAA0B;IACzE,MAAM,YAAY,GAAG,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACtE,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAC9C,MAAM,KAAK,GAAG,qBAAS,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7D,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AAChC,CAAC;AAND,4EAMC"}
@@ -0,0 +1,17 @@
1
+ import { decodeSeed } from '@transia/ripple-address-codec';
2
+ import type { Algorithm, HexString, KeyPair } from './types';
3
+ declare function generateSeed(options?: {
4
+ entropy?: Uint8Array;
5
+ algorithm?: Algorithm;
6
+ }): string;
7
+ declare function deriveKeypair(seed: string, options?: {
8
+ algorithm?: Algorithm;
9
+ validator?: boolean;
10
+ accountIndex?: number;
11
+ }): KeyPair;
12
+ declare function sign(messageHex: HexString, privateKey: HexString): HexString;
13
+ declare function verify(messageHex: HexString, signature: HexString, publicKey: HexString): boolean;
14
+ declare function deriveAddress(publicKey: string): string;
15
+ declare function deriveNodeAddress(publicKey: string): string;
16
+ export { generateSeed, deriveKeypair, sign, verify, deriveAddress, deriveNodeAddress, decodeSeed, };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGX,MAAM,+BAA+B,CAAA;AAQtC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAiB,MAAM,SAAS,CAAA;AAc3E,iBAAS,YAAY,CACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,SAAS,CAAC,EAAE,SAAS,CAAA;CACjB,GACL,MAAM,CAUR;AAED,iBAAS,aAAa,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GACA,OAAO,CAcT;AAED,iBAAS,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,GAAG,SAAS,CAGrE;AAED,iBAAS,MAAM,CACb,UAAU,EAAE,SAAS,EACrB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT;AAUD,iBAAS,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,iBAAS,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED,OAAO,EACL,YAAY,EACZ,aAAa,EACb,IAAI,EACJ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,UAAU,GACX,CAAA"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.decodeSeed = exports.deriveNodeAddress = exports.deriveAddress = exports.verify = exports.sign = exports.deriveKeypair = exports.generateSeed = void 0;
7
+ const ripple_address_codec_1 = require("@transia/ripple-address-codec");
8
+ Object.defineProperty(exports, "decodeSeed", { enumerable: true, get: function () { return ripple_address_codec_1.decodeSeed; } });
9
+ const ripemd160_1 = require("@transia/isomorphic/ripemd160");
10
+ const sha256_1 = require("@transia/isomorphic/sha256");
11
+ const utils_1 = require("@transia/isomorphic/utils");
12
+ const utils_2 = require("./signing-schemes/secp256k1/utils");
13
+ const Sha512_1 = __importDefault(require("./utils/Sha512"));
14
+ const assert_1 = __importDefault(require("./utils/assert"));
15
+ const getAlgorithmFromKey_1 = require("./utils/getAlgorithmFromKey");
16
+ const secp256k1_1 = __importDefault(require("./signing-schemes/secp256k1"));
17
+ const ed25519_1 = __importDefault(require("./signing-schemes/ed25519"));
18
+ function getSigningScheme(algorithm) {
19
+ const schemes = { 'ecdsa-secp256k1': secp256k1_1.default, ed25519: ed25519_1.default };
20
+ return schemes[algorithm];
21
+ }
22
+ function generateSeed(options = {}) {
23
+ assert_1.default.ok(!options.entropy || options.entropy.length >= 16, 'entropy too short');
24
+ const entropy = options.entropy
25
+ ? options.entropy.slice(0, 16)
26
+ : (0, utils_1.randomBytes)(16);
27
+ const type = options.algorithm === 'ed25519' ? 'ed25519' : 'secp256k1';
28
+ return (0, ripple_address_codec_1.encodeSeed)(entropy, type);
29
+ }
30
+ exports.generateSeed = generateSeed;
31
+ function deriveKeypair(seed, options) {
32
+ var _a;
33
+ const decoded = (0, ripple_address_codec_1.decodeSeed)(seed);
34
+ const proposedAlgorithm = (_a = options === null || options === void 0 ? void 0 : options.algorithm) !== null && _a !== void 0 ? _a : decoded.type;
35
+ const algorithm = proposedAlgorithm === 'ed25519' ? 'ed25519' : 'ecdsa-secp256k1';
36
+ const scheme = getSigningScheme(algorithm);
37
+ const keypair = scheme.deriveKeypair(decoded.bytes, options);
38
+ const messageToVerify = Sha512_1.default.half('This test message should verify.');
39
+ const signature = scheme.sign(messageToVerify, keypair.privateKey);
40
+ /* istanbul ignore if */
41
+ if (!scheme.verify(messageToVerify, signature, keypair.publicKey)) {
42
+ throw new Error('derived keypair did not generate verifiable signature');
43
+ }
44
+ return keypair;
45
+ }
46
+ exports.deriveKeypair = deriveKeypair;
47
+ function sign(messageHex, privateKey) {
48
+ const algorithm = (0, getAlgorithmFromKey_1.getAlgorithmFromPrivateKey)(privateKey);
49
+ return getSigningScheme(algorithm).sign((0, utils_1.hexToBytes)(messageHex), privateKey);
50
+ }
51
+ exports.sign = sign;
52
+ function verify(messageHex, signature, publicKey) {
53
+ const algorithm = (0, getAlgorithmFromKey_1.getAlgorithmFromPublicKey)(publicKey);
54
+ return getSigningScheme(algorithm).verify((0, utils_1.hexToBytes)(messageHex), signature, publicKey);
55
+ }
56
+ exports.verify = verify;
57
+ function computePublicKeyHash(publicKeyBytes) {
58
+ return (0, ripemd160_1.ripemd160)((0, sha256_1.sha256)(publicKeyBytes));
59
+ }
60
+ function deriveAddressFromBytes(publicKeyBytes) {
61
+ return (0, ripple_address_codec_1.encodeAccountID)(computePublicKeyHash(publicKeyBytes));
62
+ }
63
+ function deriveAddress(publicKey) {
64
+ return deriveAddressFromBytes((0, utils_1.hexToBytes)(publicKey));
65
+ }
66
+ exports.deriveAddress = deriveAddress;
67
+ function deriveNodeAddress(publicKey) {
68
+ const generatorBytes = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
69
+ const accountPublicBytes = (0, utils_2.accountPublicFromPublicGenerator)(generatorBytes);
70
+ return deriveAddressFromBytes(accountPublicBytes);
71
+ }
72
+ exports.deriveNodeAddress = deriveNodeAddress;
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,wEAKsC;AAyGpC,2FA5GA,iCAAU,OA4GA;AAxGZ,6DAAyD;AACzD,uDAAmD;AACnD,qDAAmE;AAEnE,6DAAoF;AACpF,4DAAmC;AACnC,4DAAmC;AAEnC,qEAGoC;AAEpC,4EAAmD;AACnD,wEAA+C;AAE/C,SAAS,gBAAgB,CAAC,SAAoB;IAC5C,MAAM,OAAO,GAAG,EAAE,iBAAiB,EAAE,mBAAS,EAAE,OAAO,EAAP,iBAAO,EAAE,CAAA;IACzD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAA;AAC3B,CAAC;AAED,SAAS,YAAY,CACnB,UAGI,EAAE;IAEN,gBAAM,CAAC,EAAE,CACP,CAAC,OAAO,CAAC,OAAO,IAA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Scheme;
3
+ export default ed25519;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/signing-schemes/ed25519/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,aAAa,CAAA;AAM3D,QAAA,MAAM,OAAO,EAAE,aA4Cd,CAAA;AAED,eAAe,OAAO,CAAA"}