@metamask-previews/authenticated-user-storage 3.0.2-preview-3866c0ff1 → 3.0.2-preview-e3275932a
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 +0 -1
- package/dist/authenticated-user-storage-method-action-types.cjs +7 -0
- package/dist/authenticated-user-storage-method-action-types.cjs.map +1 -0
- package/dist/{authenticated-user-storage-method-action-types.d.ts → authenticated-user-storage-method-action-types.d.cts} +2 -2
- package/dist/authenticated-user-storage-method-action-types.d.cts.map +1 -0
- package/dist/authenticated-user-storage-method-action-types.d.mts +83 -0
- package/dist/authenticated-user-storage-method-action-types.d.mts.map +1 -0
- package/dist/{authenticated-user-storage-method-action-types.js → authenticated-user-storage-method-action-types.mjs} +1 -1
- package/dist/authenticated-user-storage-method-action-types.mjs.map +1 -0
- package/dist/authenticated-user-storage.cjs +282 -0
- package/dist/authenticated-user-storage.cjs.map +1 -0
- package/dist/{authenticated-user-storage.d.ts → authenticated-user-storage.d.cts} +8 -8
- package/dist/authenticated-user-storage.d.cts.map +1 -0
- package/dist/authenticated-user-storage.d.mts +142 -0
- package/dist/authenticated-user-storage.d.mts.map +1 -0
- package/dist/{authenticated-user-storage.js → authenticated-user-storage.mjs} +45 -32
- package/dist/authenticated-user-storage.mjs.map +1 -0
- package/dist/env.cjs +24 -0
- package/dist/env.cjs.map +1 -0
- package/dist/{env.d.ts → env.d.cts} +1 -1
- package/dist/env.d.cts.map +1 -0
- package/dist/env.d.mts +10 -0
- package/dist/env.d.mts.map +1 -0
- package/dist/{env.js → env.mjs} +1 -1
- package/dist/env.mjs.map +1 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +8 -8
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +3 -3
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +107 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/validators.cjs +173 -0
- package/dist/validators.cjs.map +1 -0
- package/dist/{validators.d.ts → validators.d.cts} +3 -3
- package/dist/validators.d.cts.map +1 -0
- package/dist/validators.d.mts +84 -0
- package/dist/validators.d.mts.map +1 -0
- package/dist/{validators.js → validators.mjs} +2 -2
- package/dist/validators.mjs.map +1 -0
- package/package.json +18 -14
- package/dist/authenticated-user-storage-method-action-types.d.ts.map +0 -1
- package/dist/authenticated-user-storage-method-action-types.js.map +0 -1
- package/dist/authenticated-user-storage.d.ts.map +0 -1
- package/dist/authenticated-user-storage.js.map +0 -1
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/validators.d.ts.map +0 -1
- package/dist/validators.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
|
|
12
12
|
### Changed
|
|
13
13
|
|
|
14
|
-
- **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
|
|
15
14
|
- Bump `@metamask/superstruct` from `^3.1.0` to `^3.4.1` ([#9754](https://github.com/MetaMask/core/pull/9754))
|
|
16
15
|
- Bump `@metamask/base-data-service` from `^0.1.3` to `^1.0.0` ([#9972](https://github.com/MetaMask/core/pull/9972))
|
|
17
16
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user-storage-method-action-types.cjs","sourceRoot":"","sources":["../src/authenticated-user-storage-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticatedUserStorageService } from './authenticated-user-storage.js';\n\n/**\n * Returns all delegation records belonging to the authenticated user.\n *\n * @returns An array of delegation records, or an empty array if none exist.\n */\nexport type AuthenticatedUserStorageServiceListDelegationsAction = {\n type: `AuthenticatedUserStorageService:listDelegations`;\n handler: AuthenticatedUserStorageService['listDelegations'];\n};\n\n/**\n * Stores a signed delegation record for the authenticated user.\n *\n * @param submission - The signed delegation and its metadata.\n * @param clientType - Optional client type header.\n */\nexport type AuthenticatedUserStorageServiceCreateDelegationAction = {\n type: `AuthenticatedUserStorageService:createDelegation`;\n handler: AuthenticatedUserStorageService['createDelegation'];\n};\n\n/**\n * Revokes (deletes) a delegation record.\n *\n * @param delegationHash - The unique hash identifying the delegation.\n */\nexport type AuthenticatedUserStorageServiceRevokeDelegationAction = {\n type: `AuthenticatedUserStorageService:revokeDelegation`;\n handler: AuthenticatedUserStorageService['revokeDelegation'];\n};\n\n/**\n * Returns the notification preferences for the authenticated user.\n *\n * @returns The notification preferences object, or `null` if none have been\n * set (404).\n */\nexport type AuthenticatedUserStorageServiceGetNotificationPreferencesAction = {\n type: `AuthenticatedUserStorageService:getNotificationPreferences`;\n handler: AuthenticatedUserStorageService['getNotificationPreferences'];\n};\n\n/**\n * Creates or updates the notification preferences for the authenticated user.\n *\n * @param prefs - The full notification preferences object.\n * @param clientType - Optional client type header.\n */\nexport type AuthenticatedUserStorageServicePutNotificationPreferencesAction = {\n type: `AuthenticatedUserStorageService:putNotificationPreferences`;\n handler: AuthenticatedUserStorageService['putNotificationPreferences'];\n};\n\n/**\n * Returns the assets-watchlist for the authenticated user.\n *\n * @returns The assets-watchlist blob, or `null` if none has been set (404).\n */\nexport type AuthenticatedUserStorageServiceGetAssetsWatchlistAction = {\n type: `AuthenticatedUserStorageService:getAssetsWatchlist`;\n handler: AuthenticatedUserStorageService['getAssetsWatchlist'];\n};\n\n/**\n * Creates or updates the assets-watchlist for the authenticated user.\n *\n * @param blob - The full assets-watchlist blob. The `assets` array may\n * contain at most `ASSETS_WATCHLIST_MAX_ASSETS` CAIP-19 asset identifiers;\n * this is enforced by `assertAssetsWatchlistBlobForWrite` before the\n * request is sent.\n * @param clientType - Optional client type header.\n * @throws A `StructError` from `@metamask/superstruct` if `blob` is\n * structurally invalid or `assets` exceeds the cap; an `HttpError` from\n * `@metamask/controller-utils` if the API responds with a non-2xx status.\n */\nexport type AuthenticatedUserStorageServiceSetAssetsWatchlistAction = {\n type: `AuthenticatedUserStorageService:setAssetsWatchlist`;\n handler: AuthenticatedUserStorageService['setAssetsWatchlist'];\n};\n\n/**\n * Union of all AuthenticatedUserStorageService action types.\n */\nexport type AuthenticatedUserStorageServiceMethodActions =\n | AuthenticatedUserStorageServiceListDelegationsAction\n | AuthenticatedUserStorageServiceCreateDelegationAction\n | AuthenticatedUserStorageServiceRevokeDelegationAction\n | AuthenticatedUserStorageServiceGetNotificationPreferencesAction\n | AuthenticatedUserStorageServicePutNotificationPreferencesAction\n | AuthenticatedUserStorageServiceGetAssetsWatchlistAction\n | AuthenticatedUserStorageServiceSetAssetsWatchlistAction;\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { AuthenticatedUserStorageService } from
|
|
5
|
+
import type { AuthenticatedUserStorageService } from "./authenticated-user-storage.cjs";
|
|
6
6
|
/**
|
|
7
7
|
* Returns all delegation records belonging to the authenticated user.
|
|
8
8
|
*
|
|
@@ -80,4 +80,4 @@ export type AuthenticatedUserStorageServiceSetAssetsWatchlistAction = {
|
|
|
80
80
|
* Union of all AuthenticatedUserStorageService action types.
|
|
81
81
|
*/
|
|
82
82
|
export type AuthenticatedUserStorageServiceMethodActions = AuthenticatedUserStorageServiceListDelegationsAction | AuthenticatedUserStorageServiceCreateDelegationAction | AuthenticatedUserStorageServiceRevokeDelegationAction | AuthenticatedUserStorageServiceGetNotificationPreferencesAction | AuthenticatedUserStorageServicePutNotificationPreferencesAction | AuthenticatedUserStorageServiceGetAssetsWatchlistAction | AuthenticatedUserStorageServiceSetAssetsWatchlistAction;
|
|
83
|
-
//# sourceMappingURL=authenticated-user-storage-method-action-types.d.
|
|
83
|
+
//# sourceMappingURL=authenticated-user-storage-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user-storage-method-action-types.d.cts","sourceRoot":"","sources":["../src/authenticated-user-storage-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,+BAA+B,EAAE,yCAAwC;AAEvF;;;;GAIG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,+BAA+B,CAAC,kBAAkB,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,+BAA+B,CAAC,kBAAkB,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,+DAA+D,GAAG;IAC5E,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,+BAA+B,CAAC,4BAA4B,CAAC,CAAC;CACxE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,+DAA+D,GAAG;IAC5E,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,+BAA+B,CAAC,4BAA4B,CAAC,CAAC;CACxE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,+BAA+B,CAAC,oBAAoB,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,+BAA+B,CAAC,oBAAoB,CAAC,CAAC;CAChE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4CAA4C,GACpD,oDAAoD,GACpD,qDAAqD,GACrD,qDAAqD,GACrD,+DAA+D,GAC/D,+DAA+D,GAC/D,uDAAuD,GACvD,uDAAuD,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthenticatedUserStorageService } from "./authenticated-user-storage.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Returns all delegation records belonging to the authenticated user.
|
|
8
|
+
*
|
|
9
|
+
* @returns An array of delegation records, or an empty array if none exist.
|
|
10
|
+
*/
|
|
11
|
+
export type AuthenticatedUserStorageServiceListDelegationsAction = {
|
|
12
|
+
type: `AuthenticatedUserStorageService:listDelegations`;
|
|
13
|
+
handler: AuthenticatedUserStorageService['listDelegations'];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Stores a signed delegation record for the authenticated user.
|
|
17
|
+
*
|
|
18
|
+
* @param submission - The signed delegation and its metadata.
|
|
19
|
+
* @param clientType - Optional client type header.
|
|
20
|
+
*/
|
|
21
|
+
export type AuthenticatedUserStorageServiceCreateDelegationAction = {
|
|
22
|
+
type: `AuthenticatedUserStorageService:createDelegation`;
|
|
23
|
+
handler: AuthenticatedUserStorageService['createDelegation'];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Revokes (deletes) a delegation record.
|
|
27
|
+
*
|
|
28
|
+
* @param delegationHash - The unique hash identifying the delegation.
|
|
29
|
+
*/
|
|
30
|
+
export type AuthenticatedUserStorageServiceRevokeDelegationAction = {
|
|
31
|
+
type: `AuthenticatedUserStorageService:revokeDelegation`;
|
|
32
|
+
handler: AuthenticatedUserStorageService['revokeDelegation'];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Returns the notification preferences for the authenticated user.
|
|
36
|
+
*
|
|
37
|
+
* @returns The notification preferences object, or `null` if none have been
|
|
38
|
+
* set (404).
|
|
39
|
+
*/
|
|
40
|
+
export type AuthenticatedUserStorageServiceGetNotificationPreferencesAction = {
|
|
41
|
+
type: `AuthenticatedUserStorageService:getNotificationPreferences`;
|
|
42
|
+
handler: AuthenticatedUserStorageService['getNotificationPreferences'];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Creates or updates the notification preferences for the authenticated user.
|
|
46
|
+
*
|
|
47
|
+
* @param prefs - The full notification preferences object.
|
|
48
|
+
* @param clientType - Optional client type header.
|
|
49
|
+
*/
|
|
50
|
+
export type AuthenticatedUserStorageServicePutNotificationPreferencesAction = {
|
|
51
|
+
type: `AuthenticatedUserStorageService:putNotificationPreferences`;
|
|
52
|
+
handler: AuthenticatedUserStorageService['putNotificationPreferences'];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Returns the assets-watchlist for the authenticated user.
|
|
56
|
+
*
|
|
57
|
+
* @returns The assets-watchlist blob, or `null` if none has been set (404).
|
|
58
|
+
*/
|
|
59
|
+
export type AuthenticatedUserStorageServiceGetAssetsWatchlistAction = {
|
|
60
|
+
type: `AuthenticatedUserStorageService:getAssetsWatchlist`;
|
|
61
|
+
handler: AuthenticatedUserStorageService['getAssetsWatchlist'];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Creates or updates the assets-watchlist for the authenticated user.
|
|
65
|
+
*
|
|
66
|
+
* @param blob - The full assets-watchlist blob. The `assets` array may
|
|
67
|
+
* contain at most `ASSETS_WATCHLIST_MAX_ASSETS` CAIP-19 asset identifiers;
|
|
68
|
+
* this is enforced by `assertAssetsWatchlistBlobForWrite` before the
|
|
69
|
+
* request is sent.
|
|
70
|
+
* @param clientType - Optional client type header.
|
|
71
|
+
* @throws A `StructError` from `@metamask/superstruct` if `blob` is
|
|
72
|
+
* structurally invalid or `assets` exceeds the cap; an `HttpError` from
|
|
73
|
+
* `@metamask/controller-utils` if the API responds with a non-2xx status.
|
|
74
|
+
*/
|
|
75
|
+
export type AuthenticatedUserStorageServiceSetAssetsWatchlistAction = {
|
|
76
|
+
type: `AuthenticatedUserStorageService:setAssetsWatchlist`;
|
|
77
|
+
handler: AuthenticatedUserStorageService['setAssetsWatchlist'];
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Union of all AuthenticatedUserStorageService action types.
|
|
81
|
+
*/
|
|
82
|
+
export type AuthenticatedUserStorageServiceMethodActions = AuthenticatedUserStorageServiceListDelegationsAction | AuthenticatedUserStorageServiceCreateDelegationAction | AuthenticatedUserStorageServiceRevokeDelegationAction | AuthenticatedUserStorageServiceGetNotificationPreferencesAction | AuthenticatedUserStorageServicePutNotificationPreferencesAction | AuthenticatedUserStorageServiceGetAssetsWatchlistAction | AuthenticatedUserStorageServiceSetAssetsWatchlistAction;
|
|
83
|
+
//# sourceMappingURL=authenticated-user-storage-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user-storage-method-action-types.d.mts","sourceRoot":"","sources":["../src/authenticated-user-storage-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,+BAA+B,EAAE,yCAAwC;AAEvF;;;;GAIG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,+BAA+B,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,+BAA+B,CAAC,kBAAkB,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,+BAA+B,CAAC,kBAAkB,CAAC,CAAC;CAC9D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,+DAA+D,GAAG;IAC5E,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,+BAA+B,CAAC,4BAA4B,CAAC,CAAC;CACxE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,+DAA+D,GAAG;IAC5E,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,+BAA+B,CAAC,4BAA4B,CAAC,CAAC;CACxE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,+BAA+B,CAAC,oBAAoB,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,+BAA+B,CAAC,oBAAoB,CAAC,CAAC;CAChE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4CAA4C,GACpD,oDAAoD,GACpD,qDAAqD,GACrD,qDAAqD,GACrD,+DAA+D,GAC/D,+DAA+D,GAC/D,uDAAuD,GACvD,uDAAuD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user-storage-method-action-types.mjs","sourceRoot":"","sources":["../src/authenticated-user-storage-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticatedUserStorageService } from './authenticated-user-storage.js';\n\n/**\n * Returns all delegation records belonging to the authenticated user.\n *\n * @returns An array of delegation records, or an empty array if none exist.\n */\nexport type AuthenticatedUserStorageServiceListDelegationsAction = {\n type: `AuthenticatedUserStorageService:listDelegations`;\n handler: AuthenticatedUserStorageService['listDelegations'];\n};\n\n/**\n * Stores a signed delegation record for the authenticated user.\n *\n * @param submission - The signed delegation and its metadata.\n * @param clientType - Optional client type header.\n */\nexport type AuthenticatedUserStorageServiceCreateDelegationAction = {\n type: `AuthenticatedUserStorageService:createDelegation`;\n handler: AuthenticatedUserStorageService['createDelegation'];\n};\n\n/**\n * Revokes (deletes) a delegation record.\n *\n * @param delegationHash - The unique hash identifying the delegation.\n */\nexport type AuthenticatedUserStorageServiceRevokeDelegationAction = {\n type: `AuthenticatedUserStorageService:revokeDelegation`;\n handler: AuthenticatedUserStorageService['revokeDelegation'];\n};\n\n/**\n * Returns the notification preferences for the authenticated user.\n *\n * @returns The notification preferences object, or `null` if none have been\n * set (404).\n */\nexport type AuthenticatedUserStorageServiceGetNotificationPreferencesAction = {\n type: `AuthenticatedUserStorageService:getNotificationPreferences`;\n handler: AuthenticatedUserStorageService['getNotificationPreferences'];\n};\n\n/**\n * Creates or updates the notification preferences for the authenticated user.\n *\n * @param prefs - The full notification preferences object.\n * @param clientType - Optional client type header.\n */\nexport type AuthenticatedUserStorageServicePutNotificationPreferencesAction = {\n type: `AuthenticatedUserStorageService:putNotificationPreferences`;\n handler: AuthenticatedUserStorageService['putNotificationPreferences'];\n};\n\n/**\n * Returns the assets-watchlist for the authenticated user.\n *\n * @returns The assets-watchlist blob, or `null` if none has been set (404).\n */\nexport type AuthenticatedUserStorageServiceGetAssetsWatchlistAction = {\n type: `AuthenticatedUserStorageService:getAssetsWatchlist`;\n handler: AuthenticatedUserStorageService['getAssetsWatchlist'];\n};\n\n/**\n * Creates or updates the assets-watchlist for the authenticated user.\n *\n * @param blob - The full assets-watchlist blob. The `assets` array may\n * contain at most `ASSETS_WATCHLIST_MAX_ASSETS` CAIP-19 asset identifiers;\n * this is enforced by `assertAssetsWatchlistBlobForWrite` before the\n * request is sent.\n * @param clientType - Optional client type header.\n * @throws A `StructError` from `@metamask/superstruct` if `blob` is\n * structurally invalid or `assets` exceeds the cap; an `HttpError` from\n * `@metamask/controller-utils` if the API responds with a non-2xx status.\n */\nexport type AuthenticatedUserStorageServiceSetAssetsWatchlistAction = {\n type: `AuthenticatedUserStorageService:setAssetsWatchlist`;\n handler: AuthenticatedUserStorageService['setAssetsWatchlist'];\n};\n\n/**\n * Union of all AuthenticatedUserStorageService action types.\n */\nexport type AuthenticatedUserStorageServiceMethodActions =\n | AuthenticatedUserStorageServiceListDelegationsAction\n | AuthenticatedUserStorageServiceCreateDelegationAction\n | AuthenticatedUserStorageServiceRevokeDelegationAction\n | AuthenticatedUserStorageServiceGetNotificationPreferencesAction\n | AuthenticatedUserStorageServicePutNotificationPreferencesAction\n | AuthenticatedUserStorageServiceGetAssetsWatchlistAction\n | AuthenticatedUserStorageServiceSetAssetsWatchlistAction;\n"]}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _AuthenticatedUserStorageService_instances, _AuthenticatedUserStorageService_environment, _AuthenticatedUserStorageService_getHeaders;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthenticatedUserStorageService = exports.getAuthenticatedStorageUrl = exports.serviceName = void 0;
|
|
16
|
+
const base_data_service_1 = require("@metamask/base-data-service");
|
|
17
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
18
|
+
const env_js_1 = require("./env.cjs");
|
|
19
|
+
const validators_js_1 = require("./validators.cjs");
|
|
20
|
+
// === GENERAL ===
|
|
21
|
+
/**
|
|
22
|
+
* The name of the {@link AuthenticatedUserStorageService} service, used to
|
|
23
|
+
* namespace the service's actions and events.
|
|
24
|
+
*/
|
|
25
|
+
exports.serviceName = 'AuthenticatedUserStorageService';
|
|
26
|
+
/**
|
|
27
|
+
* Builds the versioned API base URL for a given environment.
|
|
28
|
+
*
|
|
29
|
+
* @param environment - The target environment.
|
|
30
|
+
* @returns The base URL including the `/api/v1` path segment.
|
|
31
|
+
*/
|
|
32
|
+
function getAuthenticatedStorageUrl(environment) {
|
|
33
|
+
return `${(0, env_js_1.getUserStorageApiUrl)(environment)}/api/v1`;
|
|
34
|
+
}
|
|
35
|
+
exports.getAuthenticatedStorageUrl = getAuthenticatedStorageUrl;
|
|
36
|
+
// === MESSENGER ===
|
|
37
|
+
const MESSENGER_EXPOSED_METHODS = [
|
|
38
|
+
'listDelegations',
|
|
39
|
+
'createDelegation',
|
|
40
|
+
'revokeDelegation',
|
|
41
|
+
'getNotificationPreferences',
|
|
42
|
+
'putNotificationPreferences',
|
|
43
|
+
'getAssetsWatchlist',
|
|
44
|
+
'setAssetsWatchlist',
|
|
45
|
+
];
|
|
46
|
+
// === SERVICE ===
|
|
47
|
+
/**
|
|
48
|
+
* Data service wrapping authenticated user-storage API endpoints.
|
|
49
|
+
*
|
|
50
|
+
* Provides methods for managing delegations and notification preferences
|
|
51
|
+
* for the authenticated user.
|
|
52
|
+
*/
|
|
53
|
+
class AuthenticatedUserStorageService extends base_data_service_1.BaseDataService {
|
|
54
|
+
/**
|
|
55
|
+
* Constructs a new AuthenticatedUserStorageService.
|
|
56
|
+
*
|
|
57
|
+
* @param args - The constructor arguments.
|
|
58
|
+
* @param args.messenger - The messenger suited for this service.
|
|
59
|
+
* @param args.environment - The target environment (dev, uat, prod).
|
|
60
|
+
* @param args.policyOptions - Options to pass to `createServicePolicy`, which
|
|
61
|
+
* is used to wrap each request. See {@link CreateServicePolicyOptions}.
|
|
62
|
+
*/
|
|
63
|
+
constructor({ messenger, environment, policyOptions, }) {
|
|
64
|
+
super({ name: exports.serviceName, messenger, policyOptions });
|
|
65
|
+
_AuthenticatedUserStorageService_instances.add(this);
|
|
66
|
+
_AuthenticatedUserStorageService_environment.set(this, void 0);
|
|
67
|
+
__classPrivateFieldSet(this, _AuthenticatedUserStorageService_environment, environment, "f");
|
|
68
|
+
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns all delegation records belonging to the authenticated user.
|
|
72
|
+
*
|
|
73
|
+
* @returns An array of delegation records, or an empty array if none exist.
|
|
74
|
+
*/
|
|
75
|
+
async listDelegations() {
|
|
76
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/delegations`;
|
|
77
|
+
const data = await this.fetchQuery({
|
|
78
|
+
queryKey: [`${this.name}:listDelegations`],
|
|
79
|
+
queryFn: async () => {
|
|
80
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this);
|
|
81
|
+
const response = await fetch(url, { headers });
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to list delegations: ${response.status}`);
|
|
84
|
+
}
|
|
85
|
+
return response.json();
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
(0, validators_js_1.assertDelegationResponseArray)(data);
|
|
89
|
+
return data;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Stores a signed delegation record for the authenticated user.
|
|
93
|
+
*
|
|
94
|
+
* @param submission - The signed delegation and its metadata.
|
|
95
|
+
* @param clientType - Optional client type header.
|
|
96
|
+
*/
|
|
97
|
+
async createDelegation(submission, clientType) {
|
|
98
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/delegations`;
|
|
99
|
+
await this.fetchQuery({
|
|
100
|
+
queryKey: [
|
|
101
|
+
`${this.name}:createDelegation`,
|
|
102
|
+
submission.metadata.delegationHash,
|
|
103
|
+
],
|
|
104
|
+
staleTime: 0,
|
|
105
|
+
queryFn: async () => {
|
|
106
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this, clientType);
|
|
107
|
+
const response = await fetch(url, {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
headers,
|
|
110
|
+
body: JSON.stringify(submission),
|
|
111
|
+
});
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to create delegation: ${response.status}`);
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
await this.invalidateQueries({
|
|
119
|
+
queryKey: [`${this.name}:listDelegations`],
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Revokes (deletes) a delegation record.
|
|
124
|
+
*
|
|
125
|
+
* @param delegationHash - The unique hash identifying the delegation.
|
|
126
|
+
*/
|
|
127
|
+
async revokeDelegation(delegationHash) {
|
|
128
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/delegations/${encodeURIComponent(delegationHash)}`;
|
|
129
|
+
await this.fetchQuery({
|
|
130
|
+
queryKey: [`${this.name}:revokeDelegation`, delegationHash],
|
|
131
|
+
staleTime: 0,
|
|
132
|
+
queryFn: async () => {
|
|
133
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this);
|
|
134
|
+
const response = await fetch(url, {
|
|
135
|
+
method: 'DELETE',
|
|
136
|
+
headers,
|
|
137
|
+
});
|
|
138
|
+
if (!response.ok) {
|
|
139
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to revoke delegation: ${response.status}`);
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
await this.invalidateQueries({
|
|
145
|
+
queryKey: [`${this.name}:listDelegations`],
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns the notification preferences for the authenticated user.
|
|
150
|
+
*
|
|
151
|
+
* @returns The notification preferences object, or `null` if none have been
|
|
152
|
+
* set (404).
|
|
153
|
+
*/
|
|
154
|
+
async getNotificationPreferences() {
|
|
155
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/preferences/notifications`;
|
|
156
|
+
const data = await this.fetchQuery({
|
|
157
|
+
queryKey: [`${this.name}:getNotificationPreferences`],
|
|
158
|
+
queryFn: async () => {
|
|
159
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this);
|
|
160
|
+
const response = await fetch(url, { headers });
|
|
161
|
+
if (response.status === 404) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
if (!response.ok) {
|
|
165
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to get notification preferences: ${response.status}`);
|
|
166
|
+
}
|
|
167
|
+
return response.json();
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
if (data === null) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
(0, validators_js_1.assertNotificationPreferences)(data);
|
|
174
|
+
return data;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Creates or updates the notification preferences for the authenticated user.
|
|
178
|
+
*
|
|
179
|
+
* @param prefs - The full notification preferences object.
|
|
180
|
+
* @param clientType - Optional client type header.
|
|
181
|
+
*/
|
|
182
|
+
async putNotificationPreferences(prefs, clientType) {
|
|
183
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/preferences/notifications`;
|
|
184
|
+
await this.fetchQuery({
|
|
185
|
+
queryKey: [
|
|
186
|
+
`${this.name}:putNotificationPreferences`,
|
|
187
|
+
prefs,
|
|
188
|
+
],
|
|
189
|
+
staleTime: 0,
|
|
190
|
+
queryFn: async () => {
|
|
191
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this, clientType);
|
|
192
|
+
const response = await fetch(url, {
|
|
193
|
+
method: 'PUT',
|
|
194
|
+
headers,
|
|
195
|
+
body: JSON.stringify(prefs),
|
|
196
|
+
});
|
|
197
|
+
if (!response.ok) {
|
|
198
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to put notification preferences: ${response.status}`);
|
|
199
|
+
}
|
|
200
|
+
return null;
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
await this.invalidateQueries({
|
|
204
|
+
queryKey: [`${this.name}:getNotificationPreferences`],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Returns the assets-watchlist for the authenticated user.
|
|
209
|
+
*
|
|
210
|
+
* @returns The assets-watchlist blob, or `null` if none has been set (404).
|
|
211
|
+
*/
|
|
212
|
+
async getAssetsWatchlist() {
|
|
213
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/preferences/assets-watchlist`;
|
|
214
|
+
const data = await this.fetchQuery({
|
|
215
|
+
queryKey: [`${this.name}:getAssetsWatchlist`],
|
|
216
|
+
queryFn: async () => {
|
|
217
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this);
|
|
218
|
+
const response = await fetch(url, { headers });
|
|
219
|
+
if (response.status === 404) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
if (!response.ok) {
|
|
223
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to get assets watchlist: ${response.status}`);
|
|
224
|
+
}
|
|
225
|
+
return response.json();
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
if (data === null) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
(0, validators_js_1.assertAssetsWatchlistBlob)(data);
|
|
232
|
+
return data;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Creates or updates the assets-watchlist for the authenticated user.
|
|
236
|
+
*
|
|
237
|
+
* @param blob - The full assets-watchlist blob. The `assets` array may
|
|
238
|
+
* contain at most `ASSETS_WATCHLIST_MAX_ASSETS` CAIP-19 asset identifiers;
|
|
239
|
+
* this is enforced by `assertAssetsWatchlistBlobForWrite` before the
|
|
240
|
+
* request is sent.
|
|
241
|
+
* @param clientType - Optional client type header.
|
|
242
|
+
* @throws A `StructError` from `@metamask/superstruct` if `blob` is
|
|
243
|
+
* structurally invalid or `assets` exceeds the cap; an `HttpError` from
|
|
244
|
+
* `@metamask/controller-utils` if the API responds with a non-2xx status.
|
|
245
|
+
*/
|
|
246
|
+
async setAssetsWatchlist(blob, clientType) {
|
|
247
|
+
(0, validators_js_1.assertAssetsWatchlistBlobForWrite)(blob);
|
|
248
|
+
const url = `${getAuthenticatedStorageUrl(__classPrivateFieldGet(this, _AuthenticatedUserStorageService_environment, "f"))}/preferences/assets-watchlist`;
|
|
249
|
+
await this.fetchQuery({
|
|
250
|
+
queryKey: [`${this.name}:setAssetsWatchlist`, blob],
|
|
251
|
+
staleTime: 0,
|
|
252
|
+
queryFn: async () => {
|
|
253
|
+
const headers = await __classPrivateFieldGet(this, _AuthenticatedUserStorageService_instances, "m", _AuthenticatedUserStorageService_getHeaders).call(this, clientType);
|
|
254
|
+
const response = await fetch(url, {
|
|
255
|
+
method: 'PUT',
|
|
256
|
+
headers,
|
|
257
|
+
body: JSON.stringify(blob),
|
|
258
|
+
});
|
|
259
|
+
if (!response.ok) {
|
|
260
|
+
throw new controller_utils_1.HttpError(response.status, `Failed to put assets watchlist: ${response.status}`);
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
await this.invalidateQueries({
|
|
266
|
+
queryKey: [`${this.name}:getAssetsWatchlist`],
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.AuthenticatedUserStorageService = AuthenticatedUserStorageService;
|
|
271
|
+
_AuthenticatedUserStorageService_environment = new WeakMap(), _AuthenticatedUserStorageService_instances = new WeakSet(), _AuthenticatedUserStorageService_getHeaders = async function _AuthenticatedUserStorageService_getHeaders(clientType) {
|
|
272
|
+
const accessToken = await this.messenger.call('AuthenticationController:getBearerToken');
|
|
273
|
+
const headers = {
|
|
274
|
+
'Content-Type': 'application/json',
|
|
275
|
+
Authorization: `Bearer ${accessToken}`,
|
|
276
|
+
};
|
|
277
|
+
if (clientType) {
|
|
278
|
+
headers['X-Client-Type'] = clientType;
|
|
279
|
+
}
|
|
280
|
+
return headers;
|
|
281
|
+
};
|
|
282
|
+
//# sourceMappingURL=authenticated-user-storage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user-storage.cjs","sourceRoot":"","sources":["../src/authenticated-user-storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,mEAA8D;AAE9D,iEAAuD;AAMvD,sCAAgD;AAQhD,oDAKyB;AAEzB,kB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AAE,CAAC;QACf,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IACxC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { BaseDataService } from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { Json } from '@metamask/utils';\n\nimport type { AuthenticatedUserStorageServiceMethodActions } from './authenticated-user-storage-method-action-types.js';\nimport type { Environment } from './env.js';\nimport { getUserStorageApiUrl } from './env.js';\nimport type {\n AssetsWatchlistBlob,\n ClientType,\n DelegationResponse,\n DelegationSubmission,\n NotificationPreferences,\n} from './types.js';\nimport {\n assertAssetsWatchlistBlob,\n assertAssetsWatchlistBlobForWrite,\n assertDelegationResponseArray,\n assertNotificationPreferences,\n} from './validators.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link AuthenticatedUserStorageService} service, used to\n * namespace the service's actions and events.\n */\nexport const serviceName = 'AuthenticatedUserStorageService';\n\n/**\n * Builds the versioned API base URL for a given environment.\n *\n * @param environment - The target environment.\n * @returns The base URL including the `/api/v1` path segment.\n */\nexport function getAuthenticatedStorageUrl(environment: Environment): string {\n return `${getUserStorageApiUrl(environment)}/api/v1`;\n}\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'listDelegations',\n 'createDelegation',\n 'revokeDelegation',\n 'getNotificationPreferences',\n 'putNotificationPreferences',\n 'getAssetsWatchlist',\n 'setAssetsWatchlist',\n] as const;\n\n/**\n * Invalidates cached queries for {@link AuthenticatedUserStorageService}.\n */\nexport type AuthenticatedUserStorageInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link AuthenticatedUserStorageService} exposes to other\n * consumers.\n */\nexport type AuthenticatedUserStorageActions =\n | AuthenticatedUserStorageServiceMethodActions\n | AuthenticatedUserStorageInvalidateQueriesAction;\n\n/**\n * Retrieves a bearer token from the `AuthenticationController`, logging in the\n * user if necessary.\n */\ntype AuthenticationControllerGetBearerTokenAction = {\n type: 'AuthenticationController:getBearerToken';\n handler: (entropySourceId?: string) => Promise<string>;\n};\n\n/**\n * Actions from other messengers that {@link AuthenticatedUserStorageService}\n * calls.\n */\ntype AllowedActions = AuthenticationControllerGetBearerTokenAction;\n\n/**\n * Published when {@link AuthenticatedUserStorageService}'s cache is updated.\n */\nexport type AuthenticatedUserStorageCacheUpdatedEvent =\n DataServiceCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Published when a key within {@link AuthenticatedUserStorageService}'s cache\n * is updated.\n */\nexport type AuthenticatedUserStorageGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link AuthenticatedUserStorageService} exposes to other\n * consumers.\n */\nexport type AuthenticatedUserStorageEvents =\n | AuthenticatedUserStorageCacheUpdatedEvent\n | AuthenticatedUserStorageGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that\n * {@link AuthenticatedUserStorageService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link AuthenticatedUserStorageService}.\n */\nexport type AuthenticatedUserStorageMessenger = Messenger<\n typeof serviceName,\n AuthenticatedUserStorageActions | AllowedActions,\n AuthenticatedUserStorageEvents | AllowedEvents\n>;\n\n// === SERVICE ===\n\n/**\n * Data service wrapping authenticated user-storage API endpoints.\n *\n * Provides methods for managing delegations and notification preferences\n * for the authenticated user.\n */\nexport class AuthenticatedUserStorageService extends BaseDataService<\n typeof serviceName,\n AuthenticatedUserStorageMessenger\n> {\n readonly #environment: Environment;\n\n /**\n * Constructs a new AuthenticatedUserStorageService.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger suited for this service.\n * @param args.environment - The target environment (dev, uat, prod).\n * @param args.policyOptions - Options to pass to `createServicePolicy`, which\n * is used to wrap each request. See {@link CreateServicePolicyOptions}.\n */\n constructor({\n messenger,\n environment,\n policyOptions,\n }: {\n messenger: AuthenticatedUserStorageMessenger;\n environment: Environment;\n policyOptions?: CreateServicePolicyOptions;\n }) {\n super({ name: serviceName, messenger, policyOptions });\n this.#environment = environment;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Returns all delegation records belonging to the authenticated user.\n *\n * @returns An array of delegation records, or an empty array if none exist.\n */\n async listDelegations(): Promise<DelegationResponse[]> {\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/delegations`;\n\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:listDelegations`],\n queryFn: async () => {\n const headers = await this.#getHeaders();\n const response = await fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to list delegations: ${response.status}`,\n );\n }\n\n return response.json();\n },\n });\n\n assertDelegationResponseArray(data);\n return data;\n }\n\n /**\n * Stores a signed delegation record for the authenticated user.\n *\n * @param submission - The signed delegation and its metadata.\n * @param clientType - Optional client type header.\n */\n async createDelegation(\n submission: DelegationSubmission,\n clientType?: ClientType,\n ): Promise<void> {\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/delegations`;\n\n await this.fetchQuery({\n queryKey: [\n `${this.name}:createDelegation`,\n submission.metadata.delegationHash,\n ],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#getHeaders(clientType);\n const response = await fetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(submission),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to create delegation: ${response.status}`,\n );\n }\n\n return null;\n },\n });\n\n await this.invalidateQueries({\n queryKey: [`${this.name}:listDelegations`],\n });\n }\n\n /**\n * Revokes (deletes) a delegation record.\n *\n * @param delegationHash - The unique hash identifying the delegation.\n */\n async revokeDelegation(delegationHash: string): Promise<void> {\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/delegations/${encodeURIComponent(delegationHash)}`;\n\n await this.fetchQuery({\n queryKey: [`${this.name}:revokeDelegation`, delegationHash],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#getHeaders();\n const response = await fetch(url, {\n method: 'DELETE',\n headers,\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to revoke delegation: ${response.status}`,\n );\n }\n\n return null;\n },\n });\n\n await this.invalidateQueries({\n queryKey: [`${this.name}:listDelegations`],\n });\n }\n\n /**\n * Returns the notification preferences for the authenticated user.\n *\n * @returns The notification preferences object, or `null` if none have been\n * set (404).\n */\n async getNotificationPreferences(): Promise<NotificationPreferences | null> {\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/preferences/notifications`;\n\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:getNotificationPreferences`],\n queryFn: async () => {\n const headers = await this.#getHeaders();\n const response = await fetch(url, { headers });\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to get notification preferences: ${response.status}`,\n );\n }\n\n return response.json();\n },\n });\n\n if (data === null) {\n return null;\n }\n\n assertNotificationPreferences(data);\n return data;\n }\n\n /**\n * Creates or updates the notification preferences for the authenticated user.\n *\n * @param prefs - The full notification preferences object.\n * @param clientType - Optional client type header.\n */\n async putNotificationPreferences(\n prefs: NotificationPreferences,\n clientType?: ClientType,\n ): Promise<void> {\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/preferences/notifications`;\n\n await this.fetchQuery({\n queryKey: [\n `${this.name}:putNotificationPreferences`,\n prefs as unknown as Json,\n ],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#getHeaders(clientType);\n const response = await fetch(url, {\n method: 'PUT',\n headers,\n body: JSON.stringify(prefs),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to put notification preferences: ${response.status}`,\n );\n }\n\n return null;\n },\n });\n\n await this.invalidateQueries({\n queryKey: [`${this.name}:getNotificationPreferences`],\n });\n }\n\n /**\n * Returns the assets-watchlist for the authenticated user.\n *\n * @returns The assets-watchlist blob, or `null` if none has been set (404).\n */\n async getAssetsWatchlist(): Promise<AssetsWatchlistBlob | null> {\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/preferences/assets-watchlist`;\n\n const data = await this.fetchQuery({\n queryKey: [`${this.name}:getAssetsWatchlist`],\n queryFn: async () => {\n const headers = await this.#getHeaders();\n const response = await fetch(url, { headers });\n\n if (response.status === 404) {\n return null;\n }\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to get assets watchlist: ${response.status}`,\n );\n }\n\n return response.json();\n },\n });\n\n if (data === null) {\n return null;\n }\n\n assertAssetsWatchlistBlob(data);\n return data;\n }\n\n /**\n * Creates or updates the assets-watchlist for the authenticated user.\n *\n * @param blob - The full assets-watchlist blob. The `assets` array may\n * contain at most `ASSETS_WATCHLIST_MAX_ASSETS` CAIP-19 asset identifiers;\n * this is enforced by `assertAssetsWatchlistBlobForWrite` before the\n * request is sent.\n * @param clientType - Optional client type header.\n * @throws A `StructError` from `@metamask/superstruct` if `blob` is\n * structurally invalid or `assets` exceeds the cap; an `HttpError` from\n * `@metamask/controller-utils` if the API responds with a non-2xx status.\n */\n async setAssetsWatchlist(\n blob: AssetsWatchlistBlob,\n clientType?: ClientType,\n ): Promise<void> {\n assertAssetsWatchlistBlobForWrite(blob);\n\n const url = `${getAuthenticatedStorageUrl(this.#environment)}/preferences/assets-watchlist`;\n\n await this.fetchQuery({\n queryKey: [`${this.name}:setAssetsWatchlist`, blob as unknown as Json],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#getHeaders(clientType);\n const response = await fetch(url, {\n method: 'PUT',\n headers,\n body: JSON.stringify(blob),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Failed to put assets watchlist: ${response.status}`,\n );\n }\n\n return null;\n },\n });\n\n await this.invalidateQueries({\n queryKey: [`${this.name}:getAssetsWatchlist`],\n });\n }\n\n async #getHeaders(clientType?: ClientType): Promise<Record<string, string>> {\n const accessToken = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n };\n if (clientType) {\n headers['X-Client-Type'] = clientType;\n }\n return headers;\n }\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from
|
|
2
|
-
import { BaseDataService } from
|
|
3
|
-
import type { CreateServicePolicyOptions } from
|
|
4
|
-
import type { Messenger } from
|
|
5
|
-
import type { AuthenticatedUserStorageServiceMethodActions } from
|
|
6
|
-
import type { Environment } from
|
|
7
|
-
import type { AssetsWatchlistBlob, ClientType, DelegationResponse, DelegationSubmission, NotificationPreferences } from
|
|
1
|
+
import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from "@metamask/base-data-service";
|
|
2
|
+
import { BaseDataService } from "@metamask/base-data-service";
|
|
3
|
+
import type { CreateServicePolicyOptions } from "@metamask/controller-utils";
|
|
4
|
+
import type { Messenger } from "@metamask/messenger";
|
|
5
|
+
import type { AuthenticatedUserStorageServiceMethodActions } from "./authenticated-user-storage-method-action-types.cjs";
|
|
6
|
+
import type { Environment } from "./env.cjs";
|
|
7
|
+
import type { AssetsWatchlistBlob, ClientType, DelegationResponse, DelegationSubmission, NotificationPreferences } from "./types.cjs";
|
|
8
8
|
/**
|
|
9
9
|
* The name of the {@link AuthenticatedUserStorageService} service, used to
|
|
10
10
|
* namespace the service's actions and events.
|
|
@@ -139,4 +139,4 @@ export declare class AuthenticatedUserStorageService extends BaseDataService<typ
|
|
|
139
139
|
setAssetsWatchlist(blob: AssetsWatchlistBlob, clientType?: ClientType): Promise<void>;
|
|
140
140
|
}
|
|
141
141
|
export {};
|
|
142
|
-
//# sourceMappingURL=authenticated-user-storage.d.
|
|
142
|
+
//# sourceMappingURL=authenticated-user-storage.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user-storage.d.cts","sourceRoot":"","sources":["../src/authenticated-user-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,oCAAoC;AACrC,OAAO,EAAE,eAAe,EAAE,oCAAoC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,mCAAmC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAGrD,OAAO,KAAK,EAAE,4CAA4C,EAAE,6DAA4D;AACxH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAiB;AAE5C,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACxB,oBAAmB;AAUpB;;;GAGG;AACH,eAAO,MAAM,WAAW,oCAAoC,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAE3E;AAcD;;GAEG;AACH,MAAM,MAAM,+CAA+C,GACzD,kCAAkC,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GACvC,4CAA4C,GAC5C,+CAA+C,CAAC;AAEpD;;;GAGG;AACH,KAAK,4CAA4C,GAAG;IAClD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD,CAAC;AAEF;;;GAGG;AACH,KAAK,cAAc,GAAG,4CAA4C,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,yCAAyC,GACnD,4BAA4B,CAAC,OAAO,WAAW,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,i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