@sphereon/ssi-sdk-ext.mnemonic-seed-manager 0.11.1-next.4

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 (55) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/dist/agent/MnemonicSeedManager.d.ts +26 -0
  4. package/dist/agent/MnemonicSeedManager.d.ts.map +1 -0
  5. package/dist/agent/MnemonicSeedManager.js +208 -0
  6. package/dist/agent/MnemonicSeedManager.js.map +1 -0
  7. package/dist/entities/MnemonicEntity.d.ts +9 -0
  8. package/dist/entities/MnemonicEntity.d.ts.map +1 -0
  9. package/dist/entities/MnemonicEntity.js +50 -0
  10. package/dist/entities/MnemonicEntity.js.map +1 -0
  11. package/dist/index.d.ts +20 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +39 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/migrations/generic/1-CreateMnemonics.d.ts +7 -0
  16. package/dist/migrations/generic/1-CreateMnemonics.d.ts.map +1 -0
  17. package/dist/migrations/generic/1-CreateMnemonics.js +72 -0
  18. package/dist/migrations/generic/1-CreateMnemonics.js.map +1 -0
  19. package/dist/migrations/generic/index.d.ts +10 -0
  20. package/dist/migrations/generic/index.d.ts.map +1 -0
  21. package/dist/migrations/generic/index.js +13 -0
  22. package/dist/migrations/generic/index.js.map +1 -0
  23. package/dist/migrations/index.d.ts +2 -0
  24. package/dist/migrations/index.d.ts.map +1 -0
  25. package/dist/migrations/index.js +6 -0
  26. package/dist/migrations/index.js.map +1 -0
  27. package/dist/migrations/internal-migrations-ormconfig.d.ts +6 -0
  28. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -0
  29. package/dist/migrations/internal-migrations-ormconfig.js +29 -0
  30. package/dist/migrations/internal-migrations-ormconfig.js.map +1 -0
  31. package/dist/migrations/postgres/1659566636105-CreateMnemonics.d.ts +7 -0
  32. package/dist/migrations/postgres/1659566636105-CreateMnemonics.d.ts.map +1 -0
  33. package/dist/migrations/postgres/1659566636105-CreateMnemonics.js +29 -0
  34. package/dist/migrations/postgres/1659566636105-CreateMnemonics.js.map +1 -0
  35. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.d.ts +7 -0
  36. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.d.ts.map +1 -0
  37. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.js +29 -0
  38. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.js.map +1 -0
  39. package/dist/tsdoc-metadata.json +11 -0
  40. package/dist/types/IMnemonicSeedManager.d.ts +121 -0
  41. package/dist/types/IMnemonicSeedManager.d.ts.map +1 -0
  42. package/dist/types/IMnemonicSeedManager.js +3 -0
  43. package/dist/types/IMnemonicSeedManager.js.map +1 -0
  44. package/package.json +60 -0
  45. package/plugin.schema.json +359 -0
  46. package/src/agent/MnemonicSeedManager.ts +176 -0
  47. package/src/entities/MnemonicEntity.ts +20 -0
  48. package/src/index.ts +22 -0
  49. package/src/migrations/generic/1-CreateMnemonics.ts +54 -0
  50. package/src/migrations/generic/index.ts +10 -0
  51. package/src/migrations/index.ts +1 -0
  52. package/src/migrations/internal-migrations-ormconfig.ts +28 -0
  53. package/src/migrations/postgres/1659566636105-CreateMnemonics.ts +15 -0
  54. package/src/migrations/sqlite/1659566622817-CreateMnemonics.ts +15 -0
  55. package/src/types/IMnemonicSeedManager.ts +140 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ <!--suppress HtmlDeprecatedAttribute -->
