@metamask-previews/profile-sync-controller 29.0.0-preview-e57e5c3dc → 29.0.0-preview-c34a16a37
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/CHANGELOG.md +2 -1
- package/dist/controllers/authentication/AuthenticationController.cjs +26 -55
- package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.mjs +27 -56
- package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.cjs +1 -17
- package/dist/controllers/authentication/auth-snap-requests.cjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.cts +0 -6
- package/dist/controllers/authentication/auth-snap-requests.d.cts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.mts +0 -6
- package/dist/controllers/authentication/auth-snap-requests.d.mts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.mjs +0 -15
- package/dist/controllers/authentication/auth-snap-requests.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +4 -9
- package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.mjs +4 -9
- package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
- package/dist/shared/storage-schema.cjs +1 -0
- package/dist/shared/storage-schema.cjs.map +1 -1
- package/dist/shared/storage-schema.d.cts +1 -0
- package/dist/shared/storage-schema.d.cts.map +1 -1
- package/dist/shared/storage-schema.d.mts +1 -0
- package/dist/shared/storage-schema.d.mts.map +1 -1
- package/dist/shared/storage-schema.mjs +1 -0
- package/dist/shared/storage-schema.mjs.map +1 -1
- package/dist/shared/utils/entropy-source.cjs +37 -0
- package/dist/shared/utils/entropy-source.cjs.map +1 -0
- package/dist/shared/utils/entropy-source.d.cts +22 -0
- package/dist/shared/utils/entropy-source.d.cts.map +1 -0
- package/dist/shared/utils/entropy-source.d.mts +22 -0
- package/dist/shared/utils/entropy-source.d.mts.map +1 -0
- package/dist/shared/utils/entropy-source.mjs +32 -0
- package/dist/shared/utils/entropy-source.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { KeyringTypes } from "@metamask/keyring-controller";
|
|
2
|
+
/**
|
|
3
|
+
* Reads HD keyring entropy source IDs (metadata IDs) from KeyringController
|
|
4
|
+
* keyrings, primary first. Returns an empty array when none are available
|
|
5
|
+
* (e.g. the wallet is locked, where `keyrings` is cleared).
|
|
6
|
+
*
|
|
7
|
+
* @param keyrings - Keyrings from `KeyringController:getState`.
|
|
8
|
+
* @returns The HD keyring metadata IDs, primary first.
|
|
9
|
+
*/
|
|
10
|
+
export function getHdKeyringEntropySourceIds(keyrings) {
|
|
11
|
+
return (keyrings ?? [])
|
|
12
|
+
.filter((keyring) => keyring.type === KeyringTypes.hd.toString())
|
|
13
|
+
.map((keyring) => keyring.metadata.id);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the primary SRP's entropy source ID (the first HD keyring's
|
|
17
|
+
* metadata ID). The ID is randomly regenerated whenever the vault is
|
|
18
|
+
* recreated (e.g. on restore).
|
|
19
|
+
*
|
|
20
|
+
* @param keyrings - Keyrings from `KeyringController:getState`.
|
|
21
|
+
* @returns The primary HD keyring metadata ID.
|
|
22
|
+
* @throws If no HD keyring is available; callers must only resolve while
|
|
23
|
+
* the wallet is unlocked.
|
|
24
|
+
*/
|
|
25
|
+
export function getPrimaryHdKeyringEntropySourceId(keyrings) {
|
|
26
|
+
const [primaryEntropySourceId] = getHdKeyringEntropySourceIds(keyrings);
|
|
27
|
+
if (!primaryEntropySourceId) {
|
|
28
|
+
throw new Error('getPrimaryHdKeyringEntropySourceId - no HD keyring available');
|
|
29
|
+
}
|
|
30
|
+
return primaryEntropySourceId;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=entropy-source.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entropy-source.mjs","sourceRoot":"","sources":["../../../src/shared/utils/entropy-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qCAAqC;AAG5D;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAC1C,QAA4C;IAE5C,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;SAChE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAA4C;IAE5C,MAAM,CAAC,sBAAsB,CAAC,GAAG,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IACxE,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC","sourcesContent":["import { KeyringTypes } from '@metamask/keyring-controller';\nimport type { KeyringObject } from '@metamask/keyring-controller';\n\n/**\n * Reads HD keyring entropy source IDs (metadata IDs) from KeyringController\n * keyrings, primary first. Returns an empty array when none are available\n * (e.g. the wallet is locked, where `keyrings` is cleared).\n *\n * @param keyrings - Keyrings from `KeyringController:getState`.\n * @returns The HD keyring metadata IDs, primary first.\n */\nexport function getHdKeyringEntropySourceIds(\n keyrings: KeyringObject[] | null | undefined,\n): string[] {\n return (keyrings ?? [])\n .filter((keyring) => keyring.type === KeyringTypes.hd.toString())\n .map((keyring) => keyring.metadata.id);\n}\n\n/**\n * Resolves the primary SRP's entropy source ID (the first HD keyring's\n * metadata ID). The ID is randomly regenerated whenever the vault is\n * recreated (e.g. on restore).\n *\n * @param keyrings - Keyrings from `KeyringController:getState`.\n * @returns The primary HD keyring metadata ID.\n * @throws If no HD keyring is available; callers must only resolve while\n * the wallet is unlocked.\n */\nexport function getPrimaryHdKeyringEntropySourceId(\n keyrings: KeyringObject[] | null | undefined,\n): string {\n const [primaryEntropySourceId] = getHdKeyringEntropySourceIds(keyrings);\n if (!primaryEntropySourceId) {\n throw new Error(\n 'getPrimaryHdKeyringEntropySourceId - no HD keyring available',\n );\n }\n return primaryEntropySourceId;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/profile-sync-controller",
|
|
3
|
-
"version": "29.0.0-preview-
|
|
3
|
+
"version": "29.0.0-preview-c34a16a37",
|
|
4
4
|
"description": "The profile sync helps developers synchronize data across multiple clients and devices in a privacy-preserving way. All data saved in the user storage database is encrypted client-side to preserve privacy. The user storage provides a modular design, giving developers the flexibility to construct and manage their storage spaces in a way that best suits their needs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|