@metamask-previews/profile-sync-controller 15.0.0-preview-0c874fe4 → 15.0.0-preview-4ec8b2d
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/controllers/authentication/AuthenticationController.cjs +24 -58
- package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.cts +4 -6
- package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.d.mts +4 -6
- package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
- package/dist/controllers/authentication/AuthenticationController.mjs +25 -59
- package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.cjs +4 -25
- package/dist/controllers/authentication/auth-snap-requests.cjs.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.cts +2 -12
- package/dist/controllers/authentication/auth-snap-requests.d.cts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.d.mts +2 -12
- package/dist/controllers/authentication/auth-snap-requests.d.mts.map +1 -1
- package/dist/controllers/authentication/auth-snap-requests.mjs +3 -23
- package/dist/controllers/authentication/auth-snap-requests.mjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.cjs +3 -36
- package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.cts +5 -7
- package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.d.mts +5 -7
- package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
- package/dist/controllers/authentication/mocks/mockResponses.mjs +3 -36
- package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.cjs +27 -76
- package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.cts +9 -23
- package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.d.mts +9 -23
- package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
- package/dist/controllers/user-storage/UserStorageController.mjs +28 -77
- package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.cjs +28 -33
- package/dist/controllers/user-storage/account-syncing/controller-integration.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.cts +2 -5
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.mts +2 -5
- package/dist/controllers/user-storage/account-syncing/controller-integration.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/controller-integration.mjs +29 -34
- package/dist/controllers/user-storage/account-syncing/controller-integration.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.cjs +7 -12
- package/dist/controllers/user-storage/account-syncing/sync-utils.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts +2 -6
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts +2 -6
- package/dist/controllers/user-storage/account-syncing/sync-utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/sync-utils.mjs +7 -12
- package/dist/controllers/user-storage/account-syncing/sync-utils.mjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.cjs +42 -1
- package/dist/controllers/user-storage/account-syncing/utils.cjs.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.cts +18 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.cts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.mts +18 -1
- package/dist/controllers/user-storage/account-syncing/utils.d.mts.map +1 -1
- package/dist/controllers/user-storage/account-syncing/utils.mjs +39 -0
- package/dist/controllers/user-storage/account-syncing/utils.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +22 -22
- package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +22 -22
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.cts +8 -8
- package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.d.mts +8 -8
- package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
- package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
- package/dist/sdk/authentication.cjs +11 -8
- package/dist/sdk/authentication.cjs.map +1 -1
- package/dist/sdk/authentication.d.cts +4 -4
- package/dist/sdk/authentication.d.cts.map +1 -1
- package/dist/sdk/authentication.d.mts +4 -4
- package/dist/sdk/authentication.d.mts.map +1 -1
- package/dist/sdk/authentication.mjs +11 -8
- package/dist/sdk/authentication.mjs.map +1 -1
- package/dist/sdk/user-storage.cjs +32 -38
- package/dist/sdk/user-storage.cjs.map +1 -1
- package/dist/sdk/user-storage.d.cts +3 -4
- package/dist/sdk/user-storage.d.cts.map +1 -1
- package/dist/sdk/user-storage.d.mts +3 -4
- package/dist/sdk/user-storage.d.mts.map +1 -1
- package/dist/sdk/user-storage.mjs +32 -38
- package/dist/sdk/user-storage.mjs.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs +4 -16
- package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +2 -2
- package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -1
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs +4 -16
- package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -1
- package/dist/shared/storage-schema.cjs +6 -1
- 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 +4 -0
- package/dist/shared/storage-schema.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-snap-requests.cjs","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":";;;AAMA,MAAM,MAAM,GAAG,oCAA8C,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"auth-snap-requests.cjs","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":";;;AAMA,MAAM,MAAM,GAAG,oCAA8C,CAAC;AAE9D;;;;GAIG;AACH,SAAgB,0BAA0B;IACxC,OAAO;QACL,MAAM;QACN,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,cAAqB;QAC9B,OAAO,EAAE;YACP,MAAM,EAAE,cAAc;SACvB;KACF,CAAC;AACJ,CAAC;AATD,gEASC;AAED;;;;;GAKG;AACH,SAAgB,4BAA4B,CAC1C,OAA6B;IAE7B,OAAO;QACL,MAAM;QACN,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,cAAqB;QAC9B,OAAO,EAAE;YACP,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,EAAE,OAAO,EAAE;SACpB;KACF,CAAC;AACJ,CAAC;AAZD,oEAYC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\n\ntype SnapRPCRequest = Parameters<HandleSnapRequest['handler']>[0];\n\nconst snapId = 'npm:@metamask/message-signing-snap' as SnapId;\n\n/**\n * Constructs Request to Message Signing Snap to get Public Key\n *\n * @returns Snap Public Key Request\n */\nexport function createSnapPublicKeyRequest(): SnapRPCRequest {\n return {\n snapId,\n origin: 'metamask',\n handler: 'onRpcRequest' as any,\n request: {\n method: 'getPublicKey',\n },\n };\n}\n\n/**\n * Constructs Request to get Message Signing Snap to sign a message.\n *\n * @param message - message to sign\n * @returns Snap Sign Message Request\n */\nexport function createSnapSignMessageRequest(\n message: `metamask:${string}`,\n): SnapRPCRequest {\n return {\n snapId,\n origin: 'metamask',\n handler: 'onRpcRequest' as any,\n request: {\n method: 'signMessage',\n params: { message },\n },\n };\n}\n"]}
|
|
@@ -3,25 +3,15 @@ type SnapRPCRequest = Parameters<HandleSnapRequest['handler']>[0];
|
|
|
3
3
|
/**
|
|
4
4
|
* Constructs Request to Message Signing Snap to get Public Key
|
|
5
5
|
*
|
|
6
|
-
* @param entropySourceId - The source of entropy to use for key generation,
|
|
7
|
-
* when multiple sources are available (Multi-SRP).
|
|
8
6
|
* @returns Snap Public Key Request
|
|
9
7
|
*/
|
|
10
|
-
export declare function createSnapPublicKeyRequest(
|
|
11
|
-
/**
|
|
12
|
-
* Constructs Request to Message Signing Snap to get [EntropySourceId, PublicKey][]
|
|
13
|
-
*
|
|
14
|
-
* @returns Snap getAllPublicKeys Request
|
|
15
|
-
*/
|
|
16
|
-
export declare function createSnapAllPublicKeysRequest(): SnapRPCRequest;
|
|
8
|
+
export declare function createSnapPublicKeyRequest(): SnapRPCRequest;
|
|
17
9
|
/**
|
|
18
10
|
* Constructs Request to get Message Signing Snap to sign a message.
|
|
19
11
|
*
|
|
20
12
|
* @param message - message to sign
|
|
21
|
-
* @param entropySourceId - The source of entropy to use for key generation,
|
|
22
|
-
* when multiple sources are available (Multi-SRP).
|
|
23
13
|
* @returns Snap Sign Message Request
|
|
24
14
|
*/
|
|
25
|
-
export declare function createSnapSignMessageRequest(message: `metamask:${string}
|
|
15
|
+
export declare function createSnapSignMessageRequest(message: `metamask:${string}`): SnapRPCRequest;
|
|
26
16
|
export {};
|
|
27
17
|
//# sourceMappingURL=auth-snap-requests.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-snap-requests.d.cts","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAGrE,KAAK,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAIlE
|
|
1
|
+
{"version":3,"file":"auth-snap-requests.d.cts","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAGrE,KAAK,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAIlE;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,CAS3D;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,YAAY,MAAM,EAAE,GAC5B,cAAc,CAUhB"}
|
|
@@ -3,25 +3,15 @@ type SnapRPCRequest = Parameters<HandleSnapRequest['handler']>[0];
|
|
|
3
3
|
/**
|
|
4
4
|
* Constructs Request to Message Signing Snap to get Public Key
|
|
5
5
|
*
|
|
6
|
-
* @param entropySourceId - The source of entropy to use for key generation,
|
|
7
|
-
* when multiple sources are available (Multi-SRP).
|
|
8
6
|
* @returns Snap Public Key Request
|
|
9
7
|
*/
|
|
10
|
-
export declare function createSnapPublicKeyRequest(
|
|
11
|
-
/**
|
|
12
|
-
* Constructs Request to Message Signing Snap to get [EntropySourceId, PublicKey][]
|
|
13
|
-
*
|
|
14
|
-
* @returns Snap getAllPublicKeys Request
|
|
15
|
-
*/
|
|
16
|
-
export declare function createSnapAllPublicKeysRequest(): SnapRPCRequest;
|
|
8
|
+
export declare function createSnapPublicKeyRequest(): SnapRPCRequest;
|
|
17
9
|
/**
|
|
18
10
|
* Constructs Request to get Message Signing Snap to sign a message.
|
|
19
11
|
*
|
|
20
12
|
* @param message - message to sign
|
|
21
|
-
* @param entropySourceId - The source of entropy to use for key generation,
|
|
22
|
-
* when multiple sources are available (Multi-SRP).
|
|
23
13
|
* @returns Snap Sign Message Request
|
|
24
14
|
*/
|
|
25
|
-
export declare function createSnapSignMessageRequest(message: `metamask:${string}
|
|
15
|
+
export declare function createSnapSignMessageRequest(message: `metamask:${string}`): SnapRPCRequest;
|
|
26
16
|
export {};
|
|
27
17
|
//# sourceMappingURL=auth-snap-requests.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-snap-requests.d.mts","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAGrE,KAAK,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAIlE
|
|
1
|
+
{"version":3,"file":"auth-snap-requests.d.mts","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AAGrE,KAAK,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAIlE;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,CAS3D;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,YAAY,MAAM,EAAE,GAC5B,cAAc,CAUhB"}
|
|
@@ -2,33 +2,15 @@ const snapId = 'npm:@metamask/message-signing-snap';
|
|
|
2
2
|
/**
|
|
3
3
|
* Constructs Request to Message Signing Snap to get Public Key
|
|
4
4
|
*
|
|
5
|
-
* @param entropySourceId - The source of entropy to use for key generation,
|
|
6
|
-
* when multiple sources are available (Multi-SRP).
|
|
7
5
|
* @returns Snap Public Key Request
|
|
8
6
|
*/
|
|
9
|
-
export function createSnapPublicKeyRequest(
|
|
7
|
+
export function createSnapPublicKeyRequest() {
|
|
10
8
|
return {
|
|
11
9
|
snapId,
|
|
12
10
|
origin: 'metamask',
|
|
13
11
|
handler: 'onRpcRequest',
|
|
14
12
|
request: {
|
|
15
13
|
method: 'getPublicKey',
|
|
16
|
-
...(entropySourceId ? { params: { entropySourceId } } : {}),
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Constructs Request to Message Signing Snap to get [EntropySourceId, PublicKey][]
|
|
22
|
-
*
|
|
23
|
-
* @returns Snap getAllPublicKeys Request
|
|
24
|
-
*/
|
|
25
|
-
export function createSnapAllPublicKeysRequest() {
|
|
26
|
-
return {
|
|
27
|
-
snapId,
|
|
28
|
-
origin: 'metamask',
|
|
29
|
-
handler: 'onRpcRequest',
|
|
30
|
-
request: {
|
|
31
|
-
method: 'getAllPublicKeys',
|
|
32
14
|
},
|
|
33
15
|
};
|
|
34
16
|
}
|
|
@@ -36,18 +18,16 @@ export function createSnapAllPublicKeysRequest() {
|
|
|
36
18
|
* Constructs Request to get Message Signing Snap to sign a message.
|
|
37
19
|
*
|
|
38
20
|
* @param message - message to sign
|
|
39
|
-
* @param entropySourceId - The source of entropy to use for key generation,
|
|
40
|
-
* when multiple sources are available (Multi-SRP).
|
|
41
21
|
* @returns Snap Sign Message Request
|
|
42
22
|
*/
|
|
43
|
-
export function createSnapSignMessageRequest(message
|
|
23
|
+
export function createSnapSignMessageRequest(message) {
|
|
44
24
|
return {
|
|
45
25
|
snapId,
|
|
46
26
|
origin: 'metamask',
|
|
47
27
|
handler: 'onRpcRequest',
|
|
48
28
|
request: {
|
|
49
29
|
method: 'signMessage',
|
|
50
|
-
params: { message
|
|
30
|
+
params: { message },
|
|
51
31
|
},
|
|
52
32
|
};
|
|
53
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-snap-requests.mjs","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,GAAG,oCAA8C,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"auth-snap-requests.mjs","sourceRoot":"","sources":["../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,GAAG,oCAA8C,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,MAAM;QACN,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,cAAqB;QAC9B,OAAO,EAAE;YACP,MAAM,EAAE,cAAc;SACvB;KACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAA6B;IAE7B,OAAO;QACL,MAAM;QACN,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,cAAqB;QAC9B,OAAO,EAAE;YACP,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,EAAE,OAAO,EAAE;SACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\n\ntype SnapRPCRequest = Parameters<HandleSnapRequest['handler']>[0];\n\nconst snapId = 'npm:@metamask/message-signing-snap' as SnapId;\n\n/**\n * Constructs Request to Message Signing Snap to get Public Key\n *\n * @returns Snap Public Key Request\n */\nexport function createSnapPublicKeyRequest(): SnapRPCRequest {\n return {\n snapId,\n origin: 'metamask',\n handler: 'onRpcRequest' as any,\n request: {\n method: 'getPublicKey',\n },\n };\n}\n\n/**\n * Constructs Request to get Message Signing Snap to sign a message.\n *\n * @param message - message to sign\n * @returns Snap Sign Message Request\n */\nexport function createSnapSignMessageRequest(\n message: `metamask:${string}`,\n): SnapRPCRequest {\n return {\n snapId,\n origin: 'metamask',\n handler: 'onRpcRequest' as any,\n request: {\n method: 'signMessage',\n params: { message },\n },\n };\n}\n"]}
|
|
@@ -9,17 +9,7 @@ const getMockAuthNonceResponse = () => {
|
|
|
9
9
|
return {
|
|
10
10
|
url: auth_1.MOCK_NONCE_URL,
|
|
11
11
|
requestMethod: 'GET',
|
|
12
|
-
response:
|
|
13
|
-
// The goal here is to have this identifier bubble all the way up to being the access token
|
|
14
|
-
// That way, we can use it to segregate data in the test environment
|
|
15
|
-
const identifier = path?.split('?identifier=')[1];
|
|
16
|
-
const e2eIdentifier = getE2ESrpIdentifierForPublicKey?.(identifier ?? '');
|
|
17
|
-
return {
|
|
18
|
-
...exports.MOCK_NONCE_RESPONSE,
|
|
19
|
-
nonce: e2eIdentifier ?? exports.MOCK_NONCE_RESPONSE.nonce,
|
|
20
|
-
identifier: exports.MOCK_NONCE_RESPONSE.identifier,
|
|
21
|
-
};
|
|
22
|
-
},
|
|
12
|
+
response: exports.MOCK_NONCE_RESPONSE,
|
|
23
13
|
};
|
|
24
14
|
};
|
|
25
15
|
exports.getMockAuthNonceResponse = getMockAuthNonceResponse;
|
|
@@ -28,21 +18,7 @@ const getMockAuthLoginResponse = () => {
|
|
|
28
18
|
return {
|
|
29
19
|
url: auth_1.MOCK_SRP_LOGIN_URL,
|
|
30
20
|
requestMethod: 'POST',
|
|
31
|
-
|
|
32
|
-
// to make it easier to segregate data in the test environment.
|
|
33
|
-
response: (requestJsonBody) => {
|
|
34
|
-
const splittedRawMessage = requestJsonBody?.raw_message.split(':');
|
|
35
|
-
const e2eIdentifier = splittedRawMessage?.[splittedRawMessage.length - 2];
|
|
36
|
-
return {
|
|
37
|
-
...exports.MOCK_LOGIN_RESPONSE,
|
|
38
|
-
token: e2eIdentifier ?? exports.MOCK_LOGIN_RESPONSE.token,
|
|
39
|
-
profile: {
|
|
40
|
-
...exports.MOCK_LOGIN_RESPONSE.profile,
|
|
41
|
-
profile_id: e2eIdentifier ?? exports.MOCK_LOGIN_RESPONSE.profile.profile_id,
|
|
42
|
-
identifier_id: e2eIdentifier ?? exports.MOCK_LOGIN_RESPONSE.profile.identifier_id,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
},
|
|
21
|
+
response: exports.MOCK_LOGIN_RESPONSE,
|
|
46
22
|
};
|
|
47
23
|
};
|
|
48
24
|
exports.getMockAuthLoginResponse = getMockAuthLoginResponse;
|
|
@@ -51,16 +27,7 @@ const getMockAuthAccessTokenResponse = () => {
|
|
|
51
27
|
return {
|
|
52
28
|
url: auth_1.MOCK_OIDC_TOKEN_URL,
|
|
53
29
|
requestMethod: 'POST',
|
|
54
|
-
response:
|
|
55
|
-
// We end up setting the access token to the e2eIdentifier in the test environment
|
|
56
|
-
// This is then attached to every request's Authorization header
|
|
57
|
-
// and used to segregate data in the test environment
|
|
58
|
-
const e2eIdentifier = new URLSearchParams(requestJsonBody).get('assertion');
|
|
59
|
-
return {
|
|
60
|
-
...exports.MOCK_OATH_TOKEN_RESPONSE,
|
|
61
|
-
access_token: e2eIdentifier ?? exports.MOCK_OATH_TOKEN_RESPONSE.access_token,
|
|
62
|
-
};
|
|
63
|
-
},
|
|
30
|
+
response: exports.MOCK_OATH_TOKEN_RESPONSE,
|
|
64
31
|
};
|
|
65
32
|
};
|
|
66
33
|
exports.getMockAuthAccessTokenResponse = getMockAuthAccessTokenResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.cjs","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":";;;AAAA,sDAQiC;AAQpB,QAAA,mBAAmB,GAAG,0BAAuB,CAAC;AAC9C,QAAA,UAAU,GAAG,2BAAmB,CAAC,KAAK,CAAC;AACvC,QAAA,QAAQ,GAAG,eAAY,CAAC;AAE9B,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO;QACL,GAAG,EAAE,qBAAc;QACnB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"mockResponses.cjs","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":";;;AAAA,sDAQiC;AAQpB,QAAA,mBAAmB,GAAG,0BAAuB,CAAC;AAC9C,QAAA,UAAU,GAAG,2BAAmB,CAAC,KAAK,CAAC;AACvC,QAAA,QAAQ,GAAG,eAAY,CAAC;AAE9B,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO;QACL,GAAG,EAAE,qBAAc;QACnB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,2BAAmB;KACP,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,wBAAwB,4BAMnC;AAEW,QAAA,mBAAmB,GAAG,8BAA2B,CAAC;AAExD,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO;QACL,GAAG,EAAE,yBAAkB;QACvB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,2BAAmB;KACP,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,wBAAwB,4BAMnC;AAEW,QAAA,wBAAwB,GAAG,+BAA4B,CAAC;AAE9D,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,OAAO;QACL,GAAG,EAAE,0BAAmB;QACxB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,gCAAwB;KACZ,CAAC;AAC3B,CAAC,CAAC;AANW,QAAA,8BAA8B,kCAMzC","sourcesContent":["import {\n MOCK_NONCE_RESPONSE as SDK_MOCK_NONCE_RESPONSE,\n MOCK_JWT as SDK_MOCK_JWT,\n MOCK_SRP_LOGIN_RESPONSE as SDK_MOCK_SRP_LOGIN_RESPONSE,\n MOCK_OIDC_TOKEN_RESPONSE as SDK_MOCK_OIDC_TOKEN_RESPONSE,\n MOCK_NONCE_URL,\n MOCK_SRP_LOGIN_URL,\n MOCK_OIDC_TOKEN_URL,\n} from '../../../sdk/mocks/auth';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT';\n response: unknown;\n};\n\nexport const MOCK_NONCE_RESPONSE = SDK_MOCK_NONCE_RESPONSE;\nexport const MOCK_NONCE = MOCK_NONCE_RESPONSE.nonce;\nexport const MOCK_JWT = SDK_MOCK_JWT;\n\nexport const getMockAuthNonceResponse = () => {\n return {\n url: MOCK_NONCE_URL,\n requestMethod: 'GET',\n response: MOCK_NONCE_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const MOCK_LOGIN_RESPONSE = SDK_MOCK_SRP_LOGIN_RESPONSE;\n\nexport const getMockAuthLoginResponse = () => {\n return {\n url: MOCK_SRP_LOGIN_URL,\n requestMethod: 'POST',\n response: MOCK_LOGIN_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const MOCK_OATH_TOKEN_RESPONSE = SDK_MOCK_OIDC_TOKEN_RESPONSE;\n\nexport const getMockAuthAccessTokenResponse = () => {\n return {\n url: MOCK_OIDC_TOKEN_URL,\n requestMethod: 'POST',\n response: MOCK_OATH_TOKEN_RESPONSE,\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -8,7 +8,7 @@ export declare const MOCK_JWT = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImI
|
|
|
8
8
|
export declare const getMockAuthNonceResponse: () => {
|
|
9
9
|
url: string;
|
|
10
10
|
requestMethod: "GET";
|
|
11
|
-
response:
|
|
11
|
+
response: {
|
|
12
12
|
nonce: string;
|
|
13
13
|
identifier: string;
|
|
14
14
|
expires_in: number;
|
|
@@ -28,18 +28,16 @@ export declare const MOCK_LOGIN_RESPONSE: {
|
|
|
28
28
|
export declare const getMockAuthLoginResponse: () => {
|
|
29
29
|
url: string;
|
|
30
30
|
requestMethod: "POST";
|
|
31
|
-
response:
|
|
32
|
-
raw_message: string;
|
|
33
|
-
}) => {
|
|
31
|
+
response: {
|
|
34
32
|
token: string;
|
|
33
|
+
expires_in: number;
|
|
35
34
|
profile: {
|
|
36
35
|
profile_id: string;
|
|
37
|
-
identifier_id: string;
|
|
38
36
|
metametrics_id: string;
|
|
37
|
+
identifier_id: string;
|
|
39
38
|
identifier_type: string;
|
|
40
39
|
encrypted_storage_key: string;
|
|
41
40
|
};
|
|
42
|
-
expires_in: number;
|
|
43
41
|
};
|
|
44
42
|
};
|
|
45
43
|
export declare const MOCK_OATH_TOKEN_RESPONSE: {
|
|
@@ -49,7 +47,7 @@ export declare const MOCK_OATH_TOKEN_RESPONSE: {
|
|
|
49
47
|
export declare const getMockAuthAccessTokenResponse: () => {
|
|
50
48
|
url: string;
|
|
51
49
|
requestMethod: "POST";
|
|
52
|
-
response:
|
|
50
|
+
response: {
|
|
53
51
|
access_token: string;
|
|
54
52
|
expires_in: number;
|
|
55
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,mBAAmB;;;;CAA0B,CAAC;AAC3D,eAAO,MAAM,UAAU,QAA4B,CAAC;AACpD,eAAO,MAAM,QAAQ,upBAAe,CAAC;AAErC,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"mockResponses.d.cts","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,mBAAmB;;;;CAA0B,CAAC;AAC3D,eAAO,MAAM,UAAU,QAA4B,CAAC;AACpD,eAAO,MAAM,QAAQ,upBAAe,CAAC;AAErC,eAAO,MAAM,wBAAwB;;;;;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAA8B,CAAC;AAE/D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAA+B,CAAC;AAErE,eAAO,MAAM,8BAA8B;;;;;;;CAM1C,CAAC"}
|
|
@@ -8,7 +8,7 @@ export declare const MOCK_JWT = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImI
|
|
|
8
8
|
export declare const getMockAuthNonceResponse: () => {
|
|
9
9
|
url: string;
|
|
10
10
|
requestMethod: "GET";
|
|
11
|
-
response:
|
|
11
|
+
response: {
|
|
12
12
|
nonce: string;
|
|
13
13
|
identifier: string;
|
|
14
14
|
expires_in: number;
|
|
@@ -28,18 +28,16 @@ export declare const MOCK_LOGIN_RESPONSE: {
|
|
|
28
28
|
export declare const getMockAuthLoginResponse: () => {
|
|
29
29
|
url: string;
|
|
30
30
|
requestMethod: "POST";
|
|
31
|
-
response:
|
|
32
|
-
raw_message: string;
|
|
33
|
-
}) => {
|
|
31
|
+
response: {
|
|
34
32
|
token: string;
|
|
33
|
+
expires_in: number;
|
|
35
34
|
profile: {
|
|
36
35
|
profile_id: string;
|
|
37
|
-
identifier_id: string;
|
|
38
36
|
metametrics_id: string;
|
|
37
|
+
identifier_id: string;
|
|
39
38
|
identifier_type: string;
|
|
40
39
|
encrypted_storage_key: string;
|
|
41
40
|
};
|
|
42
|
-
expires_in: number;
|
|
43
41
|
};
|
|
44
42
|
};
|
|
45
43
|
export declare const MOCK_OATH_TOKEN_RESPONSE: {
|
|
@@ -49,7 +47,7 @@ export declare const MOCK_OATH_TOKEN_RESPONSE: {
|
|
|
49
47
|
export declare const getMockAuthAccessTokenResponse: () => {
|
|
50
48
|
url: string;
|
|
51
49
|
requestMethod: "POST";
|
|
52
|
-
response:
|
|
50
|
+
response: {
|
|
53
51
|
access_token: string;
|
|
54
52
|
expires_in: number;
|
|
55
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,mBAAmB;;;;CAA0B,CAAC;AAC3D,eAAO,MAAM,UAAU,QAA4B,CAAC;AACpD,eAAO,MAAM,QAAQ,upBAAe,CAAC;AAErC,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"mockResponses.d.mts","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,mBAAmB;;;;CAA0B,CAAC;AAC3D,eAAO,MAAM,UAAU,QAA4B,CAAC;AACpD,eAAO,MAAM,QAAQ,upBAAe,CAAC;AAErC,eAAO,MAAM,wBAAwB;;;;;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAA8B,CAAC;AAE/D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAA+B,CAAC;AAErE,eAAO,MAAM,8BAA8B;;;;;;;CAM1C,CAAC"}
|
|
@@ -6,17 +6,7 @@ export const getMockAuthNonceResponse = () => {
|
|
|
6
6
|
return {
|
|
7
7
|
url: MOCK_NONCE_URL,
|
|
8
8
|
requestMethod: 'GET',
|
|
9
|
-
response:
|
|
10
|
-
// The goal here is to have this identifier bubble all the way up to being the access token
|
|
11
|
-
// That way, we can use it to segregate data in the test environment
|
|
12
|
-
const identifier = path?.split('?identifier=')[1];
|
|
13
|
-
const e2eIdentifier = getE2ESrpIdentifierForPublicKey?.(identifier ?? '');
|
|
14
|
-
return {
|
|
15
|
-
...MOCK_NONCE_RESPONSE,
|
|
16
|
-
nonce: e2eIdentifier ?? MOCK_NONCE_RESPONSE.nonce,
|
|
17
|
-
identifier: MOCK_NONCE_RESPONSE.identifier,
|
|
18
|
-
};
|
|
19
|
-
},
|
|
9
|
+
response: MOCK_NONCE_RESPONSE,
|
|
20
10
|
};
|
|
21
11
|
};
|
|
22
12
|
export const MOCK_LOGIN_RESPONSE = SDK_MOCK_SRP_LOGIN_RESPONSE;
|
|
@@ -24,21 +14,7 @@ export const getMockAuthLoginResponse = () => {
|
|
|
24
14
|
return {
|
|
25
15
|
url: MOCK_SRP_LOGIN_URL,
|
|
26
16
|
requestMethod: 'POST',
|
|
27
|
-
|
|
28
|
-
// to make it easier to segregate data in the test environment.
|
|
29
|
-
response: (requestJsonBody) => {
|
|
30
|
-
const splittedRawMessage = requestJsonBody?.raw_message.split(':');
|
|
31
|
-
const e2eIdentifier = splittedRawMessage?.[splittedRawMessage.length - 2];
|
|
32
|
-
return {
|
|
33
|
-
...MOCK_LOGIN_RESPONSE,
|
|
34
|
-
token: e2eIdentifier ?? MOCK_LOGIN_RESPONSE.token,
|
|
35
|
-
profile: {
|
|
36
|
-
...MOCK_LOGIN_RESPONSE.profile,
|
|
37
|
-
profile_id: e2eIdentifier ?? MOCK_LOGIN_RESPONSE.profile.profile_id,
|
|
38
|
-
identifier_id: e2eIdentifier ?? MOCK_LOGIN_RESPONSE.profile.identifier_id,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
},
|
|
17
|
+
response: MOCK_LOGIN_RESPONSE,
|
|
42
18
|
};
|
|
43
19
|
};
|
|
44
20
|
export const MOCK_OATH_TOKEN_RESPONSE = SDK_MOCK_OIDC_TOKEN_RESPONSE;
|
|
@@ -46,16 +22,7 @@ export const getMockAuthAccessTokenResponse = () => {
|
|
|
46
22
|
return {
|
|
47
23
|
url: MOCK_OIDC_TOKEN_URL,
|
|
48
24
|
requestMethod: 'POST',
|
|
49
|
-
response:
|
|
50
|
-
// We end up setting the access token to the e2eIdentifier in the test environment
|
|
51
|
-
// This is then attached to every request's Authorization header
|
|
52
|
-
// and used to segregate data in the test environment
|
|
53
|
-
const e2eIdentifier = new URLSearchParams(requestJsonBody).get('assertion');
|
|
54
|
-
return {
|
|
55
|
-
...MOCK_OATH_TOKEN_RESPONSE,
|
|
56
|
-
access_token: e2eIdentifier ?? MOCK_OATH_TOKEN_RESPONSE.access_token,
|
|
57
|
-
};
|
|
58
|
-
},
|
|
25
|
+
response: MOCK_OATH_TOKEN_RESPONSE,
|
|
59
26
|
};
|
|
60
27
|
};
|
|
61
28
|
//# sourceMappingURL=mockResponses.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,uBAAuB,EAC9C,QAAQ,IAAI,YAAY,EACxB,uBAAuB,IAAI,2BAA2B,EACtD,wBAAwB,IAAI,4BAA4B,EACxD,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACpB,oCAAgC;AAQjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO;QACL,GAAG,EAAE,cAAc;QACnB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"mockResponses.mjs","sourceRoot":"","sources":["../../../../src/controllers/authentication/mocks/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,uBAAuB,EAC9C,QAAQ,IAAI,YAAY,EACxB,uBAAuB,IAAI,2BAA2B,EACtD,wBAAwB,IAAI,4BAA4B,EACxD,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACpB,oCAAgC;AAQjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO;QACL,GAAG,EAAE,cAAc;QACnB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,mBAAmB;KACP,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAE/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO;QACL,GAAG,EAAE,kBAAkB;QACvB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,mBAAmB;KACP,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,4BAA4B,CAAC;AAErE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,OAAO;QACL,GAAG,EAAE,mBAAmB;QACxB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,wBAAwB;KACZ,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["import {\n MOCK_NONCE_RESPONSE as SDK_MOCK_NONCE_RESPONSE,\n MOCK_JWT as SDK_MOCK_JWT,\n MOCK_SRP_LOGIN_RESPONSE as SDK_MOCK_SRP_LOGIN_RESPONSE,\n MOCK_OIDC_TOKEN_RESPONSE as SDK_MOCK_OIDC_TOKEN_RESPONSE,\n MOCK_NONCE_URL,\n MOCK_SRP_LOGIN_URL,\n MOCK_OIDC_TOKEN_URL,\n} from '../../../sdk/mocks/auth';\n\ntype MockResponse = {\n url: string;\n requestMethod: 'GET' | 'POST' | 'PUT';\n response: unknown;\n};\n\nexport const MOCK_NONCE_RESPONSE = SDK_MOCK_NONCE_RESPONSE;\nexport const MOCK_NONCE = MOCK_NONCE_RESPONSE.nonce;\nexport const MOCK_JWT = SDK_MOCK_JWT;\n\nexport const getMockAuthNonceResponse = () => {\n return {\n url: MOCK_NONCE_URL,\n requestMethod: 'GET',\n response: MOCK_NONCE_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const MOCK_LOGIN_RESPONSE = SDK_MOCK_SRP_LOGIN_RESPONSE;\n\nexport const getMockAuthLoginResponse = () => {\n return {\n url: MOCK_SRP_LOGIN_URL,\n requestMethod: 'POST',\n response: MOCK_LOGIN_RESPONSE,\n } satisfies MockResponse;\n};\n\nexport const MOCK_OATH_TOKEN_RESPONSE = SDK_MOCK_OIDC_TOKEN_RESPONSE;\n\nexport const getMockAuthAccessTokenResponse = () => {\n return {\n url: MOCK_OIDC_TOKEN_URL,\n requestMethod: 'POST',\n response: MOCK_OATH_TOKEN_RESPONSE,\n } satisfies MockResponse;\n};\n"]}
|
|
@@ -83,8 +83,8 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
83
83
|
});
|
|
84
84
|
_UserStorageController_userStorage.set(this, void 0);
|
|
85
85
|
_UserStorageController_auth.set(this, {
|
|
86
|
-
getProfileId: async (
|
|
87
|
-
const sessionProfile = await this.messagingSystem.call('AuthenticationController:getSessionProfile'
|
|
86
|
+
getProfileId: async () => {
|
|
87
|
+
const sessionProfile = await this.messagingSystem.call('AuthenticationController:getSessionProfile');
|
|
88
88
|
return sessionProfile?.profileId;
|
|
89
89
|
},
|
|
90
90
|
isSignedIn: () => {
|
|
@@ -116,11 +116,11 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
116
116
|
__classPrivateFieldSet(this, _UserStorageController_userStorage, new sdk_1.UserStorage({
|
|
117
117
|
env: sdk_1.Env.PRD,
|
|
118
118
|
auth: {
|
|
119
|
-
getAccessToken: (
|
|
120
|
-
getUserProfile: async (
|
|
121
|
-
return await this.messagingSystem.call('AuthenticationController:getSessionProfile'
|
|
119
|
+
getAccessToken: () => this.messagingSystem.call('AuthenticationController:getBearerToken'),
|
|
120
|
+
getUserProfile: async () => {
|
|
121
|
+
return await this.messagingSystem.call('AuthenticationController:getSessionProfile');
|
|
122
122
|
},
|
|
123
|
-
signMessage: (message
|
|
123
|
+
signMessage: (message) => __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_snapSignMessage).call(this, message),
|
|
124
124
|
},
|
|
125
125
|
}, {
|
|
126
126
|
storage: {
|
|
@@ -152,14 +152,12 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
152
152
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
153
153
|
*
|
|
154
154
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
155
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
156
155
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
157
156
|
*/
|
|
158
|
-
async performGetStorage(path
|
|
157
|
+
async performGetStorage(path) {
|
|
159
158
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getItem(path, {
|
|
160
159
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
161
160
|
validateAgainstSchema: true,
|
|
162
|
-
entropySourceId,
|
|
163
161
|
});
|
|
164
162
|
}
|
|
165
163
|
/**
|
|
@@ -167,14 +165,12 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
167
165
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
168
166
|
*
|
|
169
167
|
* @param path - string in the form of `${feature}` that matches schema
|
|
170
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
171
168
|
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
172
169
|
*/
|
|
173
|
-
async performGetStorageAllFeatureEntries(path
|
|
170
|
+
async performGetStorageAllFeatureEntries(path) {
|
|
174
171
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getAllFeatureItems(path, {
|
|
175
172
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
176
173
|
validateAgainstSchema: true,
|
|
177
|
-
entropySourceId,
|
|
178
174
|
});
|
|
179
175
|
}
|
|
180
176
|
/**
|
|
@@ -183,14 +179,12 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
183
179
|
*
|
|
184
180
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
185
181
|
* @param value - The string data you want to store.
|
|
186
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
187
182
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
188
183
|
*/
|
|
189
|
-
async performSetStorage(path, value
|
|
184
|
+
async performSetStorage(path, value) {
|
|
190
185
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").setItem(path, value, {
|
|
191
186
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
192
187
|
validateAgainstSchema: true,
|
|
193
|
-
entropySourceId,
|
|
194
188
|
});
|
|
195
189
|
}
|
|
196
190
|
/**
|
|
@@ -199,28 +193,24 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
199
193
|
*
|
|
200
194
|
* @param path - string in the form of `${feature}` that matches schema
|
|
201
195
|
* @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
|
|
202
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
203
196
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
204
197
|
*/
|
|
205
|
-
async performBatchSetStorage(path, values
|
|
198
|
+
async performBatchSetStorage(path, values) {
|
|
206
199
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchSetItems(path, values, {
|
|
207
200
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
208
201
|
validateAgainstSchema: true,
|
|
209
|
-
entropySourceId,
|
|
210
202
|
});
|
|
211
203
|
}
|
|
212
204
|
/**
|
|
213
205
|
* Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
214
206
|
*
|
|
215
207
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
216
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
217
208
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
218
209
|
*/
|
|
219
|
-
async performDeleteStorage(path
|
|
210
|
+
async performDeleteStorage(path) {
|
|
220
211
|
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteItem(path, {
|
|
221
212
|
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
222
213
|
validateAgainstSchema: true,
|
|
223
|
-
entropySourceId,
|
|
224
214
|
});
|
|
225
215
|
}
|
|
226
216
|
/**
|
|
@@ -228,15 +218,10 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
228
218
|
* Developers can extend the entry path through the `schema.ts` file.
|
|
229
219
|
*
|
|
230
220
|
* @param path - string in the form of `${feature}` that matches schema
|
|
231
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
232
221
|
* @returns nothing. NOTE that an error is thrown if fails to delete data.
|
|
233
222
|
*/
|
|
234
|
-
async performDeleteStorageAllFeatureEntries(path
|
|
235
|
-
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteAllFeatureItems(path
|
|
236
|
-
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
237
|
-
validateAgainstSchema: true,
|
|
238
|
-
entropySourceId,
|
|
239
|
-
});
|
|
223
|
+
async performDeleteStorageAllFeatureEntries(path) {
|
|
224
|
+
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteAllFeatureItems(path);
|
|
240
225
|
}
|
|
241
226
|
/**
|
|
242
227
|
* Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
|
|
@@ -244,15 +229,10 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
244
229
|
*
|
|
245
230
|
* @param path - string in the form of `${feature}` that matches schema
|
|
246
231
|
* @param values - data to store, in the form of an array of entryKey[]
|
|
247
|
-
* @param entropySourceId - The entropy source ID used to generate the encryption key.
|
|
248
232
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
249
233
|
*/
|
|
250
|
-
async performBatchDeleteStorage(path, values
|
|
251
|
-
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchDeleteItems(path, values
|
|
252
|
-
nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
|
|
253
|
-
validateAgainstSchema: true,
|
|
254
|
-
entropySourceId,
|
|
255
|
-
});
|
|
234
|
+
async performBatchDeleteStorage(path, values) {
|
|
235
|
+
return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchDeleteItems(path, values);
|
|
256
236
|
}
|
|
257
237
|
/**
|
|
258
238
|
* Retrieves the storage key, for internal use only!
|
|
@@ -270,19 +250,6 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
270
250
|
flushStorageKeyCache() {
|
|
271
251
|
__classPrivateFieldSet(this, _UserStorageController_storageKeyCache, {}, "f");
|
|
272
252
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Lists all the available HD keyring metadata IDs.
|
|
275
|
-
* These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
|
|
276
|
-
*
|
|
277
|
-
* @returns A promise that resolves to an array of HD keyring metadata IDs.
|
|
278
|
-
*/
|
|
279
|
-
async listEntropySources() {
|
|
280
|
-
if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
|
|
281
|
-
throw new Error('listEntropySources - unable to call snap, wallet is locked');
|
|
282
|
-
}
|
|
283
|
-
const result = (await this.messagingSystem.call('SnapController:handleRequest', (0, auth_snap_requests_1.createSnapAllPublicKeysRequest)()));
|
|
284
|
-
return result.map(([id]) => id);
|
|
285
|
-
}
|
|
286
253
|
async setIsBackupAndSyncFeatureEnabled(feature, enabled) {
|
|
287
254
|
try {
|
|
288
255
|
__classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_setIsBackupAndSyncUpdateLoading).call(this, true);
|
|
@@ -335,29 +302,16 @@ class UserStorageController extends base_controller_1.BaseController {
|
|
|
335
302
|
* It will add new accounts to the internal accounts list, update/merge conflicting names and re-upload the results in some cases to the user storage.
|
|
336
303
|
*/
|
|
337
304
|
async syncInternalAccountsWithUserStorage() {
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
getMessenger: () => this.messagingSystem,
|
|
349
|
-
getUserStorageControllerInstance: () => this,
|
|
350
|
-
}, entropySourceId);
|
|
351
|
-
}
|
|
352
|
-
// We do this here and not in the finally statement because we want to make sure that
|
|
353
|
-
// the accounts are saved / updated / deleted at least once before we set this flag
|
|
354
|
-
await this.setHasAccountSyncingSyncedAtLeastOnce(true);
|
|
355
|
-
}
|
|
356
|
-
catch (e) {
|
|
357
|
-
// Silently fail for now
|
|
358
|
-
// istanbul ignore next
|
|
359
|
-
console.error(e);
|
|
360
|
-
}
|
|
305
|
+
const profileId = await __classPrivateFieldGet(this, _UserStorageController_auth, "f").getProfileId();
|
|
306
|
+
await (0, controller_integration_1.syncInternalAccountsWithUserStorage)({
|
|
307
|
+
maxNumberOfAccountsToAdd: __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.maxNumberOfAccountsToAdd,
|
|
308
|
+
onAccountAdded: () => __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.onAccountAdded?.(profileId),
|
|
309
|
+
onAccountNameUpdated: () => __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.onAccountNameUpdated?.(profileId),
|
|
310
|
+
onAccountSyncErroneousSituation: (situationMessage, sentryContext) => __classPrivateFieldGet(this, _UserStorageController_config, "f")?.accountSyncing?.onAccountSyncErroneousSituation?.(profileId, situationMessage, sentryContext),
|
|
311
|
+
}, {
|
|
312
|
+
getMessenger: () => this.messagingSystem,
|
|
313
|
+
getUserStorageControllerInstance: () => this,
|
|
314
|
+
});
|
|
361
315
|
}
|
|
362
316
|
/**
|
|
363
317
|
* Saves an individual internal account to the user storage.
|
|
@@ -401,19 +355,16 @@ _UserStorageController_env = new WeakMap(), _UserStorageController_userStorage =
|
|
|
401
355
|
* Signs a specific message using an underlying auth snap.
|
|
402
356
|
*
|
|
403
357
|
* @param message - A specific tagged message to sign.
|
|
404
|
-
* @param entropySourceId - The entropy source ID used to derive the key,
|
|
405
|
-
* when multiple sources are available (Multi-SRP).
|
|
406
358
|
* @returns A Signature created by the snap.
|
|
407
359
|
*/
|
|
408
|
-
async function _UserStorageController_snapSignMessage(message
|
|
409
|
-
// the message is SRP specific already, so there's no need to use the entropySourceId in the cache
|
|
360
|
+
async function _UserStorageController_snapSignMessage(message) {
|
|
410
361
|
if (__classPrivateFieldGet(this, _UserStorageController__snapSignMessageCache, "f")[message]) {
|
|
411
362
|
return __classPrivateFieldGet(this, _UserStorageController__snapSignMessageCache, "f")[message];
|
|
412
363
|
}
|
|
413
364
|
if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
|
|
414
365
|
throw new Error('#snapSignMessage - unable to call snap, wallet is locked');
|
|
415
366
|
}
|
|
416
|
-
const result = (await this.messagingSystem.call('SnapController:handleRequest', (0, auth_snap_requests_1.createSnapSignMessageRequest)(message
|
|
367
|
+
const result = (await this.messagingSystem.call('SnapController:handleRequest', (0, auth_snap_requests_1.createSnapSignMessageRequest)(message)));
|
|
417
368
|
__classPrivateFieldGet(this, _UserStorageController__snapSignMessageCache, "f")[message] = result;
|
|
418
369
|
return result;
|
|
419
370
|
}, _UserStorageController_setIsBackupAndSyncUpdateLoading = function _UserStorageController_setIsBackupAndSyncUpdateLoading(isBackupAndSyncUpdateLoading) {
|