@metamask/profile-sync-controller 0.2.1 → 0.4.0
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 +42 -1
- package/auth/mocks/package.json +9 -0
- package/auth/package.json +9 -0
- package/dist/{chunk-JENTMRXO.js → chunk-246Z6L5V.js} +245 -16
- package/dist/chunk-246Z6L5V.js.map +1 -0
- package/dist/chunk-2677XY6G.mjs +107 -0
- package/dist/chunk-2677XY6G.mjs.map +1 -0
- package/dist/{chunk-BDO3VJEU.mjs → chunk-2CWF7ZTL.mjs} +2 -2
- package/dist/{chunk-ILIZJQ6X.mjs → chunk-2VEMA6OE.mjs} +11 -4
- package/dist/chunk-2VEMA6OE.mjs.map +1 -0
- package/dist/chunk-4LMFZDL4.js +114 -0
- package/dist/chunk-4LMFZDL4.js.map +1 -0
- package/dist/{chunk-VD2IGTS3.js → chunk-4ZGRRVMI.js} +5 -5
- package/dist/{chunk-SLHAVOTE.js → chunk-5MQUI24U.js} +13 -6
- package/dist/chunk-5MQUI24U.js.map +1 -0
- package/dist/chunk-6DAK2U35.mjs +11 -0
- package/dist/chunk-6DAK2U35.mjs.map +1 -0
- package/dist/{chunk-FU7PSGFP.mjs → chunk-76NMME23.mjs} +51 -9
- package/dist/chunk-76NMME23.mjs.map +1 -0
- package/dist/{chunk-7KMONAQI.mjs → chunk-7MSQV43P.mjs} +7 -9
- package/dist/{chunk-7KMONAQI.mjs.map → chunk-7MSQV43P.mjs.map} +1 -1
- package/dist/{chunk-T3FNDVE3.js → chunk-BKQE7DB5.js} +30 -18
- package/dist/chunk-BKQE7DB5.js.map +1 -0
- package/dist/chunk-CHUZGCDV.js +107 -0
- package/dist/chunk-CHUZGCDV.js.map +1 -0
- package/dist/{chunk-K5UKU454.mjs → chunk-COBJUBZE.mjs} +31 -19
- package/dist/chunk-COBJUBZE.mjs.map +1 -0
- package/dist/{chunk-WWQ65CZY.mjs → chunk-D4SNJOID.mjs} +2 -2
- package/dist/chunk-D4SNJOID.mjs.map +1 -0
- package/dist/{chunk-SMKTWM6I.js → chunk-DF24ZX4H.js} +2 -3
- package/dist/chunk-DF24ZX4H.js.map +1 -0
- package/dist/chunk-EHZFPUJH.mjs +53 -0
- package/dist/chunk-EHZFPUJH.mjs.map +1 -0
- package/dist/{chunk-KW3X4TT5.js → chunk-F6BAOSH2.js} +6 -6
- package/dist/chunk-F6BAOSH2.js.map +1 -0
- package/dist/chunk-GQXYWBFK.js +28 -0
- package/dist/chunk-GQXYWBFK.js.map +1 -0
- package/dist/{chunk-DRD22DR5.mjs → chunk-J7NSK6BO.mjs} +2 -2
- package/dist/chunk-JAQ5TPSZ.js +53 -0
- package/dist/chunk-JAQ5TPSZ.js.map +1 -0
- package/dist/{chunk-5TOWF6UW.mjs → chunk-KHASG4H3.mjs} +2 -2
- package/dist/{chunk-G4NU4KP7.js → chunk-KIVBL6OM.js} +6 -6
- package/dist/{chunk-FQ5SDMRE.mjs → chunk-KTCSRECK.mjs} +2 -3
- package/dist/{chunk-FQ5SDMRE.mjs.map → chunk-KTCSRECK.mjs.map} +1 -1
- package/dist/{chunk-7SW3CC66.mjs → chunk-LGXQBALM.mjs} +2 -2
- package/dist/{chunk-5C53GKTU.js.map → chunk-LGXQBALM.mjs.map} +1 -1
- package/dist/{chunk-BOET676P.js → chunk-LLG4D2SC.js} +8 -8
- package/dist/{chunk-NPH5AHLH.mjs → chunk-MK7ABX2V.mjs} +54 -6
- package/dist/chunk-MK7ABX2V.mjs.map +1 -0
- package/dist/{chunk-AK7OTIWA.js → chunk-NIUQ34PY.js} +3 -3
- package/dist/{chunk-MNVUKRZC.js → chunk-PRYLTXW4.js} +15 -9
- package/dist/chunk-PRYLTXW4.js.map +1 -0
- package/dist/{chunk-XSSIP3PJ.js → chunk-Q5KTSMRE.js} +8 -8
- package/dist/{chunk-QE5X2BT3.mjs → chunk-SZ6WMC6C.mjs} +242 -13
- package/dist/chunk-SZ6WMC6C.mjs.map +1 -0
- package/dist/{chunk-PSR2V3R4.js → chunk-T2YURW25.js} +17 -19
- package/dist/chunk-T2YURW25.js.map +1 -0
- package/dist/{chunk-CJLDMVV3.mjs → chunk-UHP2Y32K.mjs} +9 -3
- package/dist/chunk-UHP2Y32K.mjs.map +1 -0
- package/dist/chunk-UHX7HJAI.js +11 -0
- package/dist/chunk-UHX7HJAI.js.map +1 -0
- package/dist/{chunk-FUPEFLXB.js → chunk-UIRAMHNM.js} +60 -12
- package/dist/chunk-UIRAMHNM.js.map +1 -0
- package/dist/{chunk-VYZPOR47.mjs → chunk-YKOMKXG4.mjs} +4 -4
- package/dist/{chunk-WB6MUIML.mjs → chunk-YLURF2PF.mjs} +2 -2
- package/dist/chunk-ZUPTMFEA.mjs +28 -0
- package/dist/chunk-ZUPTMFEA.mjs.map +1 -0
- package/dist/{chunk-5C53GKTU.js → chunk-ZX2KHPXG.js} +5 -5
- package/dist/chunk-ZX2KHPXG.js.map +1 -0
- package/dist/controllers/authentication/AuthenticationController.js +4 -21
- package/dist/controllers/authentication/AuthenticationController.mjs +3 -20
- package/dist/controllers/authentication/index.js +7 -22
- package/dist/controllers/authentication/index.mjs +6 -21
- package/dist/controllers/authentication/services.js +3 -20
- package/dist/controllers/authentication/services.mjs +2 -19
- package/dist/controllers/index.js +13 -23
- package/dist/controllers/index.mjs +12 -22
- package/dist/controllers/user-storage/UserStorageController.js +9 -19
- package/dist/controllers/user-storage/UserStorageController.mjs +8 -18
- package/dist/controllers/user-storage/accounts/constants.js +12 -0
- package/dist/controllers/user-storage/accounts/constants.js.map +1 -0
- package/dist/controllers/user-storage/accounts/constants.mjs +12 -0
- package/dist/controllers/user-storage/accounts/constants.mjs.map +1 -0
- package/dist/controllers/user-storage/accounts/user-storage.js +11 -0
- package/dist/controllers/user-storage/accounts/user-storage.js.map +1 -0
- package/dist/controllers/user-storage/accounts/user-storage.mjs +11 -0
- package/dist/controllers/user-storage/accounts/user-storage.mjs.map +1 -0
- package/dist/controllers/user-storage/encryption/encryption.js +2 -2
- package/dist/controllers/user-storage/encryption/encryption.mjs +1 -1
- package/dist/controllers/user-storage/encryption/index.js +3 -3
- package/dist/controllers/user-storage/encryption/index.mjs +2 -2
- package/dist/controllers/user-storage/index.js +15 -23
- package/dist/controllers/user-storage/index.mjs +12 -20
- package/dist/controllers/user-storage/schema.js +6 -4
- package/dist/controllers/user-storage/schema.mjs +7 -5
- package/dist/controllers/user-storage/services.js +8 -18
- package/dist/controllers/user-storage/services.mjs +7 -17
- package/dist/index.js +20 -18
- package/dist/index.mjs +19 -17
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.js +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs +3 -3
- package/dist/sdk/authentication-jwt-bearer/flow-srp.js +4 -4
- package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +3 -3
- package/dist/sdk/authentication-jwt-bearer/services.js +3 -3
- package/dist/sdk/authentication-jwt-bearer/services.mjs +2 -2
- package/dist/sdk/authentication.js +6 -6
- package/dist/sdk/authentication.mjs +5 -5
- package/dist/sdk/encryption.js +5 -3
- package/dist/sdk/encryption.mjs +6 -4
- package/dist/sdk/env.js +2 -2
- package/dist/sdk/env.mjs +1 -1
- package/dist/sdk/index.js +14 -16
- package/dist/sdk/index.mjs +13 -15
- package/dist/sdk/user-storage.js +7 -7
- package/dist/sdk/user-storage.mjs +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/controllers/authentication/AuthenticationController.d.ts +6 -3
- package/dist/types/controllers/authentication/AuthenticationController.d.ts.map +1 -1
- package/dist/types/controllers/authentication/__fixtures__/mockResponses.d.ts +1 -1
- package/dist/types/controllers/authentication/__fixtures__/mockResponses.d.ts.map +1 -1
- package/dist/types/controllers/authentication/index.d.ts +2 -0
- package/dist/types/controllers/authentication/index.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/UserStorageController.d.ts +52 -11
- package/dist/types/controllers/user-storage/UserStorageController.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/__fixtures__/mockAccounts.d.ts +63 -0
- package/dist/types/controllers/user-storage/__fixtures__/mockAccounts.d.ts.map +1 -0
- package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts +11 -5
- package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts +4 -2
- package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts +1 -1
- package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/accounts/constants.d.ts +4 -0
- package/dist/types/controllers/user-storage/accounts/constants.d.ts.map +1 -0
- package/dist/types/controllers/user-storage/accounts/user-storage.d.ts +32 -0
- package/dist/types/controllers/user-storage/accounts/user-storage.d.ts.map +1 -0
- package/dist/types/controllers/user-storage/encryption/encryption.d.ts +3 -2
- package/dist/types/controllers/user-storage/encryption/encryption.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/index.d.ts +2 -0
- package/dist/types/controllers/user-storage/index.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/schema.d.ts +13 -6
- package/dist/types/controllers/user-storage/schema.d.ts.map +1 -1
- package/dist/types/controllers/user-storage/services.d.ts +23 -4
- package/dist/types/controllers/user-storage/services.d.ts.map +1 -1
- package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts +5 -4
- package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts.map +1 -1
- package/dist/types/sdk/encryption.d.ts +3 -19
- package/dist/types/sdk/encryption.d.ts.map +1 -1
- package/dist/types/sdk/user-storage.d.ts +4 -3
- package/dist/types/sdk/user-storage.d.ts.map +1 -1
- package/package.json +37 -6
- package/user-storage/mocks/package.json +9 -0
- package/user-storage/package.json +9 -0
- package/dist/chunk-3TE6M5TV.js +0 -72
- package/dist/chunk-3TE6M5TV.js.map +0 -1
- package/dist/chunk-4DQF2YNS.js +0 -78
- package/dist/chunk-4DQF2YNS.js.map +0 -1
- package/dist/chunk-7SW3CC66.mjs.map +0 -1
- package/dist/chunk-B5DBQDB3.mjs +0 -140
- package/dist/chunk-B5DBQDB3.mjs.map +0 -1
- package/dist/chunk-CJLDMVV3.mjs.map +0 -1
- package/dist/chunk-FU7PSGFP.mjs.map +0 -1
- package/dist/chunk-FUPEFLXB.js.map +0 -1
- package/dist/chunk-ILIZJQ6X.mjs.map +0 -1
- package/dist/chunk-JENTMRXO.js.map +0 -1
- package/dist/chunk-K5UKU454.mjs.map +0 -1
- package/dist/chunk-KW3X4TT5.js.map +0 -1
- package/dist/chunk-MNVUKRZC.js.map +0 -1
- package/dist/chunk-NPH5AHLH.mjs.map +0 -1
- package/dist/chunk-P4DUDLMY.js +0 -140
- package/dist/chunk-P4DUDLMY.js.map +0 -1
- package/dist/chunk-PSR2V3R4.js.map +0 -1
- package/dist/chunk-QE5X2BT3.mjs.map +0 -1
- package/dist/chunk-SLHAVOTE.js.map +0 -1
- package/dist/chunk-SMKTWM6I.js.map +0 -1
- package/dist/chunk-T3FNDVE3.js.map +0 -1
- package/dist/chunk-WWQ65CZY.mjs.map +0 -1
- package/dist/chunk-XMYWJQNH.mjs +0 -78
- package/dist/chunk-XMYWJQNH.mjs.map +0 -1
- /package/dist/{chunk-BDO3VJEU.mjs.map → chunk-2CWF7ZTL.mjs.map} +0 -0
- /package/dist/{chunk-VD2IGTS3.js.map → chunk-4ZGRRVMI.js.map} +0 -0
- /package/dist/{chunk-DRD22DR5.mjs.map → chunk-J7NSK6BO.mjs.map} +0 -0
- /package/dist/{chunk-5TOWF6UW.mjs.map → chunk-KHASG4H3.mjs.map} +0 -0
- /package/dist/{chunk-G4NU4KP7.js.map → chunk-KIVBL6OM.js.map} +0 -0
- /package/dist/{chunk-BOET676P.js.map → chunk-LLG4D2SC.js.map} +0 -0
- /package/dist/{chunk-AK7OTIWA.js.map → chunk-NIUQ34PY.js.map} +0 -0
- /package/dist/{chunk-XSSIP3PJ.js.map → chunk-Q5KTSMRE.js.map} +0 -0
- /package/dist/{chunk-VYZPOR47.mjs.map → chunk-YKOMKXG4.mjs.map} +0 -0
- /package/dist/{chunk-WB6MUIML.mjs.map → chunk-YLURF2PF.mjs.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RestrictedControllerMessenger } from '@metamask/base-controller';
|
|
1
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from '@metamask/base-controller';
|
|
2
2
|
import { BaseController } from '@metamask/base-controller';
|
|
3
3
|
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent } from '@metamask/keyring-controller';
|
|
4
4
|
import type { HandleSnapRequest } from '@metamask/snaps-controllers';
|
|
@@ -35,15 +35,18 @@ type CreateActionsObj<Controller extends keyof AuthenticationController> = {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
type ActionsObj = CreateActionsObj<'performSignIn' | 'performSignOut' | 'getBearerToken' | 'getSessionProfile' | 'isSignedIn'>;
|
|
38
|
-
export type Actions = ActionsObj[keyof ActionsObj];
|
|
38
|
+
export type Actions = ActionsObj[keyof ActionsObj] | AuthenticationControllerGetStateAction;
|
|
39
|
+
export type AuthenticationControllerGetStateAction = ControllerGetStateAction<typeof controllerName, AuthenticationControllerState>;
|
|
39
40
|
export type AuthenticationControllerPerformSignIn = ActionsObj['performSignIn'];
|
|
40
41
|
export type AuthenticationControllerPerformSignOut = ActionsObj['performSignOut'];
|
|
41
42
|
export type AuthenticationControllerGetBearerToken = ActionsObj['getBearerToken'];
|
|
42
43
|
export type AuthenticationControllerGetSessionProfile = ActionsObj['getSessionProfile'];
|
|
43
44
|
export type AuthenticationControllerIsSignedIn = ActionsObj['isSignedIn'];
|
|
45
|
+
export type AuthenticationControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, AuthenticationControllerState>;
|
|
46
|
+
export type Events = AuthenticationControllerStateChangeEvent;
|
|
44
47
|
export type AllowedActions = HandleSnapRequest | KeyringControllerGetStateAction;
|
|
45
48
|
export type AllowedEvents = KeyringControllerLockEvent | KeyringControllerUnlockEvent;
|
|
46
|
-
export type AuthenticationControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
|
|
49
|
+
export type AuthenticationControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
|
|
47
50
|
/**
|
|
48
51
|
* Controller that enables authentication for restricted endpoints.
|
|
49
52
|
* Used for Global Profile Syncing and Notifications
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAerE,QAAA,MAAM,cAAc,6BAA6B,CAAC;AAGlD,KAAK,cAAc,GAAG;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,OAAO,EAAE,cAAc,CAAC;IACxB,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,gBAAgB,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,YAAY,EAAE,6BAE1B,CAAC;AAaF,KAAK,gBAAgB,CAAC,UAAU,SAAS,MAAM,wBAAwB,IAAI;KACxE,CAAC,IAAI,UAAU,GAAG;QACjB,IAAI,EAAE,GAAG,OAAO,cAAc,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;KACtC;CACF,CAAC;AACF,KAAK,UAAU,GAAG,gBAAgB,CAC9B,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,YAAY,CACf,CAAC;AACF,MAAM,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAerE,QAAA,MAAM,cAAc,6BAA6B,CAAC;AAGlD,KAAK,cAAc,GAAG;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,OAAO,EAAE,cAAc,CAAC;IACxB,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;CACnB,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J,MAAM,MAAM,MAAM,GAAG,wCAAwC,CAAC;AAG9D,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,+BAA+B,CAAC;AAEpC,MAAM,MAAM,aAAa,GACrB,0BAA0B,GAC1B,4BAA4B,CAAC;AAGjC,MAAM,MAAM,iCAAiC,GAAG,6BAA6B,CAC3E,OAAO,cAAc,EACrB,OAAO,GAAG,cAAc,EACxB,MAAM,GAAG,aAAa,EACtB,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,cAAc,CAClE,OAAO,cAAc,EACrB,6BAA6B,EAC7B,iCAAiC,CAClC;;gBAsBa,EACV,SAAS,EACT,KAAK,EACL,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,iCAAiC,CAAC;QAC7C,KAAK,CAAC,EAAE,6BAA6B,CAAC;QACtC;;;WAGG;QACH,WAAW,EAAE,eAAe,CAAC;KAC9B;IAiDY,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC,cAAc,IAAI,IAAI;IAShB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAW9C;;;;;OAKG;IACU,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAWlD,UAAU,IAAI,OAAO;CAqJ7B"}
|
|
@@ -13,7 +13,7 @@ export declare const getMockAuthLoginResponse: () => {
|
|
|
13
13
|
requestMethod: "POST";
|
|
14
14
|
response: LoginResponse;
|
|
15
15
|
};
|
|
16
|
-
export declare const MOCK_ACCESS_TOKEN
|
|
16
|
+
export declare const MOCK_ACCESS_TOKEN = "MOCK_ACCESS_TOKEN-eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
|
|
17
17
|
export declare const MOCK_OATH_TOKEN_RESPONSE: OAuthTokenResponse;
|
|
18
18
|
export declare const getMockAuthAccessTokenResponse: () => {
|
|
19
19
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/authentication/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAarB,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,eAAO,MAAM,mBAAmB,EAAE,aAEjC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,QAAQ,gKAC0I,CAAC;AAChK,eAAO,MAAM,mBAAmB,EAAE,aAUjC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/authentication/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAarB,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,eAAO,MAAM,mBAAmB,EAAE,aAEjC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,QAAQ,gKAC0I,CAAC;AAChK,eAAO,MAAM,mBAAmB,EAAE,aAUjC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,kLAAkC,CAAC;AACjE,eAAO,MAAM,wBAAwB,EAAE,kBAKtC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;CAM1C,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Controller from './AuthenticationController';
|
|
2
|
+
declare const AuthenticationController: typeof Controller;
|
|
2
3
|
export { Controller };
|
|
4
|
+
export default AuthenticationController;
|
|
3
5
|
export * from './AuthenticationController';
|
|
4
6
|
export * as Mocks from './__fixtures__';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,4BAA4B,CAAC;AAEpD,QAAA,MAAM,wBAAwB,mBAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,wBAAwB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AccountsControllerListAccountsAction, AccountsControllerUpdateAccountMetadataAction, AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';
|
|
2
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from '@metamask/base-controller';
|
|
2
3
|
import { BaseController } from '@metamask/base-controller';
|
|
3
|
-
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent } from '@metamask/keyring-controller';
|
|
4
|
+
import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerAddNewAccountAction } from '@metamask/keyring-controller';
|
|
4
5
|
import type { HandleSnapRequest } from '@metamask/snaps-controllers';
|
|
5
6
|
import type { AuthenticationControllerGetBearerToken, AuthenticationControllerGetSessionProfile, AuthenticationControllerIsSignedIn, AuthenticationControllerPerformSignIn, AuthenticationControllerPerformSignOut } from '../authentication/AuthenticationController';
|
|
6
|
-
import type {
|
|
7
|
+
import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly } from './schema';
|
|
7
8
|
export declare type NotificationServicesControllerDisableNotificationServices = {
|
|
8
9
|
type: `NotificationServicesController:disableNotificationServices`;
|
|
9
10
|
handler: () => Promise<void>;
|
|
@@ -12,6 +13,7 @@ export declare type NotificationServicesControllerSelectIsNotificationServicesEn
|
|
|
12
13
|
type: `NotificationServicesController:selectIsNotificationServicesEnabled`;
|
|
13
14
|
handler: () => boolean;
|
|
14
15
|
};
|
|
16
|
+
export declare type NativeScrypt = (passwd: string, salt: Uint8Array, N: number, r: number, p: number, size: number) => Promise<Uint8Array>;
|
|
15
17
|
declare const controllerName = "UserStorageController";
|
|
16
18
|
export type UserStorageControllerState = {
|
|
17
19
|
/**
|
|
@@ -30,16 +32,31 @@ type CreateActionsObj<Controller extends keyof UserStorageController> = {
|
|
|
30
32
|
handler: UserStorageController[K];
|
|
31
33
|
};
|
|
32
34
|
};
|
|
33
|
-
type ActionsObj = CreateActionsObj<'performGetStorage' | 'performSetStorage' | 'getStorageKey' | 'enableProfileSyncing' | 'disableProfileSyncing'>;
|
|
34
|
-
export type
|
|
35
|
+
type ActionsObj = CreateActionsObj<'performGetStorage' | 'performGetStorageAllFeatureEntries' | 'performSetStorage' | 'getStorageKey' | 'enableProfileSyncing' | 'disableProfileSyncing' | 'syncInternalAccountsWithUserStorage' | 'saveInternalAccountToUserStorage'>;
|
|
36
|
+
export type UserStorageControllerGetStateAction = ControllerGetStateAction<typeof controllerName, UserStorageControllerState>;
|
|
37
|
+
export type Actions = ActionsObj[keyof ActionsObj] | UserStorageControllerGetStateAction;
|
|
35
38
|
export type UserStorageControllerPerformGetStorage = ActionsObj['performGetStorage'];
|
|
39
|
+
export type UserStorageControllerPerformGetStorageAllFeatureEntries = ActionsObj['performGetStorageAllFeatureEntries'];
|
|
36
40
|
export type UserStorageControllerPerformSetStorage = ActionsObj['performSetStorage'];
|
|
37
41
|
export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
|
|
38
42
|
export type UserStorageControllerEnableProfileSyncing = ActionsObj['enableProfileSyncing'];
|
|
39
43
|
export type UserStorageControllerDisableProfileSyncing = ActionsObj['disableProfileSyncing'];
|
|
40
|
-
export type
|
|
41
|
-
export type
|
|
42
|
-
export type
|
|
44
|
+
export type UserStorageControllerSyncInternalAccountsWithUserStorage = ActionsObj['syncInternalAccountsWithUserStorage'];
|
|
45
|
+
export type UserStorageControllerSaveInternalAccountToUserStorage = ActionsObj['saveInternalAccountToUserStorage'];
|
|
46
|
+
export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
|
|
47
|
+
export type Events = UserStorageControllerStateChangeEvent;
|
|
48
|
+
export type AllowedActions = KeyringControllerGetStateAction | HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AuthenticationControllerPerformSignOut | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled | AccountsControllerListAccountsAction | AccountsControllerGetAccountByAddressAction | AccountsControllerUpdateAccountMetadataAction | KeyringControllerAddNewAccountAction;
|
|
49
|
+
export type UserStorageControllerChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
|
|
50
|
+
export type UserStorageControllerAccountSyncingInProgress = {
|
|
51
|
+
type: `${typeof controllerName}:accountSyncingInProgress`;
|
|
52
|
+
payload: [boolean];
|
|
53
|
+
};
|
|
54
|
+
export type UserStorageControllerAccountSyncingComplete = {
|
|
55
|
+
type: `${typeof controllerName}:accountSyncingComplete`;
|
|
56
|
+
payload: [boolean];
|
|
57
|
+
};
|
|
58
|
+
export type AllowedEvents = UserStorageControllerChangeEvent | UserStorageControllerAccountSyncingInProgress | UserStorageControllerAccountSyncingComplete | KeyringControllerLockEvent | KeyringControllerUnlockEvent;
|
|
59
|
+
export type UserStorageControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
|
|
43
60
|
/**
|
|
44
61
|
* Reusable controller that allows any team to store synchronized data for a given user.
|
|
45
62
|
* These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.
|
|
@@ -51,10 +68,15 @@ export type UserStorageControllerMessenger = RestrictedControllerMessenger<typeo
|
|
|
51
68
|
export default class UserStorageController extends BaseController<typeof controllerName, UserStorageControllerState, UserStorageControllerMessenger> {
|
|
52
69
|
#private;
|
|
53
70
|
getMetaMetricsState: () => boolean;
|
|
54
|
-
constructor(
|
|
71
|
+
constructor({ messenger, state, env, getMetaMetricsState, nativeScryptCrypto, }: {
|
|
55
72
|
messenger: UserStorageControllerMessenger;
|
|
56
73
|
state?: UserStorageControllerState;
|
|
74
|
+
env?: {
|
|
75
|
+
isAccountSyncingEnabled?: boolean;
|
|
76
|
+
accountSyncingMaxSyncInterval?: number;
|
|
77
|
+
};
|
|
57
78
|
getMetaMetricsState: () => boolean;
|
|
79
|
+
nativeScryptCrypto?: NativeScrypt;
|
|
58
80
|
});
|
|
59
81
|
enableProfileSyncing(): Promise<void>;
|
|
60
82
|
setIsProfileSyncingEnabled(isProfileSyncingEnabled: boolean): Promise<void>;
|
|
@@ -66,7 +88,15 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
66
88
|
* @param path - string in the form of `${feature}.${key}` that matches schema
|
|
67
89
|
* @returns the decrypted string contents found from user storage (or null if not found)
|
|
68
90
|
*/
|
|
69
|
-
performGetStorage(path:
|
|
91
|
+
performGetStorage(path: UserStoragePathWithFeatureAndKey): Promise<string | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
|
|
94
|
+
* Developers can extend the entry path through the `schema.ts` file.
|
|
95
|
+
*
|
|
96
|
+
* @param path - string in the form of `${feature}` that matches schema
|
|
97
|
+
* @returns the array of decrypted string contents found from user storage (or null if not found)
|
|
98
|
+
*/
|
|
99
|
+
performGetStorageAllFeatureEntries(path: UserStoragePathWithFeatureOnly): Promise<string[] | null>;
|
|
70
100
|
/**
|
|
71
101
|
* Allows storage of user data. Data stored must be string formatted.
|
|
72
102
|
* Developers can extend the entry path and entry name through the `schema.ts` file.
|
|
@@ -75,13 +105,24 @@ export default class UserStorageController extends BaseController<typeof control
|
|
|
75
105
|
* @param value - The string data you want to store.
|
|
76
106
|
* @returns nothing. NOTE that an error is thrown if fails to store data.
|
|
77
107
|
*/
|
|
78
|
-
performSetStorage(path:
|
|
108
|
+
performSetStorage(path: UserStoragePathWithFeatureAndKey, value: string): Promise<void>;
|
|
79
109
|
/**
|
|
80
110
|
* Retrieves the storage key, for internal use only!
|
|
81
111
|
*
|
|
82
112
|
* @returns the storage key
|
|
83
113
|
*/
|
|
84
114
|
getStorageKey(): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Syncs the internal accounts list with the user storage accounts list.
|
|
117
|
+
* This method is used to make sure that the internal accounts list is up-to-date with the user storage accounts list and vice-versa.
|
|
118
|
+
* 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.
|
|
119
|
+
*/
|
|
120
|
+
syncInternalAccountsWithUserStorage(): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Saves an individual internal account to the user storage.
|
|
123
|
+
* @param address - The address of the internal account to save
|
|
124
|
+
*/
|
|
125
|
+
saveInternalAccountToUserStorage(address: string): Promise<void>;
|
|
85
126
|
}
|
|
86
127
|
export {};
|
|
87
128
|
//# sourceMappingURL=UserStorageController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserStorageController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"UserStorageController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,6CAA6C,EAC7C,2CAA2C,EAC5C,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,oCAAoC,EACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EACzC,kCAAkC,EAClC,qCAAqC,EACrC,sCAAsC,EACvC,MAAM,4CAA4C,CAAC;AAOpD,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,MAAM,UAAU,CAAC;AAQlB,MAAM,CAAC,OAAO,MAAM,yDAAyD,GAC3E;IACE,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEJ,MAAM,CAAC,OAAO,MAAM,iEAAiE,GACnF;IACE,IAAI,EAAE,oEAAoE,CAAC;IAC3E,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB,CAAC;AAEJ,MAAM,CAAC,OAAO,MAAM,YAAY,GAAG,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,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
* @returns A random default account name
|
|
4
|
+
*/
|
|
5
|
+
export declare const getMockRandomDefaultAccountName: () => "Account" | "መለያ" | "الحساب" | "Профил" | "অ্যাকাউন্ট" | "Compte" | "Účet" | "Konto" | "Λογαριασμός" | "Cuenta" | "حساب" | "Tili" | "એકાઉન્ટ" | "חשבון" | "अकाउंट" | "खाता" | "Račun" | "Kont" | "Fiók" | "Akun" | "アカウント" | "ಖಾತೆ" | "계정" | "Paskyra" | "Konts" | "അക്കൗണ്ട്" | "खाते" | "Akaun" | "Conta" | "Cont" | "Счет" | "налог" | "Akaunti" | "கணக்கு" | "ఖాతా" | "บัญชี" | "Hesap" | "Обліковий запис" | "Tài khoản" | "账户" | "帳戶";
|
|
6
|
+
export declare const MOCK_INTERNAL_ACCOUNTS: {
|
|
7
|
+
EMPTY: never[];
|
|
8
|
+
ONE: {
|
|
9
|
+
address: string;
|
|
10
|
+
id: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
name: string;
|
|
13
|
+
nameLastUpdatedAt: number;
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
ONE_DEFAULT_NAME: {
|
|
17
|
+
address: string;
|
|
18
|
+
id: string;
|
|
19
|
+
metadata: {
|
|
20
|
+
name: string;
|
|
21
|
+
nameLastUpdatedAt: number;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: {
|
|
25
|
+
address: string;
|
|
26
|
+
id: string;
|
|
27
|
+
metadata: {
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
ONE_CUSTOM_NAME_WITH_LAST_UPDATED: {
|
|
32
|
+
address: string;
|
|
33
|
+
id: string;
|
|
34
|
+
metadata: {
|
|
35
|
+
name: string;
|
|
36
|
+
nameLastUpdatedAt: number;
|
|
37
|
+
};
|
|
38
|
+
}[];
|
|
39
|
+
ONE_CUSTOM_NAME_WITH_LAST_UPDATED_MOST_RECENT: {
|
|
40
|
+
address: string;
|
|
41
|
+
id: string;
|
|
42
|
+
metadata: {
|
|
43
|
+
name: string;
|
|
44
|
+
nameLastUpdatedAt: number;
|
|
45
|
+
};
|
|
46
|
+
}[];
|
|
47
|
+
ALL: {
|
|
48
|
+
address: string;
|
|
49
|
+
id: string;
|
|
50
|
+
metadata: {
|
|
51
|
+
name: string;
|
|
52
|
+
nameLastUpdatedAt: number;
|
|
53
|
+
};
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
export declare const MOCK_USER_STORAGE_ACCOUNTS: {
|
|
57
|
+
SAME_AS_INTERNAL_ALL: import("../accounts/user-storage").UserStorageAccount[];
|
|
58
|
+
ONE: import("../accounts/user-storage").UserStorageAccount[];
|
|
59
|
+
ONE_DEFAULT_NAME: import("../accounts/user-storage").UserStorageAccount[];
|
|
60
|
+
ONE_CUSTOM_NAME_WITHOUT_LAST_UPDATED: import("../accounts/user-storage").UserStorageAccount[];
|
|
61
|
+
ONE_CUSTOM_NAME_WITH_LAST_UPDATED: import("../accounts/user-storage").UserStorageAccount[];
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=mockAccounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockAccounts.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockAccounts.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,+BAA+B,mbAGzC,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFlC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;CA6BtC,CAAC"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly } from '../schema';
|
|
2
|
+
import type { GetUserStorageAllFeatureEntriesResponse, GetUserStorageResponse } from '../services';
|
|
3
|
+
export declare const getMockUserStorageEndpoint: (path: UserStoragePathWithFeatureAndKey | UserStoragePathWithFeatureOnly) => string;
|
|
4
|
+
export declare const getMockUserStorageGetResponse: (path?: UserStoragePathWithFeatureAndKey) => Promise<{
|
|
4
5
|
url: string;
|
|
5
6
|
requestMethod: "GET";
|
|
6
7
|
response: GetUserStorageResponse;
|
|
7
|
-
}
|
|
8
|
-
export declare const
|
|
8
|
+
}>;
|
|
9
|
+
export declare const getMockUserStorageAllFeatureEntriesResponse: (path?: UserStoragePathWithFeatureOnly) => Promise<{
|
|
10
|
+
url: string;
|
|
11
|
+
requestMethod: "GET";
|
|
12
|
+
response: GetUserStorageAllFeatureEntriesResponse;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const getMockUserStoragePutResponse: (path?: UserStoragePathWithFeatureAndKey) => {
|
|
9
15
|
url: string;
|
|
10
16
|
requestMethod: "PUT";
|
|
11
17
|
response: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAUrB,eAAO,MAAM,0BAA0B,SAC/B,gCAAgC,GAAG,8BAA8B,WAUxE,CAAC;AAgBF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;EAOvC,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAChD,8BAA8B;;;;EAOrC,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC;;;;CAOvC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import nock from 'nock';
|
|
2
|
+
import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly } from '../schema';
|
|
2
3
|
type MockReply = {
|
|
3
4
|
status: nock.StatusCode;
|
|
4
5
|
body?: nock.Body;
|
|
5
6
|
};
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const mockEndpointGetUserStorageAllFeatureEntries: (path?: UserStoragePathWithFeatureOnly, mockReply?: MockReply) => Promise<nock.Scope>;
|
|
8
|
+
export declare const mockEndpointGetUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: MockReply) => Promise<nock.Scope>;
|
|
9
|
+
export declare const mockEndpointUpsertUserStorage: (path?: UserStoragePathWithFeatureAndKey, mockReply?: Pick<MockReply, 'status'>) => nock.Scope;
|
|
8
10
|
export {};
|
|
9
11
|
//# sourceMappingURL=mockServices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockServices.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"mockServices.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,MAAM,WAAW,CAAC;AAOnB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,2CAA2C,UAChD,8BAA8B,cACxB,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAC/B,gCAAgC,cAC1B,SAAS,wBAatB,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAClC,gCAAgC,cAC1B,KAAK,SAAS,EAAE,QAAQ,CAAC,eAOtC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MOCK_STORAGE_KEY_SIGNATURE = "mockStorageKey";
|
|
2
2
|
export declare const MOCK_STORAGE_KEY: string;
|
|
3
3
|
export declare const MOCK_STORAGE_DATA: string;
|
|
4
|
-
export declare const MOCK_ENCRYPTED_STORAGE_DATA: () => string
|
|
4
|
+
export declare const MOCK_ENCRYPTED_STORAGE_DATA: () => Promise<string>;
|
|
5
5
|
//# sourceMappingURL=mockStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockStorage.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"mockStorage.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AAKpE,eAAO,MAAM,2BAA2B,uBAIpC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const USER_STORAGE_VERSION = "1";
|
|
2
|
+
export declare const USER_STORAGE_VERSION_KEY: unique symbol;
|
|
3
|
+
export declare const LOCALIZED_DEFAULT_ACCOUNT_NAMES: readonly ["Account", "መለያ", "الحساب", "Профил", "অ্যাকাউন্ট", "Compte", "Účet", "Konto", "Λογαριασμός", "Cuenta", "حساب", "Tili", "એકાઉન્ટ", "חשבון", "अकाउंट", "खाता", "Račun", "Kont", "Fiók", "Akun", "アカウント", "ಖಾತೆ", "계정", "Paskyra", "Konts", "അക്കൗണ്ട്", "खाते", "Akaun", "Conta", "Cont", "Счет", "налог", "Akaunti", "கணக்கு", "ఖాతా", "บัญชี", "Hesap", "Обліковий запис", "Tài khoản", "账户", "帳戶"];
|
|
4
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/accounts/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAGxC,eAAO,MAAM,wBAAwB,EAAE,OAAO,MAAqB,CAAC;AAGpE,eAAO,MAAM,+BAA+B,gZA0ClC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { InternalAccount } from '@metamask/keyring-api';
|
|
2
|
+
import { USER_STORAGE_VERSION_KEY, USER_STORAGE_VERSION } from './constants';
|
|
3
|
+
export type UserStorageAccount = {
|
|
4
|
+
/**
|
|
5
|
+
* The Version 'v' of the User Storage.
|
|
6
|
+
* NOTE - will allow us to support upgrade/downgrades in the future
|
|
7
|
+
*/
|
|
8
|
+
[USER_STORAGE_VERSION_KEY]: typeof USER_STORAGE_VERSION;
|
|
9
|
+
/** the id 'i' of the account */
|
|
10
|
+
i: string;
|
|
11
|
+
/** the address 'a' of the account */
|
|
12
|
+
a: string;
|
|
13
|
+
/** the name 'n' of the account */
|
|
14
|
+
n: string;
|
|
15
|
+
/** the nameLastUpdatedAt timestamp 'nlu' of the account */
|
|
16
|
+
nlu?: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Tells if the given name is a default account name.
|
|
20
|
+
* Default account names are localized names that are automatically generated by the clients.
|
|
21
|
+
*
|
|
22
|
+
* @param name - the name to check
|
|
23
|
+
* @returns true if the name is a default account name, false otherwise
|
|
24
|
+
*/
|
|
25
|
+
export declare const isNameDefaultAccountName: (name: string) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Map an internal account to a user storage account
|
|
28
|
+
* @param internalAccount - An internal account
|
|
29
|
+
* @returns A user storage account
|
|
30
|
+
*/
|
|
31
|
+
export declare const mapInternalAccountToUserStorageAccount: (internalAccount: InternalAccount) => UserStorageAccount;
|
|
32
|
+
//# sourceMappingURL=user-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-storage.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/accounts/user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EAErB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,CAAC,wBAAwB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACxD,gCAAgC;IAChC,CAAC,EAAE,MAAM,CAAC;IACV,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAC;IACV,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;GAMG;AAEH,eAAO,MAAM,wBAAwB,SAAU,MAAM,YAIpD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,oBAChC,eAAe,KAC/B,kBASF,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NativeScrypt } from '../UserStorageController';
|
|
1
2
|
export type EncryptedPayload = {
|
|
2
3
|
v: '1';
|
|
3
4
|
t: 'scrypt';
|
|
@@ -12,8 +13,8 @@ export type EncryptedPayload = {
|
|
|
12
13
|
};
|
|
13
14
|
declare class EncryptorDecryptor {
|
|
14
15
|
#private;
|
|
15
|
-
encryptString(plaintext: string, password: string): string
|
|
16
|
-
decryptString(encryptedDataStr: string, password: string): string
|
|
16
|
+
encryptString(plaintext: string, password: string, nativeScryptCrypto?: NativeScrypt): Promise<string>;
|
|
17
|
+
decryptString(encryptedDataStr: string, password: string, nativeScryptCrypto?: NativeScrypt): Promise<string>;
|
|
17
18
|
}
|
|
18
19
|
declare const encryption: EncryptorDecryptor;
|
|
19
20
|
export default encryption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/encryption/encryption.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/encryption/encryption.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI7D,MAAM,MAAM,gBAAgB,GAAG;IAE7B,CAAC,EAAE,GAAG,CAAC;IAGP,CAAC,EAAE,QAAQ,CAAC;IAGZ,CAAC,EAAE,MAAM,CAAC;IAGV,CAAC,EAAE;QAED,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAeF,cAAM,kBAAkB;;IAChB,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,YAAY,GAChC,OAAO,CAAC,MAAM,CAAC;IAaZ,aAAa,CACjB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,YAAY,GAChC,OAAO,CAAC,MAAM,CAAC;CAuKnB;AAED,QAAA,MAAM,UAAU,oBAA2B,CAAC;AAC5C,eAAe,UAAU,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Controller from './UserStorageController';
|
|
2
|
+
declare const UserStorageController: typeof Controller;
|
|
2
3
|
export { Controller };
|
|
4
|
+
export default UserStorageController;
|
|
3
5
|
export * from './UserStorageController';
|
|
4
6
|
export * from './encryption';
|
|
5
7
|
export * as Mocks from './__fixtures__';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAEjD,QAAA,MAAM,qBAAqB,mBAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,eAAe,qBAAqB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The User Storage Endpoint requires a feature name and a namespace key.
|
|
3
3
|
* Developers can provide additional features and keys by extending these types below.
|
|
4
|
+
*
|
|
5
|
+
* Adding ALLOW_ARBITRARY_KEYS as the first key in the array allows for any key to be used for this feature.
|
|
6
|
+
* This can be useful for features where keys are not deterministic (eg. accounts addresses).
|
|
4
7
|
*/
|
|
8
|
+
declare const ALLOW_ARBITRARY_KEYS: "ALLOW_ARBITRARY_KEYS";
|
|
5
9
|
export declare const USER_STORAGE_SCHEMA: {
|
|
6
10
|
readonly notifications: readonly ["notificationSettings"];
|
|
11
|
+
readonly accounts: readonly ["ALLOW_ARBITRARY_KEYS"];
|
|
7
12
|
};
|
|
8
13
|
type UserStorageSchema = typeof USER_STORAGE_SCHEMA;
|
|
9
14
|
type UserStorageFeatures = keyof UserStorageSchema;
|
|
10
|
-
type UserStorageFeatureKeys<Feature extends UserStorageFeatures> = UserStorageSchema[Feature][number];
|
|
15
|
+
type UserStorageFeatureKeys<Feature extends UserStorageFeatures> = UserStorageSchema[Feature][0] extends typeof ALLOW_ARBITRARY_KEYS ? string : UserStorageSchema[Feature][number];
|
|
11
16
|
type UserStorageFeatureAndKey = {
|
|
12
17
|
feature: UserStorageFeatures;
|
|
13
18
|
key: UserStorageFeatureKeys<UserStorageFeatures>;
|
|
14
19
|
};
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
export type UserStoragePathWithFeatureOnly = keyof UserStorageSchema;
|
|
21
|
+
export type UserStoragePathWithFeatureAndKey = {
|
|
22
|
+
[K in UserStorageFeatures]: `${K}.${UserStorageFeatureKeys<K>}`;
|
|
23
|
+
}[UserStoragePathWithFeatureOnly];
|
|
24
|
+
export declare const getFeatureAndKeyFromPath: (path: UserStoragePathWithFeatureAndKey) => UserStorageFeatureAndKey;
|
|
25
|
+
export declare const isPathWithFeatureAndKey: (path: string) => path is UserStoragePathWithFeatureAndKey;
|
|
19
26
|
/**
|
|
20
27
|
* Constructs a unique entry path for a user.
|
|
21
28
|
* This can be done due to the uniqueness of the storage key (no users will share the same storage key).
|
|
@@ -25,6 +32,6 @@ export declare const getFeatureAndKeyFromPath: (path: UserStoragePath) => UserSt
|
|
|
25
32
|
* @param storageKey - users storage key
|
|
26
33
|
* @returns path to store entry
|
|
27
34
|
*/
|
|
28
|
-
export declare function createEntryPath(path:
|
|
35
|
+
export declare function createEntryPath(path: UserStoragePathWithFeatureAndKey, storageKey: string): string;
|
|
29
36
|
export {};
|
|
30
37
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/schema.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/schema.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,wBAAkC,CAAC;AAE7D,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,KAAK,iBAAiB,GAAG,OAAO,mBAAmB,CAAC;AAEpD,KAAK,mBAAmB,GAAG,MAAM,iBAAiB,CAAC;AACnD,KAAK,sBAAsB,CAAC,OAAO,SAAS,mBAAmB,IAC7D,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,oBAAoB,GAC7D,MAAM,GACN,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzC,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,GAAG,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,MAAM,iBAAiB,CAAC;AACrE,MAAM,MAAM,gCAAgC,GAAG;KAC5C,CAAC,IAAI,mBAAmB,GAAG,GAAG,CAAC,IAAI,sBAAsB,CAAC,CAAC,CAAC,EAAE;CAChE,CAAC,8BAA8B,CAAC,CAAC;AAElC,eAAO,MAAM,wBAAwB,SAC7B,gCAAgC,KACrC,wBAgCF,CAAC;AAEF,eAAO,MAAM,uBAAuB,SAC5B,MAAM,6CAKb,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gCAAgC,EACtC,UAAU,EAAE,MAAM,GACjB,MAAM,CAKR"}
|
|
@@ -1,18 +1,30 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UserStoragePathWithFeatureAndKey, UserStoragePathWithFeatureOnly } from './schema';
|
|
2
|
+
import type { NativeScrypt } from './UserStorageController';
|
|
2
3
|
export declare const USER_STORAGE_API: string;
|
|
3
4
|
export declare const USER_STORAGE_ENDPOINT: string;
|
|
4
5
|
/**
|
|
5
|
-
* This is the Server Response shape
|
|
6
|
+
* This is the Server Response shape for a feature entry.
|
|
6
7
|
*/
|
|
7
8
|
export type GetUserStorageResponse = {
|
|
8
9
|
HashedKey: string;
|
|
9
10
|
Data: string;
|
|
10
11
|
};
|
|
11
|
-
export type
|
|
12
|
-
|
|
12
|
+
export type GetUserStorageAllFeatureEntriesResponse = {
|
|
13
|
+
HashedKey: string;
|
|
14
|
+
Data: string;
|
|
15
|
+
}[];
|
|
16
|
+
export type UserStorageBaseOptions = {
|
|
13
17
|
bearerToken: string;
|
|
14
18
|
storageKey: string;
|
|
15
19
|
};
|
|
20
|
+
export type UserStorageOptions = UserStorageBaseOptions & {
|
|
21
|
+
path: UserStoragePathWithFeatureAndKey;
|
|
22
|
+
nativeScryptCrypto?: NativeScrypt;
|
|
23
|
+
};
|
|
24
|
+
export type UserStorageAllFeatureEntriesOptions = UserStorageBaseOptions & {
|
|
25
|
+
path: UserStoragePathWithFeatureOnly;
|
|
26
|
+
nativeScryptCrypto?: NativeScrypt;
|
|
27
|
+
};
|
|
16
28
|
/**
|
|
17
29
|
* User Storage Service - Get Storage Entry.
|
|
18
30
|
*
|
|
@@ -20,6 +32,13 @@ export type UserStorageOptions = {
|
|
|
20
32
|
* @returns The storage entry, or null if fails to find entry
|
|
21
33
|
*/
|
|
22
34
|
export declare function getUserStorage(opts: UserStorageOptions): Promise<string | null>;
|
|
35
|
+
/**
|
|
36
|
+
* User Storage Service - Get all storage entries for a specific feature.
|
|
37
|
+
*
|
|
38
|
+
* @param opts - User Storage Options
|
|
39
|
+
* @returns The storage entry, or null if fails to find entry
|
|
40
|
+
*/
|
|
41
|
+
export declare function getUserStorageAllFeatureEntries(opts: UserStorageAllFeatureEntriesOptions): Promise<string[] | null>;
|
|
23
42
|
/**
|
|
24
43
|
* User Storage Service - Set Storage Entry.
|
|
25
44
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gCAAgC,EAChC,8BAA8B,EAC/B,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D,eAAO,MAAM,gBAAgB,EAAE,MAAmC,CAAC;AACnE,eAAO,MAAM,qBAAqB,QAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IAEnC,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IAEpD,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,EAAE,MAAM,CAAC;CACd,EAAE,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG;IACxD,IAAI,EAAE,gCAAgC,CAAC;IACvC,kBAAkB,CAAC,EAAE,YAAY,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,sBAAsB,GAAG;IACzE,IAAI,EAAE,8BAA8B,CAAC;IACrC,kBAAkB,CAAC,EAAE,YAAY,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0CxB;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,mCAAmC,GACxC,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CA+C1B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,IAAI,CAAC,CAuBf"}
|
|
@@ -7,12 +7,13 @@ export declare const MOCK_STORAGE_KEY = "MOCK_STORAGE_KEY";
|
|
|
7
7
|
export declare const MOCK_NOTIFICATIONS_DATA: {
|
|
8
8
|
is_compact: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare const MOCK_NOTIFICATIONS_DATA_ENCRYPTED: string
|
|
11
|
-
export declare const MOCK_STORAGE_RESPONSE: {
|
|
10
|
+
export declare const MOCK_NOTIFICATIONS_DATA_ENCRYPTED: () => Promise<string>;
|
|
11
|
+
export declare const MOCK_STORAGE_RESPONSE: () => Promise<{
|
|
12
12
|
HashedKey: string;
|
|
13
13
|
Data: string;
|
|
14
|
-
}
|
|
15
|
-
export declare const handleMockUserStorageGet: (mockReply?: MockReply) => nock.Scope
|
|
14
|
+
}>;
|
|
15
|
+
export declare const handleMockUserStorageGet: (mockReply?: MockReply) => Promise<nock.Scope>;
|
|
16
|
+
export declare const handleMockUserStorageGetAllFeatureEntries: (mockReply?: MockReply) => Promise<nock.Scope>;
|
|
16
17
|
export declare const handleMockUserStoragePut: (mockReply?: MockReply) => nock.Scope;
|
|
17
18
|
export {};
|
|
18
19
|
//# sourceMappingURL=mock-userstorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-userstorage.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/mock-userstorage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"mock-userstorage.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/mock-userstorage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAYF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAGnD,eAAO,MAAM,uBAAuB;;CAAwB,CAAC;AAC7D,eAAO,MAAM,iCAAiC,uBAI3C,CAAC;AAEJ,eAAO,MAAM,qBAAqB;;;EAGhC,CAAC;AAEH,eAAO,MAAM,wBAAwB,eAAsB,SAAS,wBAWnE,CAAC;AAEF,eAAO,MAAM,yCAAyC,eACxC,SAAS,wBAYtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,SAAS,eAQ7D,CAAC"}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
iterations: number;
|
|
5
|
-
};
|
|
6
|
-
declare class EncryptorDecryptor {
|
|
7
|
-
#private;
|
|
8
|
-
encryptString(plaintext: string, password: string): string;
|
|
9
|
-
decryptString(encryptedDataStr: string, password: string): string;
|
|
10
|
-
}
|
|
11
|
-
export declare const Encryption: EncryptorDecryptor;
|
|
12
|
-
export default Encryption;
|
|
13
|
-
/**
|
|
14
|
-
* Create a SHA-256 hash from a given string.
|
|
15
|
-
*
|
|
16
|
-
* @param data - input
|
|
17
|
-
* @returns hash
|
|
18
|
-
*/
|
|
19
|
-
export declare function createSHA256Hash(data: string): string;
|
|
1
|
+
import encryption from '../controllers/user-storage/encryption/encryption';
|
|
2
|
+
export * from '../controllers/user-storage/encryption/encryption';
|
|
3
|
+
export default encryption;
|
|
20
4
|
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/sdk/encryption.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,mDAAmD,CAAC;AAE3E,cAAc,mDAAmD,CAAC;AAClE,eAAe,UAAU,CAAC"}
|