@sphereon/ssi-sdk-ext.mnemonic-seed-manager 0.28.0 → 0.28.1-feature.esm.cjs.9

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 (46) hide show
  1. package/dist/index.cjs +13017 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/{types/IMnemonicSeedManager.d.ts → index.d.cts} +73 -14
  4. package/dist/index.d.ts +169 -9
  5. package/dist/index.js +12895 -38
  6. package/dist/index.js.map +1 -1
  7. package/dist/tsdoc-metadata.json +1 -1
  8. package/package.json +27 -13
  9. package/src/entities/MnemonicEntity.ts +10 -15
  10. package/src/index.ts +1 -0
  11. package/dist/agent/MnemonicSeedManager.d.ts +0 -26
  12. package/dist/agent/MnemonicSeedManager.d.ts.map +0 -1
  13. package/dist/agent/MnemonicSeedManager.js +0 -209
  14. package/dist/agent/MnemonicSeedManager.js.map +0 -1
  15. package/dist/entities/MnemonicEntity.d.ts +0 -9
  16. package/dist/entities/MnemonicEntity.d.ts.map +0 -1
  17. package/dist/entities/MnemonicEntity.js +0 -50
  18. package/dist/entities/MnemonicEntity.js.map +0 -1
  19. package/dist/index.d.ts.map +0 -1
  20. package/dist/migrations/generic/1-CreateMnemonics.d.ts +0 -7
  21. package/dist/migrations/generic/1-CreateMnemonics.d.ts.map +0 -1
  22. package/dist/migrations/generic/1-CreateMnemonics.js +0 -72
  23. package/dist/migrations/generic/1-CreateMnemonics.js.map +0 -1
  24. package/dist/migrations/generic/index.d.ts +0 -10
  25. package/dist/migrations/generic/index.d.ts.map +0 -1
  26. package/dist/migrations/generic/index.js +0 -13
  27. package/dist/migrations/generic/index.js.map +0 -1
  28. package/dist/migrations/index.d.ts +0 -2
  29. package/dist/migrations/index.d.ts.map +0 -1
  30. package/dist/migrations/index.js +0 -6
  31. package/dist/migrations/index.js.map +0 -1
  32. package/dist/migrations/internal-migrations-ormconfig.d.ts +0 -7
  33. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +0 -1
  34. package/dist/migrations/internal-migrations-ormconfig.js +0 -29
  35. package/dist/migrations/internal-migrations-ormconfig.js.map +0 -1
  36. package/dist/migrations/postgres/1659566636105-CreateMnemonics.d.ts +0 -7
  37. package/dist/migrations/postgres/1659566636105-CreateMnemonics.d.ts.map +0 -1
  38. package/dist/migrations/postgres/1659566636105-CreateMnemonics.js +0 -29
  39. package/dist/migrations/postgres/1659566636105-CreateMnemonics.js.map +0 -1
  40. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.d.ts +0 -7
  41. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.d.ts.map +0 -1
  42. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.js +0 -29
  43. package/dist/migrations/sqlite/1659566622817-CreateMnemonics.js.map +0 -1
  44. package/dist/types/IMnemonicSeedManager.d.ts.map +0 -1
  45. package/dist/types/IMnemonicSeedManager.js +0 -3
  46. package/dist/types/IMnemonicSeedManager.js.map +0 -1
@@ -1,8 +1,20 @@
1
- import { IAgentContext, IDataStore, IKeyManager, IPluginMethodMap, ManagedKeyInfo } from '@veramo/core';
1
+ import { BaseEntity, DataSource, MigrationInterface, QueryRunner } from 'typeorm';
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
+
2
14
  /**
3
15
  * @public
4
16
  */
