@sphereon/ssi-sdk-ext.mnemonic-seed-manager 0.28.1-feature.esm.cjs.9 → 0.28.1-feature.oyd.cmsm.improv.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/MnemonicSeedManager.d.ts +26 -0
- package/dist/agent/MnemonicSeedManager.d.ts.map +1 -0
- package/dist/agent/MnemonicSeedManager.js +209 -0
- package/dist/agent/MnemonicSeedManager.js.map +1 -0
- package/dist/entities/MnemonicEntity.d.ts +9 -0
- package/dist/entities/MnemonicEntity.d.ts.map +1 -0
- package/dist/entities/MnemonicEntity.js +50 -0
- package/dist/entities/MnemonicEntity.js.map +1 -0
- package/dist/index.d.ts +9 -169
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -12895
- package/dist/index.js.map +1 -1
- package/dist/migrations/generic/1-CreateMnemonics.d.ts +7 -0
- package/dist/migrations/generic/1-CreateMnemonics.d.ts.map +1 -0
- package/dist/migrations/generic/1-CreateMnemonics.js +72 -0
- package/dist/migrations/generic/1-CreateMnemonics.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +10 -0
- package/dist/migrations/generic/index.d.ts.map +1 -0
- package/dist/migrations/generic/index.js +13 -0
- package/dist/migrations/generic/index.js.map +1 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +6 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/internal-migrations-ormconfig.d.ts +7 -0
- package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -0
- package/dist/migrations/internal-migrations-ormconfig.js +29 -0
- package/dist/migrations/internal-migrations-ormconfig.js.map +1 -0
- package/dist/migrations/postgres/1659566636105-CreateMnemonics.d.ts +7 -0
- package/dist/migrations/postgres/1659566636105-CreateMnemonics.d.ts.map +1 -0
- package/dist/migrations/postgres/1659566636105-CreateMnemonics.js +29 -0
- package/dist/migrations/postgres/1659566636105-CreateMnemonics.js.map +1 -0
- package/dist/migrations/sqlite/1659566622817-CreateMnemonics.d.ts +7 -0
- package/dist/migrations/sqlite/1659566622817-CreateMnemonics.d.ts.map +1 -0
- package/dist/migrations/sqlite/1659566622817-CreateMnemonics.js +29 -0
- package/dist/migrations/sqlite/1659566622817-CreateMnemonics.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{index.d.cts → types/IMnemonicSeedManager.d.ts} +14 -73
- package/dist/types/IMnemonicSeedManager.d.ts.map +1 -0
- package/dist/types/IMnemonicSeedManager.js +3 -0
- package/dist/types/IMnemonicSeedManager.js.map +1 -0
- package/package.json +13 -27
- package/src/entities/MnemonicEntity.ts +15 -10
- package/src/index.ts +0 -1
- package/dist/index.cjs +0 -13017
- package/dist/index.cjs.map +0 -1
|
@@ -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":"AAGA,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,EAAE,iBAAiB,YAAA;YAMhF,gBAAgB;YAQhB,cAAc;YAQd,qBAAqB;YAQrB,YAAY;YAMZ,gBAAgB;YAmBhB,eAAe;YAkBf,kBAAkB;YAUlB,aAAa;YAab,iBAAiB;YAiBjB,wBAAwB;CAoBvC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
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 utils_1 = require("@noble/hashes/utils");
|
|
37
|
+
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
38
|
+
const ed25519_hd_key_1 = require("ed25519-hd-key");
|
|
39
|
+
const bip39 = __importStar(require("bip39"));
|
|
40
|
+
const index_1 = require("../index");
|
|
41
|
+
const MnemonicEntity_1 = require("../entities/MnemonicEntity");
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
class MnemonicSeedManager {
|
|
46
|
+
constructor(dbConnection, secretBox) {
|
|
47
|
+
this.dbConnection = dbConnection;
|
|
48
|
+
this.secretBox = secretBox;
|
|
49
|
+
this.schema = index_1.schema.IMnemonicInfoGenerator;
|
|
50
|
+
this.methods = {
|
|
51
|
+
generateMnemonic: this.generateMnemonic.bind(this),
|
|
52
|
+
generateSeed: this.generateSeed.bind(this),
|
|
53
|
+
verifyMnemonic: this.verifyMnemonic.bind(this),
|
|
54
|
+
verifyPartialMnemonic: this.verifyPartialMnemonic.bind(this),
|
|
55
|
+
saveMnemonicInfo: this.saveMnemonicInfo.bind(this),
|
|
56
|
+
getMnemonicInfo: this.getMnemonicInfo.bind(this),
|
|
57
|
+
deleteMnemonicInfo: this.deleteMnemonicInfo.bind(this),
|
|
58
|
+
generateMasterKey: this.generateMasterKey.bind(this),
|
|
59
|
+
generateKeysFromMnemonic: this.generateKeysFromMnemonic.bind(this),
|
|
60
|
+
};
|
|
61
|
+
if (!secretBox) {
|
|
62
|
+
console.warn('Please provide SecretBox to the KeyStore');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
generateMnemonic(args) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const mnemonic = bip39.generateMnemonic(args.bits);
|
|
68
|
+
if (args.persist) {
|
|
69
|
+
return yield this.saveMnemonicInfo({ id: args.id, mnemonic: mnemonic.split(' ') });
|
|
70
|
+
}
|
|
71
|
+
return { mnemonic: mnemonic.split(' ') };
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
verifyMnemonic(args) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
var _a;
|
|
77
|
+
const mnemonicInfo = yield this.getMnemonicInfo({ id: args.id, hash: args.hash });
|
|
78
|
+
if (mnemonicInfo === null || mnemonicInfo === void 0 ? void 0 : mnemonicInfo.mnemonic) {
|
|
79
|
+
return { succeeded: mnemonicInfo.mnemonic.join(' ') === ((_a = args.wordList) === null || _a === void 0 ? void 0 : _a.join(' ')) };
|
|
80
|
+
}
|
|
81
|
+
throw new Error('Mnemonic not found');
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
verifyPartialMnemonic(args) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const mnemonicInfo = yield this.getMnemonicInfo({ id: args.id, hash: args.hash });
|
|
87
|
+
if (mnemonicInfo === null || mnemonicInfo === void 0 ? void 0 : mnemonicInfo.mnemonic) {
|
|
88
|
+
return { succeeded: args.indexedWordList.every((indexedWord) => { var _a; return ((_a = mnemonicInfo.mnemonic) === null || _a === void 0 ? void 0 : _a.indexOf(indexedWord[1])) === indexedWord[0]; }) };
|
|
89
|
+
}
|
|
90
|
+
throw new Error('Mnemonic not found');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
generateSeed(args) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
return Promise.resolve({
|
|
96
|
+
seed: (yield bip39.mnemonicToSeed(args.mnemonic.join(' '))).toString('hex'),
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
saveMnemonicInfo(args) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
if (args.mnemonic && this.secretBox) {
|
|
103
|
+
const mnemonic = args.mnemonic.join(' ');
|
|
104
|
+
const hash = (0, utils_1.bytesToHex)((0, ssi_sdk_ext_key_utils_1.shaHasher)(mnemonic, 'sha256'));
|
|
105
|
+
const mnemonicInfo = new MnemonicEntity_1.MnemonicEntity();
|
|
106
|
+
mnemonicInfo.id = args.id ? args.id : hash;
|
|
107
|
+
mnemonicInfo.hash = hash;
|
|
108
|
+
mnemonicInfo.mnemonic = yield this.secretBox.encrypt(mnemonic);
|
|
109
|
+
const result = yield (yield this.dbConnection).getRepository(MnemonicEntity_1.MnemonicEntity).save(mnemonicInfo);
|
|
110
|
+
return Promise.resolve({
|
|
111
|
+
id: result.id,
|
|
112
|
+
hash: result.hash,
|
|
113
|
+
mnemonic: args.mnemonic,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
throw new Error('Mnemonic needs to be provided.');
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getMnemonicInfo(args) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
var _a;
|
|
124
|
+
const mnemonicInfo = yield (yield this.dbConnection)
|
|
125
|
+
.getRepository(MnemonicEntity_1.MnemonicEntity)
|
|
126
|
+
.createQueryBuilder()
|
|
127
|
+
.where('id = :id', { id: args.id })
|
|
128
|
+
.orWhere('hash = :hash', { hash: args.hash })
|
|
129
|
+
.getOne();
|
|
130
|
+
if (mnemonicInfo === null || mnemonicInfo === void 0 ? void 0 : mnemonicInfo.mnemonic) {
|
|
131
|
+
const mnemonicStr = yield ((_a = this.secretBox) === null || _a === void 0 ? void 0 : _a.decrypt(mnemonicInfo.mnemonic));
|
|
132
|
+
return {
|
|
133
|
+
id: mnemonicInfo.id,
|
|
134
|
+
hash: mnemonicInfo.hash,
|
|
135
|
+
mnemonic: mnemonicStr === null || mnemonicStr === void 0 ? void 0 : mnemonicStr.split(' '),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return {};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
deleteMnemonicInfo(args) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
return (yield this.dbConnection)
|
|
144
|
+
.createQueryBuilder()
|
|
145
|
+
.delete()
|
|
146
|
+
.from(MnemonicEntity_1.MnemonicEntity)
|
|
147
|
+
.where('id = :id', { id: args.id })
|
|
148
|
+
.orWhere('hash = :hash', { hash: args.hash })
|
|
149
|
+
.execute();
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
saveMasterKey(args) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
if (args.masterKey) {
|
|
155
|
+
return (yield this.dbConnection)
|
|
156
|
+
.createQueryBuilder()
|
|
157
|
+
.update(MnemonicEntity_1.MnemonicEntity)
|
|
158
|
+
.set({ masterKey: args.masterKey })
|
|
159
|
+
.where('id = :id', { id: args.id })
|
|
160
|
+
.orWhere('hash = :hash', { hash: args.hash })
|
|
161
|
+
.execute();
|
|
162
|
+
}
|
|
163
|
+
throw new Error('Master Key needs to be provided.');
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
generateMasterKey(args) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const mnemonic = (yield this.getMnemonicInfo({ id: args.id, hash: args.hash })).mnemonic;
|
|
169
|
+
if (mnemonic) {
|
|
170
|
+
const mnemonicInfo = yield this.generateSeed({ mnemonic });
|
|
171
|
+
if (mnemonicInfo.seed) {
|
|
172
|
+
if (args.type === 'Ed25519') {
|
|
173
|
+
const { key, chainCode } = (0, ed25519_hd_key_1.getMasterKeyFromSeed)(mnemonicInfo.seed);
|
|
174
|
+
yield this.saveMasterKey({ masterKey: key.toString('hex'), chainCode: chainCode.toString('hex') });
|
|
175
|
+
return { masterKey: key.toString('hex'), chainCode: chainCode.toString('hex') };
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
throw new Error('Secp256k1 keys are not supported yet');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
throw new Error('Mnemonic not found');
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
generateKeysFromMnemonic(args, context) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const mnemonic = (yield this.getMnemonicInfo({ id: args.id, hash: args.hash })).mnemonic;
|
|
188
|
+
if (mnemonic && context) {
|
|
189
|
+
if (args.path && args.kms) {
|
|
190
|
+
const seed = (yield this.generateSeed({ mnemonic })).seed;
|
|
191
|
+
const { key, chainCode } = (0, ed25519_hd_key_1.derivePath)(args.path, seed);
|
|
192
|
+
const extPrivateKey = Buffer.concat([key, chainCode]);
|
|
193
|
+
//FIXME it doesn't use any secp256k1 library to generate the public key, so it doesn't generate an extended key
|
|
194
|
+
const publicKey = (0, ed25519_hd_key_1.getPublicKey)(key, args.withZeroBytes);
|
|
195
|
+
return yield context.agent.keyManagerImport({
|
|
196
|
+
privateKeyHex: extPrivateKey.toString('hex'),
|
|
197
|
+
publicKeyHex: publicKey.toString('hex'),
|
|
198
|
+
type: 'Ed25519',
|
|
199
|
+
kms: args.kms,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
throw new Error('Please provide kms and derivation path');
|
|
203
|
+
}
|
|
204
|
+
throw new Error('Master Key not found');
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.MnemonicSeedManager = MnemonicSeedManager;
|
|
209
|
+
//# sourceMappingURL=MnemonicSeedManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MnemonicSeedManager.js","sourceRoot":"","sources":["../../src/agent/MnemonicSeedManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgD;AAChD,2EAA2D;AAC3D,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,IAAI,CAAC;YAClD,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1C,cAAc,EAAE,IAAI,CAAC,cA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M,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
|
+
exports.MnemonicEntity = MnemonicEntity;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, typeorm_1.PrimaryColumn)({ name: 'id' })
|
|
19
|
+
//@ts-ignore
|
|
20
|
+
,
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], MnemonicEntity.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.Column)({ name: 'hash', unique: true })
|
|
25
|
+
//@ts-ignore
|
|
26
|
+
,
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], MnemonicEntity.prototype, "hash", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ name: 'mnemonic', unique: true })
|
|
31
|
+
//@ts-ignore
|
|
32
|
+
,
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], MnemonicEntity.prototype, "mnemonic", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ name: 'master_key', default: null })
|
|
37
|
+
//@ts-ignore
|
|
38
|
+
,
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], MnemonicEntity.prototype, "masterKey", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ name: 'chain_code', default: null })
|
|
43
|
+
//@ts-ignore
|
|
44
|
+
,
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], MnemonicEntity.prototype, "chainCode", void 0);
|
|
47
|
+
exports.MnemonicEntity = MnemonicEntity = __decorate([
|
|
48
|
+
(0, typeorm_1.Entity)('Mnemonic')
|
|
49
|
+
], 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;AAhBY,wCAAc;AAGzB;IAFC,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,YAAY;;;0CACF;AAGV;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvC,YAAY;;;4CACA;AAGZ;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC3C,YAAY;;;gDACI;AAGhB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY;;;iDACK;AAGjB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY;;;iDACK;yBAfN,cAAc;IAD1B,IAAA,gBAAM,EAAC,UAAU,CAAC;GACN,cAAc,CAgB1B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,180 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IPluginMethodMap, IAgentContext, IKeyManager, IDataStore, ManagedKeyInfo, IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import { AbstractSecretBox } from '@veramo/key-manager';
|
|
4
|
-
import { OrPromise } from '@veramo/utils';
|
|
5
|
-
|
|
6
|
-
declare class MnemonicEntity extends BaseEntity {
|
|
7
|
-
id: string;
|
|
8
|
-
hash: string;
|
|
9
|
-
mnemonic: string;
|
|
10
|
-
masterKey: string;
|
|
11
|
-
chainCode: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
1
|
+
import { MnemonicEntity } from './entities/MnemonicEntity';
|
|
14
2
|
/**
|
|
15
|
-
* @
|
|
16
|
-
*/
|
|
17
|
-
interface IMnemonicSeedManager extends IPluginMethodMap {
|
|
18
|
-
generateMnemonic(args: IMnemonicGeneratorArgs): Promise<IMnemonicInfoResult>;
|
|
19
|
-
verifyMnemonic(args: IMnemonicVerificationArgs): Promise<IMnemonicInfoResult>;
|
|
20
|
-
verifyPartialMnemonic(args: IPartialMnemonicVerificationArgs): Promise<IMnemonicInfoResult>;
|
|
21
|
-
generateSeed(args: ISeedGeneratorArgs): Promise<IMnemonicInfoResult>;
|
|
22
|
-
saveMnemonicInfo(args: IMnemonicInfoStoreArgs): Promise<IMnemonicInfoResult>;
|
|
23
|
-
getMnemonicInfo(args: IMnemonicInfoStoreArgs): Promise<IMnemonicInfoResult>;
|
|
24
|
-
deleteMnemonicInfo(args: IMnemonicInfoStoreArgs): Promise<DeleteResult>;
|
|
25
|
-
generateMasterKey(args: IMnemonicInfoStoreArgs): Promise<IMnemonicInfoKeyResult>;
|
|
26
|
-
generateKeysFromMnemonic(args: IMnemonicInfoStoreArgs, context: IRequiredContext): Promise<ManagedKeyInfo>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @param bits - Affects the number of words in the mnemonic, which is 12, 15, 18, 21 and 24 respectively.
|
|
30
|
-
* @param id - Optional user defined id for the mnemonic
|
|
31
|
-
* @param persist - Whether the mnemonic should be persisted into the database
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
interface IMnemonicGeneratorArgs {
|
|
35
|
-
bits: 128 | 160 | 192 | 224 | 256;
|
|
36
|
-
id?: string;
|
|
37
|
-
persist?: boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @param id - Optional user defined id for the mnemonic
|
|
41
|
-
* @param hash - Optional sha256 hash of the mnemonic
|
|
42
|
-
* @param wordList - List containing all the words of the mnemonic in order.
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
|
-
interface IMnemonicVerificationArgs {
|
|
47
|
-
id?: string;
|
|
48
|
-
hash?: string;
|
|
49
|
-
wordList: string[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @param id - Optional user defined id for the mnemonic
|
|
53
|
-
* @param hash - Optional sha256 hash of the mnemonic
|
|
54
|
-
* @param indexedWordList - List partially containing the words
|
|
55
|
-
* with their indexes corresponding the position in which they appear in the mnemonic.
|
|
56
|
-
* It must be in the same order as in the mnemonic.
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
interface IPartialMnemonicVerificationArgs {
|
|
60
|
-
id?: string;
|
|
61
|
-
hash?: string;
|
|
62
|
-
indexedWordList: [number, string][];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @param mnemonic - Array representation of the mnemonic string
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
interface ISeedGeneratorArgs {
|
|
69
|
-
mnemonic: string[];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @param id - Optional user defined id for the mnemonic
|
|
73
|
-
* @param hash - Optional sha256 hash of the mnemonic
|
|
74
|
-
* @param mnemonic - Array representation of the mnemonic string
|
|
75
|
-
* @param masterKey - The master key generated from the seed
|
|
76
|
-
* @param chainCode - The chain code generated with the keys
|
|
77
|
-
* @param kms - The key management service to be used
|
|
78
|
-
* @param path - The derivation path to be used
|
|
79
|
-
* @param withZeroBytes - Whether the public key should be generated with zero bytes
|
|
80
|
-
* @param type - The type of the key generated
|
|
81
|
-
* @param persist - Whether the information should be persisted
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
interface IMnemonicInfoStoreArgs {
|
|
85
|
-
id?: string;
|
|
86
|
-
hash?: string;
|
|
87
|
-
mnemonic?: string[];
|
|
88
|
-
masterKey?: string;
|
|
89
|
-
chainCode?: string;
|
|
90
|
-
kms?: string;
|
|
91
|
-
path?: string;
|
|
92
|
-
withZeroBytes?: boolean;
|
|
93
|
-
type?: 'Ed25519' | 'Secp256k1';
|
|
94
|
-
persist?: boolean;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @public
|
|
98
|
-
*/
|
|
99
|
-
interface IMnemonicInfoKeyResult {
|
|
100
|
-
masterKey?: string;
|
|
101
|
-
chainCode?: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
interface DeleteResult {
|
|
107
|
-
raw: unknown;
|
|
108
|
-
affected?: number | null;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @public
|
|
112
|
-
*/
|
|
113
|
-
interface UpdateResult extends DeleteResult {
|
|
114
|
-
generatedMaps: ObjectLiteral;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* @public
|
|
118
|
-
*/
|
|
119
|
-
interface ObjectLiteral {
|
|
120
|
-
[key: string]: any;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* @public
|
|
124
|
-
*/
|
|
125
|
-
interface IMnemonicInfoResult extends IMnemonicInfoStoreArgs {
|
|
126
|
-
succeeded?: boolean;
|
|
127
|
-
seed?: string;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @public
|
|
3
|
+
* @internal
|
|
131
4
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
5
|
+
declare const schema: any;
|
|
6
|
+
export { schema };
|
|
134
7
|
/**
|
|
135
8
|
* @public
|
|
136
9
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
private secretBox?;
|
|
140
|
-
readonly schema: any;
|
|
141
|
-
readonly methods: IMnemonicSeedManager;
|
|
142
|
-
constructor(dbConnection: OrPromise<DataSource>, secretBox?: AbstractSecretBox | undefined);
|
|
143
|
-
private generateMnemonic;
|
|
144
|
-
private verifyMnemonic;
|
|
145
|
-
private verifyPartialMnemonic;
|
|
146
|
-
private generateSeed;
|
|
147
|
-
private saveMnemonicInfo;
|
|
148
|
-
private getMnemonicInfo;
|
|
149
|
-
private deleteMnemonicInfo;
|
|
150
|
-
private saveMasterKey;
|
|
151
|
-
private generateMasterKey;
|
|
152
|
-
private generateKeysFromMnemonic;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
declare class CreateMnemonics1659567079429 implements MigrationInterface {
|
|
156
|
-
name: string;
|
|
157
|
-
up(queryRunner: QueryRunner): Promise<void>;
|
|
158
|
-
down(queryRunner: QueryRunner): Promise<void>;
|
|
159
|
-
}
|
|
160
|
-
|
|
10
|
+
export { MnemonicSeedManager } from './agent/MnemonicSeedManager';
|
|
11
|
+
export * from './types/IMnemonicSeedManager';
|
|
161
12
|
/**
|
|
162
|
-
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
163
|
-
*
|
|
164
|
-
* These ensure the correct creation of tables and the proper migrations of data when tables change between versions.
|
|
165
|
-
*
|
|
166
13
|
* @internal
|
|
167
14
|
*/
|
|
168
|
-
declare const
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @internal
|
|
172
|
-
*/
|
|
173
|
-
declare const schema: any;
|
|
174
|
-
|
|
15
|
+
export declare const MnemonicSeedManagerEntities: (typeof MnemonicEntity)[];
|
|
175
16
|
/**
|
|
176
17
|
* @internal
|
|
177
18
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
export { type DeleteResult, type IMnemonicGeneratorArgs, type IMnemonicInfoKeyResult, type IMnemonicInfoResult, type IMnemonicInfoStoreArgs, type IMnemonicSeedManager, type IMnemonicVerificationArgs, type IPartialMnemonicVerificationArgs, type IRequiredContext, type ISeedGeneratorArgs, MnemonicSeedManager, MnemonicSeedManagerEntities, MnemonicSeedManagerMigrations, type ObjectLiteral, type UpdateResult, schema };
|
|
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"}
|