2
+ <h1 align="center">
3
+ <br>
4
+ <a href="https://www.sphereon.com"><img src="https://sphereon.com/content/themes/sphereon/assets/img/logo.svg" alt="Sphereon" width="400"></a>
5
+ <br>Mnemonic Seed Manager (Typescript)
6
+ <br>
7
+ </h1>
8
+
9
+ # mnemonic-seed-manager
10
+
11
+ A plugin to generate and store mnemonic pass phrases and seeds
12
+
13
+ ### Installation
14
+
15
+ ```shell
16
+ yarn add @sphereon/ssi-sdk-mnemonic-seed-manager
17
+ ```
18
+
19
+ ### Build
20
+
21
+ ```shell
22
+ yarn build
23
+ ```
24
+
25
+ ### Test
26
+
27
+ The test command runs:
28
+
29
+ - `prettier`
30
+ - `jest`
31
+ - `coverage`
32
+
33
+ You can also run only a single section of these tests, using for example `yarn test:unit`.
34
+
35
+ ```shell
36
+ yarn test
37
+ ```
38
+
39
+ ### Utility scripts
40
+
41
+ There are other utility scripts that help with development.
42
+
43
+ - `yarn fix` - runs `eslint --fix` as well as `prettier` to fix code style.
44
+
45
+ ## Module developers
46
+
47
+ We use TypeORM migrations to support database changes over time. As soon as you need to update, add or delete
48
+ information from entities, ensure that migration files are being created to reflect the updates.
49
+
50
+ Currently we support migrations for sqlite databases, typically used during development and on mobile platforms. Next to
51
+ that we also support Postgres. Obviously you need to have a Postgresql database at hand when working with Postgres.
52
+
53
+ ### Create a migration file
54
+
55
+ - Ensure you have an existing sqlite/postgres database at hand with the old situation
56
+ - Make a copy of that database so you can always easily go back
57
+ - Run the respective commands for postgresl and/or sqlite:
58
+ - `yarn run typeorm-postgres:migration:generate NameOfYourMigration`
59
+ - `yarn run typeorm-sqlite:migration:generate NameOfYourMigration`
60
+ - Check in the src/migrations folders to find a file in the respective sqlite/postgres folder which contains _
61
+ NameOfYourMigration_
62
+ - Update the index.ts file in the respective directory to include the migration. Users will import that file as their
63
+ migrations entrypoint from their TypeORM config.
64
+ - If you wish to check whether applying the migration works you can execute the respective
65
+
66
+ ### Applying migrations
67
+
68
+ There is an example sqlite file in the root called migration.sqlite.
69
+ We use the sqlite file to keep track of changes we made and to ensure there are no incidental changes by a developer
70
+ changing an entity,
71
+
72
+ This file is kept up to date by applying the command: `yarn typeorm-sqlite:migration:run`
73
+ The same can be done for a local Postgres database using the command `"typeorm-postgres:migration:run"`
74
+
75
+ You can look at package.json or https://typeorm.io/migrations to apply migrations to your own database(s)
@@ -0,0 +1,26 @@
1
+ import { IAgentPlugin } from '@veramo/core';
2
+ import { AbstractSecretBox } from '@veramo/key-manager';
3
+ import { DataSource } from 'typeorm';
4
+ import { IMnemonicSeedManager } from '../types/IMnemonicSeedManager';
5
+ import { OrPromise } from '@veramo/utils';
6
+ /**
7
+ * @public
8
+ */
9
+ export declare class MnemonicSeedManager implements IAgentPlugin {
10
+ private dbConnection;
11
+ private secretBox?;
12
+ readonly schema: any;
13
+ readonly methods: IMnemonicSeedManager;
14
+ constructor(dbConnection: OrPromise<DataSource>, secretBox?: AbstractSecretBox | undefined);
15
+ private generateMnemonic;
16
+ private verifyMnemonic;
17
+ private verifyPartialMnemonic;
18
+ private generateSeed;
19
+ private saveMnemonicInfo;
20
+ private getMnemonicInfo;
21
+ private deleteMnemonicInfo;
22
+ private saveMasterKey;
23
+ private generateMasterKey;
24
+ private generateKeysFromMnemonic;
25
+ }
26
+ //# sourceMappingURL=MnemonicSeedManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MnemonicSeedManager.d.ts","sourceRoot":"","sources":["../../src/agent/MnemonicSeedManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAkB,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAepC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAGpE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IAc1C,OAAO,CAAC,YAAY;IAAyB,OAAO,CAAC,SAAS,CAAC;IAb3E,QAAQ,CAAC,MAAM,MAAgC;IAC/C,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAUrC;gBAEmB,YAAY,EAAE,SAAS,CAAC,UAAU,CAAC,EAAU,SAAS,CAAC,+BAAmB;YAMhF,gBAAgB;YAQhB,cAAc;YAQd,qBAAqB;YAQrB,YAAY;YAMZ,gBAAgB;YAmBhB,eAAe;YAkBf,kBAAkB;YAUlB,aAAa;YAab,iBAAiB;YAiBjB,wBAAwB;CAoBvC"}
@@ -0,0 +1,208 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.MnemonicSeedManager = void 0;
36
+ const crypto = __importStar(require("crypto"));
37
+ const ed25519_hd_key_1 = require("ed25519-hd-key");
38
+ const bip39 = __importStar(require("bip39"));
39
+ const index_1 = require("../index");
40
+ const MnemonicEntity_1 = require("../entities/MnemonicEntity");
41
+ /**
42
+ * @public
43
+ */
44
+ class MnemonicSeedManager {
45
+ constructor(dbConnection, secretBox) {
46
+ this.dbConnection = dbConnection;
47
+ this.secretBox = secretBox;
48
+ this.schema = index_1.schema.IMnemonicInfoGenerator;
49
+ this.methods = {
50
+ generateMnemonic: this.generateMnemonic.bind(this),
51
+ generateSeed: this.generateSeed.bind(this),
52
+ verifyMnemonic: this.verifyMnemonic.bind(this),
53
+ verifyPartialMnemonic: this.verifyPartialMnemonic.bind(this),
54
+ saveMnemonicInfo: this.saveMnemonicInfo.bind(this),
55
+ getMnemonicInfo: this.getMnemonicInfo.bind(this),
56
+ deleteMnemonicInfo: this.deleteMnemonicInfo.bind(this),
57
+ generateMasterKey: this.generateMasterKey.bind(this),
58
+ generateKeysFromMnemonic: this.generateKeysFromMnemonic.bind(this),
59
+ };
60
+ if (!secretBox) {
61
+ console.warn('Please provide SecretBox to the KeyStore');
62
+ }
63
+ }
64
+ generateMnemonic(args) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const mnemonic = bip39.generateMnemonic(args.bits);
67
+ if (args.persist) {
68
+ return yield this.saveMnemonicInfo({ id: args.id, mnemonic: mnemonic.split(' ') });
69
+ }
70
+ return { mnemonic: mnemonic.split(' ') };
71
+ });
72
+ }
73
+ verifyMnemonic(args) {
74
+ var _a;
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ const mnemonicInfo = yield this.getMnemonicInfo({ id: args.id, hash: args.hash });
77
+ if (mnemonicInfo === null || mnemonicInfo === void 0 ? void 0 : mnemonicInfo.mnemonic) {
78
+ return { succeeded: mnemonicInfo.mnemonic.join(' ') === ((_a = args.wordList) === null || _a === void 0 ? void 0 : _a.join(' ')) };
79
+ }
80
+ throw new Error('Mnemonic not found');
81
+ });
82
+ }
83
+ verifyPartialMnemonic(args) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const mnemonicInfo = yield this.getMnemonicInfo({ id: args.id, hash: args.hash });
86
+ if (mnemonicInfo === null || mnemonicInfo === void 0 ? void 0 : mnemonicInfo.mnemonic) {
87
+ return { succeeded: args.indexedWordList.every((indexedWord) => { var _a; return ((_a = mnemonicInfo.mnemonic) === null || _a === void 0 ? void 0 : _a.indexOf(indexedWord[1])) === indexedWord[0]; }) };
88
+ }
89
+ throw new Error('Mnemonic not found');
90
+ });
91
+ }
92
+ generateSeed(args) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ return Promise.resolve({
95
+ seed: (yield bip39.mnemonicToSeed(args.mnemonic.join(' '))).toString('hex'),
96
+ });
97
+ });
98
+ }
99
+ saveMnemonicInfo(args) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ if (args.mnemonic && this.secretBox) {
102
+ const mnemonic = args.mnemonic.join(' ');
103
+ const hash = crypto.createHash('sha256').update(mnemonic).digest('hex');
104
+ const mnemonicInfo = new MnemonicEntity_1.MnemonicEntity();
105
+ mnemonicInfo.id = args.id ? args.id : hash;
106
+ mnemonicInfo.hash = hash;
107
+ mnemonicInfo.mnemonic = yield this.secretBox.encrypt(mnemonic);
108
+ const result = yield (yield this.dbConnection).getRepository(MnemonicEntity_1.MnemonicEntity).save(mnemonicInfo);
109
+ return Promise.resolve({
110
+ id: result.id,
111
+ hash: result.hash,
112
+ mnemonic: args.mnemonic,
113
+ });
114
+ }
115
+ else {
116
+ throw new Error('Mnemonic needs to be provided.');
117
+ }
118
+ });
119
+ }
120
+ getMnemonicInfo(args) {
121
+ var _a;
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ const mnemonicInfo = yield (yield this.dbConnection)
124
+ .getRepository(MnemonicEntity_1.MnemonicEntity)
125
+ .createQueryBuilder()
126
+ .where('id = :id', { id: args.id })
127
+ .orWhere('hash = :hash', { hash: args.hash })
128
+ .getOne();
129
+ if (mnemonicInfo === null || mnemonicInfo === void 0 ? void 0 : mnemonicInfo.mnemonic) {
130
+ const mnemonicStr = yield ((_a = this.secretBox) === null || _a === void 0 ? void 0 : _a.decrypt(mnemonicInfo.mnemonic));
131
+ return {
132
+ id: mnemonicInfo.id,
133
+ hash: mnemonicInfo.hash,
134
+ mnemonic: mnemonicStr === null || mnemonicStr === void 0 ? void 0 : mnemonicStr.split(' '),
135
+ };
136
+ }
137
+ return {};
138
+ });
139
+ }
140
+ deleteMnemonicInfo(args) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ return (yield this.dbConnection)
143
+ .createQueryBuilder()
144
+ .delete()
145
+ .from(MnemonicEntity_1.MnemonicEntity)
146
+ .where('id = :id', { id: args.id })
147
+ .orWhere('hash = :hash', { hash: args.hash })
148
+ .execute();
149
+ });
150
+ }
151
+ saveMasterKey(args) {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ if (args.masterKey) {
154
+ return (yield this.dbConnection)
155
+ .createQueryBuilder()
156
+ .update(MnemonicEntity_1.MnemonicEntity)
157
+ .set({ masterKey: args.masterKey })
158
+ .where('id = :id', { id: args.id })
159
+ .orWhere('hash = :hash', { hash: args.hash })
160
+ .execute();
161
+ }
162
+ throw new Error('Master Key needs to be provided.');
163
+ });
164
+ }
165
+ generateMasterKey(args) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ const mnemonic = (yield this.getMnemonicInfo({ id: args.id, hash: args.hash })).mnemonic;
168
+ if (mnemonic) {
169
+ const mnemonicInfo = yield this.generateSeed({ mnemonic });
170
+ if (mnemonicInfo.seed) {
171
+ if (args.type === 'Ed25519') {
172
+ const { key, chainCode } = (0, ed25519_hd_key_1.getMasterKeyFromSeed)(mnemonicInfo.seed);
173
+ yield this.saveMasterKey({ masterKey: key.toString('hex'), chainCode: chainCode.toString('hex') });
174
+ return { masterKey: key.toString('hex'), chainCode: chainCode.toString('hex') };
175
+ }
176
+ else {
177
+ throw new Error('Secp256k1 keys are not supported yet');
178
+ }
179
+ }
180
+ }
181
+ throw new Error('Mnemonic not found');
182
+ });
183
+ }
184
+ generateKeysFromMnemonic(args, context) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ const mnemonic = (yield this.getMnemonicInfo({ id: args.id, hash: args.hash })).mnemonic;
187
+ if (mnemonic && context) {
188
+ if (args.path && args.kms) {
189
+ const seed = (yield this.generateSeed({ mnemonic })).seed;
190
+ const { key, chainCode } = (0, ed25519_hd_key_1.derivePath)(args.path, seed);
191
+ const extPrivateKey = Buffer.concat([key, chainCode]);
192
+ //FIXME it doesn't use any secp256k1 library to generate the public key, so it doesn't generate an extended key
193
+ const publicKey = (0, ed25519_hd_key_1.getPublicKey)(key, args.withZeroBytes);
194
+ return yield context.agent.keyManagerImport({
195
+ privateKeyHex: extPrivateKey.toString('hex'),
196
+ publicKeyHex: publicKey.toString('hex'),
197
+ type: 'Ed25519',
198
+ kms: args.kms,
199
+ });
200
+ }
201
+ throw new Error('Please provide kms and derivation path');
202
+ }
203
+ throw new Error('Master Key not found');
204
+ });
205
+ }
206
+ }
207
+ exports.MnemonicSeedManager = MnemonicSeedManager;
208
+ //# sourceMappingURL=MnemonicSeedManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MnemonicSeedManager.js","sourceRoot":"","sources":["../../src/agent/MnemonicSeedManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,mDAA+E;AAG/E,6CAA8B;AAG9B,oCAYiB;AAGjB,+DAA2D;AAG3D;;GAEG;AACH,MAAa,mBAAmB;IAc9B,YAAoB,YAAmC,EAAU,SAA6B;QAA1E,iBAAY,GAAZ,YAAY,CAAuB;QAAU,cAAS,GAAT,SAAS,CAAoB;QAbrF,WAAM,GAAG,cAAM,CAAC,sBAAsB,CAAA;QACtC,YAAO,GAAyB;YACvC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,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,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE;oBACzB,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAc,CAAA;oBACnE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAA,2BAAU,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;oBACtD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;oBACrD,+GAA+G;oBAC/G,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;oBACvD,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC;wBAC1C,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;wBAC5C,YAAY,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;wBACvC,IAAI,EAAE,SAAS;wBACf,GAAG,EAAE,IAAI,CAAC,GAAG;qBACd,CAAC,CAAA;iBACH;gBACD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;aAC1D;YACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;KAAA;CACF;AAnJD,kDAmJC"}
@@ -0,0 +1,9 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ export declare class MnemonicEntity extends BaseEntity {
3
+ id: string;
4
+ hash: string;
5
+ mnemonic: string;
6
+ masterKey: string;
7
+ chainCode: string;
8
+ }
9
+ //# sourceMappingURL=MnemonicEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MnemonicEntity.d.ts","sourceRoot":"","sources":["../../src/entities/MnemonicEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAiB,MAAM,SAAS,CAAA;AAEnE,qBACa,cAAe,SAAQ,UAAU;IAG5C,EAAE,EAAE,MAAM,CAAA;IAGV,IAAI,EAAE,MAAM,CAAA;IAGZ,QAAQ,EAAE,MAAM,CAAA;IAGhB,SAAS,EAAE,MAAM,CAAA;IAGjB,SAAS,EAAE,MAAM,CAAA;CAClB"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MnemonicEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let MnemonicEntity = class MnemonicEntity extends typeorm_1.BaseEntity {
15
+ };
16
+ __decorate([
17
+ (0, typeorm_1.PrimaryColumn)({ name: 'id' })
18
+ //@ts-ignore
19
+ ,
20
+ __metadata("design:type", String)
21
+ ], MnemonicEntity.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ name: 'hash', unique: true })
24
+ //@ts-ignore
25
+ ,
26
+ __metadata("design:type", String)
27
+ ], MnemonicEntity.prototype, "hash", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ name: 'mnemonic', unique: true })
30
+ //@ts-ignore
31
+ ,
32
+ __metadata("design:type", String)
33
+ ], MnemonicEntity.prototype, "mnemonic", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ name: 'master_key', default: null })
36
+ //@ts-ignore
37
+ ,
38
+ __metadata("design:type", String)
39
+ ], MnemonicEntity.prototype, "masterKey", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ name: 'chain_code', default: null })
42
+ //@ts-ignore
43
+ ,
44
+ __metadata("design:type", String)
45
+ ], MnemonicEntity.prototype, "chainCode", void 0);
46
+ MnemonicEntity = __decorate([
47
+ (0, typeorm_1.Entity)('Mnemonic')
48
+ ], MnemonicEntity);
49
+ exports.MnemonicEntity = MnemonicEntity;
50
+ //# sourceMappingURL=MnemonicEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MnemonicEntity.js","sourceRoot":"","sources":["../../src/entities/MnemonicEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAmE;AAG5D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,oBAAU;CAgB7C,CAAA;AAfC;IAAC,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,YAAY;;;0CACF;AACV;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvC,YAAY;;;4CACA;AACZ;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC3C,YAAY;;;gDACI;AAChB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY;;;iDACK;AACjB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY;;;iDACK;AAfN,cAAc;IAD1B,IAAA,gBAAM,EAAC,UAAU,CAAC;GACN,cAAc,CAgB1B;AAhBY,wCAAc"}
@@ -0,0 +1,20 @@
1
+ import { MnemonicEntity } from './entities/MnemonicEntity';
2
+ /**
3
+ * @internal
4
+ */
5
+ declare const schema: any;
6
+ export { schema };
7
+ /**
8
+ * @public
9
+ */
10
+ export { MnemonicSeedManager } from './agent/MnemonicSeedManager';
11
+ export * from './types/IMnemonicSeedManager';
12
+ /**
13
+ * @internal
14
+ */
15
+ export declare const MnemonicSeedManagerEntities: (typeof MnemonicEntity)[];
16
+ /**
17
+ * @internal
18
+ */
19
+ export { MnemonicSeedManagerMigrations } from './migrations';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,cAAc,8BAA8B,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,2BAA2B,2BAAmB,CAAA;AAE3D;;GAEG;AACH,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.MnemonicSeedManagerMigrations = exports.MnemonicSeedManagerEntities = exports.MnemonicSeedManager = exports.schema = void 0;
18
+ const MnemonicEntity_1 = require("./entities/MnemonicEntity");
19
+ /**
20
+ * @internal
21
+ */
22
+ const schema = require('../plugin.schema.json');
23
+ exports.schema = schema;
24
+ /**
25
+ * @public
26
+ */
27
+ var MnemonicSeedManager_1 = require("./agent/MnemonicSeedManager");
28
+ Object.defineProperty(exports, "MnemonicSeedManager", { enumerable: true, get: function () { return MnemonicSeedManager_1.MnemonicSeedManager; } });
29
+ __exportStar(require("./types/IMnemonicSeedManager"), exports);
30
+ /**
31
+ * @internal
32
+ */
33
+ exports.MnemonicSeedManagerEntities = [MnemonicEntity_1.MnemonicEntity];
34
+ /**
35
+ * @internal
36
+ */
37
+ var migrations_1 = require("./migrations");
38
+ Object.defineProperty(exports, "MnemonicSeedManagerMigrations", { enumerable: true, get: function () { return migrations_1.MnemonicSeedManagerMigrations; } });
39
+ //# sourceMappingURL=index.js.map