5
- export interface IMnemonicSeedManager extends IPluginMethodMap {
17
+ interface IMnemonicSeedManager extends IPluginMethodMap {
6
18
  generateMnemonic(args: IMnemonicGeneratorArgs): Promise<IMnemonicInfoResult>;
7
19
  verifyMnemonic(args: IMnemonicVerificationArgs): Promise<IMnemonicInfoResult>;
8
20
  verifyPartialMnemonic(args: IPartialMnemonicVerificationArgs): Promise<IMnemonicInfoResult>;
@@ -19,7 +31,7 @@ export interface IMnemonicSeedManager extends IPluginMethodMap {
19
31
  * @param persist - Whether the mnemonic should be persisted into the database
20
32
  * @public
21
33
  */
22
- export interface IMnemonicGeneratorArgs {
34
+ interface IMnemonicGeneratorArgs {
23
35
  bits: 128 | 160 | 192 | 224 | 256;
24
36
  id?: string;
25
37
  persist?: boolean;
@@ -31,7 +43,7 @@ export interface IMnemonicGeneratorArgs {
31
43
  *
32
44
  * @public
33
45
  */
34
- export interface IMnemonicVerificationArgs {
46
+ interface IMnemonicVerificationArgs {
35
47
  id?: string;
36
48
  hash?: string;
37
49
  wordList: string[];
@@ -44,7 +56,7 @@ export interface IMnemonicVerificationArgs {
44
56
  * It must be in the same order as in the mnemonic.
45
57
  * @public
46
58
  */
47
- export interface IPartialMnemonicVerificationArgs {
59
+ interface IPartialMnemonicVerificationArgs {
48
60
  id?: string;
49
61
  hash?: string;
50
62
  indexedWordList: [number, string][];
@@ -53,7 +65,7 @@ export interface IPartialMnemonicVerificationArgs {
53
65
  * @param mnemonic - Array representation of the mnemonic string
54
66
  * @public
55
67
  */
56
- export interface ISeedGeneratorArgs {
68
+ interface ISeedGeneratorArgs {
57
69
  mnemonic: string[];
58
70
  }
59
71
  /**
@@ -69,7 +81,7 @@ export interface ISeedGeneratorArgs {
69
81
  * @param persist - Whether the information should be persisted
70
82
  * @public
71
83
  */
72
- export interface IMnemonicInfoStoreArgs {
84
+ interface IMnemonicInfoStoreArgs {
73
85
  id?: string;
74
86
  hash?: string;
75
87
  mnemonic?: string[];
@@ -84,38 +96,85 @@ export interface IMnemonicInfoStoreArgs {
84
96
  /**
85
97
  * @public
86
98
  */
87
- export interface IMnemonicInfoKeyResult {
99
+ interface IMnemonicInfoKeyResult {
88
100
  masterKey?: string;
89
101
  chainCode?: string;
90
102
  }
91
103
  /**
92
104
  * @public
93
105
  */
94
- export interface DeleteResult {
106
+ interface DeleteResult {
95
107
  raw: unknown;
96
108
  affected?: number | null;
97
109
  }
98
110
  /**
99
111
  * @public
100
112
  */
101
- export interface UpdateResult extends DeleteResult {
113
+ interface UpdateResult extends DeleteResult {
102
114
  generatedMaps: ObjectLiteral;
103
115
  }
104
116
  /**
105
117
  * @public
106
118
  */
107
- export interface ObjectLiteral {
119
+ interface ObjectLiteral {
108
120
  [key: string]: any;
109
121
  }
110
122
  /**
111
123
  * @public
112
124
  */
113
- export interface IMnemonicInfoResult extends IMnemonicInfoStoreArgs {
125
+ interface IMnemonicInfoResult extends IMnemonicInfoStoreArgs {
114
126
  succeeded?: boolean;
115
127
  seed?: string;
116
128
  }
117
129
  /**
118
130
  * @public
119
131
  */
120
- export type IRequiredContext = IAgentContext<IKeyManager & IDataStore>;
121
- //# sourceMappingURL=IMnemonicSeedManager.d.ts.map
132
+ type IRequiredContext = IAgentContext<IKeyManager & IDataStore>;
133
+
134
+ /**
135
+ * @public
136
+ */
137
+ declare class MnemonicSeedManager implements IAgentPlugin {
138
+ private dbConnection;
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
+
161
+ /**
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
+ * @internal
167
+ */
168
+ declare const MnemonicSeedManagerMigrations: (typeof CreateMnemonics1659567079429)[];
169
+
170
+ /**
171
+ * @internal
172
+ */
173
+ declare const schema: any;
174
+
175
+ /**
176
+ * @internal
177
+ */
178
+ declare const MnemonicSeedManagerEntities: (typeof MnemonicEntity)[];
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 };
package/dist/index.d.ts CHANGED
@@ -1,20 +1,180 @@
1
- import { MnemonicEntity } from './entities/MnemonicEntity';
1
+ import { BaseEntity, DataSource, MigrationInterface, QueryRunner } from 'typeorm';
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
+
2
14
  /**
3
- * @internal
15
+ * @public
4
16
  */
5
- declare const schema: any;
6
- export { schema };
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
+ }
7
122
  /**
8
123
  * @public
9
124
  */
10
- export { MnemonicSeedManager } from './agent/MnemonicSeedManager';
11
- export * from './types/IMnemonicSeedManager';
125
+ interface IMnemonicInfoResult extends IMnemonicInfoStoreArgs {
126
+ succeeded?: boolean;
127
+ seed?: string;
128
+ }
12
129
  /**
130
+ * @public
131
+ */
132
+ type IRequiredContext = IAgentContext<IKeyManager & IDataStore>;
133
+
134
+ /**
135
+ * @public
136
+ */
137
+ declare class MnemonicSeedManager implements IAgentPlugin {
138
+ private dbConnection;
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
+
161
+ /**
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
+ *
13
166
  * @internal
14
167
  */
15
- export declare const MnemonicSeedManagerEntities: (typeof MnemonicEntity)[];
168
+ declare const MnemonicSeedManagerMigrations: (typeof CreateMnemonics1659567079429)[];
169
+
170
+ /**
171
+ * @internal
172
+ */
173
+ declare const schema: any;
174
+
16
175
  /**
17
176
  * @internal
18
177
  */
19
- export { MnemonicSeedManagerMigrations } from './migrations';
20
- //# sourceMappingURL=index.d.ts.map
178
+ declare const MnemonicSeedManagerEntities: (typeof MnemonicEntity)[];
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 };