@metamask-previews/profile-controller 0.0.0-stage → 1.0.0-preview-cecad39eb
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 +18 -0
- package/LICENSE +6 -0
- package/LICENSE.APACHE2 +201 -0
- package/LICENSE.MIT +21 -0
- package/README.md +14 -2
- package/dist/ProfileController-method-action-types.d.ts +99 -0
- package/dist/ProfileController-method-action-types.d.ts.map +1 -0
- package/dist/ProfileController-method-action-types.js +6 -0
- package/dist/ProfileController-method-action-types.js.map +1 -0
- package/dist/ProfileController.d.ts +153 -0
- package/dist/ProfileController.d.ts.map +1 -0
- package/dist/ProfileController.js +241 -0
- package/dist/ProfileController.js.map +1 -0
- package/dist/ProfileService-method-action-types.d.ts +117 -0
- package/dist/ProfileService-method-action-types.d.ts.map +1 -0
- package/dist/ProfileService-method-action-types.js +6 -0
- package/dist/ProfileService-method-action-types.js.map +1 -0
- package/dist/ProfileService.d.ts +310 -0
- package/dist/ProfileService.d.ts.map +1 -0
- package/dist/ProfileService.js +327 -0
- package/dist/ProfileService.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -3
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { BaseDataService } from '@metamask/base-data-service';
|
|
2
|
+
import type { CreateServicePolicyOptions, DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from '@metamask/base-data-service';
|
|
3
|
+
import type { Messenger } from '@metamask/messenger';
|
|
4
|
+
import type { AuthenticationController } from '@metamask/profile-sync-controller';
|
|
5
|
+
import type { Infer } from '@metamask/superstruct';
|
|
6
|
+
import type { ProfileServiceMethodActions } from './ProfileService-method-action-types.js';
|
|
7
|
+
export declare const serviceName = "ProfileService";
|
|
8
|
+
/** Human-readable error messages for each ProfileService operation. */
|
|
9
|
+
export declare const ProfileServiceErrorMessage: {
|
|
10
|
+
readonly GET_PROFILE_FAILED: 'ProfileService: failed to fetch profile';
|
|
11
|
+
readonly CREATE_PROFILE_FAILED: 'ProfileService: failed to create profile';
|
|
12
|
+
readonly REPLACE_PROFILE_FAILED: 'ProfileService: failed to replace profile';
|
|
13
|
+
readonly UPDATE_PROFILE_FAILED: 'ProfileService: failed to update profile';
|
|
14
|
+
readonly DELETE_PROFILE_FAILED: 'ProfileService: failed to delete profile';
|
|
15
|
+
readonly CHECK_USERNAME_AVAILABILITY_FAILED: 'ProfileService: failed to check username availability';
|
|
16
|
+
readonly GET_X_AUTH_URL_FAILED: 'ProfileService: failed to get X authentication URL';
|
|
17
|
+
readonly CONNECT_X_FAILED: 'ProfileService: failed to connect X account';
|
|
18
|
+
readonly GET_X_ACCOUNT_FAILED: 'ProfileService: failed to get X account';
|
|
19
|
+
};
|
|
20
|
+
declare const ProfileApiResponseStruct: import("@metamask/superstruct").Struct<{
|
|
21
|
+
profile_id: string;
|
|
22
|
+
username: string;
|
|
23
|
+
display_name: string;
|
|
24
|
+
bio: string | null;
|
|
25
|
+
linked_addresses: `${string}:${string}:${string}`[];
|
|
26
|
+
avatar_url: string | null;
|
|
27
|
+
trading_privacy: "private" | "public";
|
|
28
|
+
connected_to_x: boolean;
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
}, {
|
|
32
|
+
profile_id: import("@metamask/superstruct").Struct<string, null>;
|
|
33
|
+
username: import("@metamask/superstruct").Struct<string, null>;
|
|
34
|
+
display_name: import("@metamask/superstruct").Struct<string, null>;
|
|
35
|
+
bio: import("@metamask/superstruct").Struct<string | null, null>;
|
|
36
|
+
linked_addresses: import("@metamask/superstruct").Struct<`${string}:${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}:${string}`, null>>;
|
|
37
|
+
avatar_url: import("@metamask/superstruct").Struct<string | null, null>;
|
|
38
|
+
trading_privacy: import("@metamask/superstruct").Struct<"private" | "public", {
|
|
39
|
+
private: "private";
|
|
40
|
+
public: "public";
|
|
41
|
+
}>;
|
|
42
|
+
connected_to_x: import("@metamask/superstruct").Struct<boolean, null>;
|
|
43
|
+
created_at: import("@metamask/superstruct").Struct<string, null>;
|
|
44
|
+
updated_at: import("@metamask/superstruct").Struct<string, null>;
|
|
45
|
+
}>;
|
|
46
|
+
declare const UsernameAvailabilityResponseStruct: import("@metamask/superstruct").Struct<{
|
|
47
|
+
username: string;
|
|
48
|
+
available: boolean;
|
|
49
|
+
valid: boolean;
|
|
50
|
+
normalized: string;
|
|
51
|
+
errors: {
|
|
52
|
+
code: string;
|
|
53
|
+
message: string;
|
|
54
|
+
}[];
|
|
55
|
+
}, {
|
|
56
|
+
username: import("@metamask/superstruct").Struct<string, null>;
|
|
57
|
+
available: import("@metamask/superstruct").Struct<boolean, null>;
|
|
58
|
+
valid: import("@metamask/superstruct").Struct<boolean, null>;
|
|
59
|
+
normalized: import("@metamask/superstruct").Struct<string, null>;
|
|
60
|
+
errors: import("@metamask/superstruct").Struct<{
|
|
61
|
+
code: string;
|
|
62
|
+
message: string;
|
|
63
|
+
}[], import("@metamask/superstruct").Struct<{
|
|
64
|
+
code: string;
|
|
65
|
+
message: string;
|
|
66
|
+
}, {
|
|
67
|
+
code: import("@metamask/superstruct").Struct<string, null>;
|
|
68
|
+
message: import("@metamask/superstruct").Struct<string, null>;
|
|
69
|
+
}>>;
|
|
70
|
+
}>;
|
|
71
|
+
declare const XAuthUrlResponseStruct: import("@metamask/superstruct").Struct<{
|
|
72
|
+
url: string;
|
|
73
|
+
state: string;
|
|
74
|
+
}, {
|
|
75
|
+
url: import("@metamask/superstruct").Struct<string, null>;
|
|
76
|
+
state: import("@metamask/superstruct").Struct<string, null>;
|
|
77
|
+
}>;
|
|
78
|
+
declare const XConnectResponseStruct: import("@metamask/superstruct").Struct<{
|
|
79
|
+
x_user_id: string;
|
|
80
|
+
x_profile_url: string;
|
|
81
|
+
username: string;
|
|
82
|
+
display_name: string;
|
|
83
|
+
avatar_url: string;
|
|
84
|
+
created_at: string;
|
|
85
|
+
updated_at: string;
|
|
86
|
+
}, {
|
|
87
|
+
x_user_id: import("@metamask/superstruct").Struct<string, null>;
|
|
88
|
+
x_profile_url: import("@metamask/superstruct").Struct<string, null>;
|
|
89
|
+
username: import("@metamask/superstruct").Struct<string, null>;
|
|
90
|
+
display_name: import("@metamask/superstruct").Struct<string, null>;
|
|
91
|
+
avatar_url: import("@metamask/superstruct").Struct<string, null>;
|
|
92
|
+
created_at: import("@metamask/superstruct").Struct<string, null>;
|
|
93
|
+
updated_at: import("@metamask/superstruct").Struct<string, null>;
|
|
94
|
+
}>;
|
|
95
|
+
declare const CreateProfileResponseStruct: import("@metamask/superstruct").Struct<{
|
|
96
|
+
profile_id: string;
|
|
97
|
+
username: string;
|
|
98
|
+
display_name: string;
|
|
99
|
+
bio: string | null;
|
|
100
|
+
linked_addresses: `${string}:${string}:${string}`[];
|
|
101
|
+
avatar_url: string | null;
|
|
102
|
+
trading_privacy: "private" | "public";
|
|
103
|
+
connected_to_x: boolean;
|
|
104
|
+
created_at: string;
|
|
105
|
+
updated_at: string;
|
|
106
|
+
} & {
|
|
107
|
+
x_profile?: {
|
|
108
|
+
x_user_id: string;
|
|
109
|
+
x_profile_url: string;
|
|
110
|
+
username: string;
|
|
111
|
+
display_name: string;
|
|
112
|
+
avatar_url: string;
|
|
113
|
+
created_at: string;
|
|
114
|
+
updated_at: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}, null>;
|
|
117
|
+
declare const ConnectXParamsStruct: import("@metamask/superstruct").Struct<{
|
|
118
|
+
code: string;
|
|
119
|
+
state: string;
|
|
120
|
+
}, {
|
|
121
|
+
code: import("@metamask/superstruct").Struct<string, null>;
|
|
122
|
+
state: import("@metamask/superstruct").Struct<string, null>;
|
|
123
|
+
}>;
|
|
124
|
+
declare const CreateProfileParamsStruct: import("@metamask/superstruct").Struct<{
|
|
125
|
+
profile_id: string;
|
|
126
|
+
username: string;
|
|
127
|
+
display_name: string;
|
|
128
|
+
bio?: string | null | undefined;
|
|
129
|
+
linked_addresses: `${string}:${string}:${string}`[];
|
|
130
|
+
avatar_url?: string | undefined;
|
|
131
|
+
trading_privacy: "private" | "public";
|
|
132
|
+
}, {
|
|
133
|
+
profile_id: import("@metamask/superstruct").Struct<string, null>;
|
|
134
|
+
username: import("@metamask/superstruct").Struct<string, null>;
|
|
135
|
+
display_name: import("@metamask/superstruct").Struct<string, null>;
|
|
136
|
+
bio: import("@metamask/superstruct").Struct<string | null | undefined, null>;
|
|
137
|
+
linked_addresses: import("@metamask/superstruct").Struct<`${string}:${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}:${string}`, null>>;
|
|
138
|
+
avatar_url: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
139
|
+
trading_privacy: import("@metamask/superstruct").Struct<"private" | "public", {
|
|
140
|
+
private: "private";
|
|
141
|
+
public: "public";
|
|
142
|
+
}>;
|
|
143
|
+
}>;
|
|
144
|
+
declare const ReplaceProfileParamsStruct: import("@metamask/superstruct").Struct<{
|
|
145
|
+
username: string;
|
|
146
|
+
display_name: string;
|
|
147
|
+
bio?: string | null | undefined;
|
|
148
|
+
linked_addresses: `${string}:${string}:${string}`[];
|
|
149
|
+
avatar_url?: string | undefined;
|
|
150
|
+
trading_privacy: "private" | "public";
|
|
151
|
+
}, {
|
|
152
|
+
username: import("@metamask/superstruct").Struct<string, null>;
|
|
153
|
+
display_name: import("@metamask/superstruct").Struct<string, null>;
|
|
154
|
+
bio: import("@metamask/superstruct").Struct<string | null | undefined, null>;
|
|
155
|
+
linked_addresses: import("@metamask/superstruct").Struct<`${string}:${string}:${string}`[], import("@metamask/superstruct").Struct<`${string}:${string}:${string}`, null>>;
|
|
156
|
+
avatar_url: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
157
|
+
trading_privacy: import("@metamask/superstruct").Struct<"private" | "public", {
|
|
158
|
+
private: "private";
|
|
159
|
+
public: "public";
|
|
160
|
+
}>;
|
|
161
|
+
}>;
|
|
162
|
+
declare const UpdateProfileParamsStruct: import("@metamask/superstruct").Struct<{
|
|
163
|
+
username?: string | undefined;
|
|
164
|
+
display_name?: string | undefined;
|
|
165
|
+
bio?: string | null | undefined;
|
|
166
|
+
linked_addresses?: `${string}:${string}:${string}`[] | undefined;
|
|
167
|
+
avatar_url?: string | undefined;
|
|
168
|
+
trading_privacy?: "private" | "public" | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
username: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
171
|
+
display_name: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
172
|
+
bio: import("@metamask/superstruct").Struct<string | null | undefined, null>;
|
|
173
|
+
linked_addresses: import("@metamask/superstruct").Struct<`${string}:${string}:${string}`[] | undefined, import("@metamask/superstruct").Struct<`${string}:${string}:${string}`, null>>;
|
|
174
|
+
avatar_url: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
175
|
+
trading_privacy: import("@metamask/superstruct").Struct<"private" | "public" | undefined, {
|
|
176
|
+
private: "private";
|
|
177
|
+
public: "public";
|
|
178
|
+
}>;
|
|
179
|
+
}>;
|
|
180
|
+
/** The shape of a profile returned by the MetaMask Profile API. */
|
|
181
|
+
export type ProfileApiResponse = Infer<typeof ProfileApiResponseStruct>;
|
|
182
|
+
/** The response shape for createProfile — includes an optional linked X profile if the user had already connected X. */
|
|
183
|
+
export type CreateProfileResponse = Infer<typeof CreateProfileResponseStruct>;
|
|
184
|
+
/** The response shape for a username availability check. */
|
|
185
|
+
export type UsernameAvailabilityResponse = Infer<typeof UsernameAvailabilityResponseStruct>;
|
|
186
|
+
/** The response shape returned when connecting or fetching an X account. */
|
|
187
|
+
export type XConnectResponse = Infer<typeof XConnectResponseStruct>;
|
|
188
|
+
/** The response shape returned when requesting the X OAuth authentication URL. */
|
|
189
|
+
export type XAuthUrlResponse = Infer<typeof XAuthUrlResponseStruct>;
|
|
190
|
+
/** Alias for {@link XConnectResponse} returned when fetching the linked X account. */
|
|
191
|
+
export type XAccountResponse = XConnectResponse;
|
|
192
|
+
/** Parameters for creating a new MetaMask profile. */
|
|
193
|
+
export type CreateProfileParams = Infer<typeof CreateProfileParamsStruct>;
|
|
194
|
+
/** Parameters for fully replacing an existing MetaMask profile (PUT). */
|
|
195
|
+
export type ReplaceProfileParams = Infer<typeof ReplaceProfileParamsStruct>;
|
|
196
|
+
/** Parameters for partially updating an existing MetaMask profile (PATCH). */
|
|
197
|
+
export type UpdateProfileParams = Infer<typeof UpdateProfileParamsStruct>;
|
|
198
|
+
/** Parameters for completing the X OAuth PKCE flow. */
|
|
199
|
+
export type ConnectXParams = Infer<typeof ConnectXParamsStruct>;
|
|
200
|
+
/** Union of all actions exposed by ProfileService, including cache invalidation. */
|
|
201
|
+
export type ProfileServiceActions = ProfileServiceMethodActions | DataServiceInvalidateQueriesAction<typeof serviceName>;
|
|
202
|
+
/** Event emitted when the ProfileService query cache is updated. */
|
|
203
|
+
export type ProfileServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<typeof serviceName>;
|
|
204
|
+
/** Event emitted with per-query granularity when the ProfileService cache is updated. */
|
|
205
|
+
export type ProfileServiceGranularCacheUpdatedEvent = DataServiceGranularCacheUpdatedEvent<typeof serviceName>;
|
|
206
|
+
/** Union of all events emitted by ProfileService. */
|
|
207
|
+
export type ProfileServiceEvents = ProfileServiceCacheUpdatedEvent | ProfileServiceGranularCacheUpdatedEvent;
|
|
208
|
+
type AllowedActions = AuthenticationController.AuthenticationControllerGetBearerTokenAction;
|
|
209
|
+
type AllowedEvents = never;
|
|
210
|
+
/** Messenger type for ProfileService, scoped to its actions and events. */
|
|
211
|
+
export type ProfileServiceMessenger = Messenger<typeof serviceName, ProfileServiceActions | AllowedActions, ProfileServiceEvents | AllowedEvents>;
|
|
212
|
+
/** Communicates with the MetaMask Profile API and exposes all operations via the messenger. */
|
|
213
|
+
export declare class ProfileService extends BaseDataService<typeof serviceName, ProfileServiceMessenger> {
|
|
214
|
+
#private;
|
|
215
|
+
/**
|
|
216
|
+
* Creates a new ProfileService instance.
|
|
217
|
+
*
|
|
218
|
+
* @param options - Constructor options.
|
|
219
|
+
* @param options.messenger - The messenger scoped to ProfileService.
|
|
220
|
+
* @param options.baseUrl - Base URL for the MetaMask Profile API.
|
|
221
|
+
* @param options.policyOptions - Optional service policy configuration.
|
|
222
|
+
*/
|
|
223
|
+
constructor({ messenger, baseUrl, policyOptions, }: {
|
|
224
|
+
messenger: ProfileServiceMessenger;
|
|
225
|
+
baseUrl: string;
|
|
226
|
+
policyOptions?: CreateServicePolicyOptions;
|
|
227
|
+
});
|
|
228
|
+
/**
|
|
229
|
+
* Fetches a profile by its identifier.
|
|
230
|
+
*
|
|
231
|
+
* @param profileId - The profile identifier to fetch.
|
|
232
|
+
* @returns The profile data from the API.
|
|
233
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
234
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
235
|
+
*/
|
|
236
|
+
getProfile(profileId: string): Promise<ProfileApiResponse>;
|
|
237
|
+
/**
|
|
238
|
+
* Creates a new MetaMask profile.
|
|
239
|
+
*
|
|
240
|
+
* @param params - The profile creation parameters.
|
|
241
|
+
* @returns The created profile data.
|
|
242
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
243
|
+
* @throws {StructError} If the response do not match the expected shape.
|
|
244
|
+
*/
|
|
245
|
+
createProfile(params: CreateProfileParams): Promise<CreateProfileResponse>;
|
|
246
|
+
/**
|
|
247
|
+
* Fully replaces an existing profile (PUT).
|
|
248
|
+
*
|
|
249
|
+
* @param profileId - The identifier of the profile to replace.
|
|
250
|
+
* @param params - The replacement profile data.
|
|
251
|
+
* @returns The updated profile data.
|
|
252
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
253
|
+
* @throws {StructError} If the response do not match the expected shape.
|
|
254
|
+
*/
|
|
255
|
+
replaceProfile(profileId: string, params: ReplaceProfileParams): Promise<ProfileApiResponse>;
|
|
256
|
+
/**
|
|
257
|
+
* Partially updates an existing profile (PATCH).
|
|
258
|
+
*
|
|
259
|
+
* @param profileId - The identifier of the profile to update.
|
|
260
|
+
* @param params - The fields to update.
|
|
261
|
+
* @returns The updated profile data.
|
|
262
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
263
|
+
* @throws {StructError} If the response do not match the expected shape.
|
|
264
|
+
*/
|
|
265
|
+
updateProfile(profileId: string, params: UpdateProfileParams): Promise<ProfileApiResponse>;
|
|
266
|
+
/**
|
|
267
|
+
* Deletes a profile by its identifier.
|
|
268
|
+
*
|
|
269
|
+
* @param profileId - The identifier of the profile to delete.
|
|
270
|
+
* @returns The result of the mutation.
|
|
271
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
272
|
+
*/
|
|
273
|
+
deleteProfile(profileId: string): Promise<void>;
|
|
274
|
+
/**
|
|
275
|
+
* Checks whether a username is available.
|
|
276
|
+
*
|
|
277
|
+
* @param username - The username to check.
|
|
278
|
+
* @returns Availability details including validity and normalized form.
|
|
279
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
280
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
281
|
+
*/
|
|
282
|
+
checkUsernameAvailability(username: string): Promise<UsernameAvailabilityResponse>;
|
|
283
|
+
/**
|
|
284
|
+
* Fetches the X OAuth PKCE authorization URL and its associated state parameter.
|
|
285
|
+
*
|
|
286
|
+
* @returns An object containing the authorization URL and the state token.
|
|
287
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
288
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
289
|
+
*/
|
|
290
|
+
getXAuthUrl(): Promise<XAuthUrlResponse>;
|
|
291
|
+
/**
|
|
292
|
+
* Completes the X OAuth PKCE flow and links the X account to the profile.
|
|
293
|
+
*
|
|
294
|
+
* @param params - The OAuth callback code and state from the X redirect.
|
|
295
|
+
* @returns The linked X account data.
|
|
296
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
297
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
298
|
+
*/
|
|
299
|
+
connectX(params: ConnectXParams): Promise<XConnectResponse>;
|
|
300
|
+
/**
|
|
301
|
+
* Fetches the X account currently linked to the authenticated profile.
|
|
302
|
+
*
|
|
303
|
+
* @returns The linked X account data.
|
|
304
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
305
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
306
|
+
*/
|
|
307
|
+
getXAccount(): Promise<XAccountResponse>;
|
|
308
|
+
}
|
|
309
|
+
export {};
|
|
310
|
+
//# sourceMappingURL=ProfileService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfileService.d.ts","sourceRoot":"","sources":["../src/ProfileService.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { BaseDataService } from '@metamask/base-data-service';
|
|
2
|
+
import { HttpError } from '@metamask/controller-utils';
|
|
3
|
+
import { array, boolean, enums, intersection, nullable, optional, sensitive, string, type as structType, } from '@metamask/superstruct';
|
|
4
|
+
import { CaipAccountIdStruct } from '@metamask/utils';
|
|
5
|
+
export const serviceName = 'ProfileService';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Error messages
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
/** Human-readable error messages for each ProfileService operation. */
|
|
10
|
+
export const ProfileServiceErrorMessage = {
|
|
11
|
+
GET_PROFILE_FAILED: 'ProfileService: failed to fetch profile',
|
|
12
|
+
CREATE_PROFILE_FAILED: 'ProfileService: failed to create profile',
|
|
13
|
+
REPLACE_PROFILE_FAILED: 'ProfileService: failed to replace profile',
|
|
14
|
+
UPDATE_PROFILE_FAILED: 'ProfileService: failed to update profile',
|
|
15
|
+
DELETE_PROFILE_FAILED: 'ProfileService: failed to delete profile',
|
|
16
|
+
CHECK_USERNAME_AVAILABILITY_FAILED: 'ProfileService: failed to check username availability',
|
|
17
|
+
GET_X_AUTH_URL_FAILED: 'ProfileService: failed to get X authentication URL',
|
|
18
|
+
CONNECT_X_FAILED: 'ProfileService: failed to connect X account',
|
|
19
|
+
GET_X_ACCOUNT_FAILED: 'ProfileService: failed to get X account',
|
|
20
|
+
};
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Superstruct schemas
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const TradingPrivacyStruct = enums(['public', 'private']);
|
|
25
|
+
const ProfileApiResponseStruct = structType({
|
|
26
|
+
profile_id: string(),
|
|
27
|
+
username: string(),
|
|
28
|
+
display_name: string(),
|
|
29
|
+
bio: nullable(string()),
|
|
30
|
+
linked_addresses: array(CaipAccountIdStruct),
|
|
31
|
+
avatar_url: nullable(string()),
|
|
32
|
+
trading_privacy: TradingPrivacyStruct,
|
|
33
|
+
connected_to_x: boolean(),
|
|
34
|
+
created_at: string(),
|
|
35
|
+
updated_at: string(),
|
|
36
|
+
});
|
|
37
|
+
const UsernameAvailabilityErrorStruct = structType({
|
|
38
|
+
code: string(),
|
|
39
|
+
message: string(),
|
|
40
|
+
});
|
|
41
|
+
const UsernameAvailabilityResponseStruct = structType({
|
|
42
|
+
username: string(),
|
|
43
|
+
available: boolean(),
|
|
44
|
+
valid: boolean(),
|
|
45
|
+
normalized: string(),
|
|
46
|
+
errors: array(UsernameAvailabilityErrorStruct),
|
|
47
|
+
});
|
|
48
|
+
const XAuthUrlResponseStruct = structType({
|
|
49
|
+
url: sensitive(string()),
|
|
50
|
+
state: sensitive(string()),
|
|
51
|
+
});
|
|
52
|
+
const XConnectResponseStruct = structType({
|
|
53
|
+
x_user_id: string(),
|
|
54
|
+
x_profile_url: string(),
|
|
55
|
+
username: string(),
|
|
56
|
+
display_name: string(),
|
|
57
|
+
avatar_url: string(),
|
|
58
|
+
created_at: string(),
|
|
59
|
+
updated_at: string(),
|
|
60
|
+
});
|
|
61
|
+
const CreateProfileResponseStruct = intersection([
|
|
62
|
+
ProfileApiResponseStruct,
|
|
63
|
+
structType({ x_profile: optional(XConnectResponseStruct) }),
|
|
64
|
+
]);
|
|
65
|
+
const ConnectXParamsStruct = structType({
|
|
66
|
+
code: sensitive(string()),
|
|
67
|
+
state: sensitive(string()),
|
|
68
|
+
});
|
|
69
|
+
const CreateProfileParamsStruct = structType({
|
|
70
|
+
profile_id: string(),
|
|
71
|
+
username: string(),
|
|
72
|
+
display_name: string(),
|
|
73
|
+
bio: optional(nullable(string())),
|
|
74
|
+
linked_addresses: array(CaipAccountIdStruct),
|
|
75
|
+
avatar_url: optional(string()),
|
|
76
|
+
trading_privacy: TradingPrivacyStruct,
|
|
77
|
+
});
|
|
78
|
+
const ReplaceProfileParamsStruct = structType({
|
|
79
|
+
username: string(),
|
|
80
|
+
display_name: string(),
|
|
81
|
+
bio: optional(nullable(string())),
|
|
82
|
+
linked_addresses: array(CaipAccountIdStruct),
|
|
83
|
+
avatar_url: optional(string()),
|
|
84
|
+
trading_privacy: TradingPrivacyStruct,
|
|
85
|
+
});
|
|
86
|
+
const UpdateProfileParamsStruct = structType({
|
|
87
|
+
username: optional(string()),
|
|
88
|
+
display_name: optional(string()),
|
|
89
|
+
bio: optional(nullable(string())),
|
|
90
|
+
linked_addresses: optional(array(CaipAccountIdStruct)),
|
|
91
|
+
avatar_url: optional(string()),
|
|
92
|
+
trading_privacy: optional(TradingPrivacyStruct),
|
|
93
|
+
});
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Types
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
const MESSENGER_EXPOSED_METHODS = [
|
|
98
|
+
'getProfile',
|
|
99
|
+
'createProfile',
|
|
100
|
+
'replaceProfile',
|
|
101
|
+
'updateProfile',
|
|
102
|
+
'deleteProfile',
|
|
103
|
+
'checkUsernameAvailability',
|
|
104
|
+
'getXAuthUrl',
|
|
105
|
+
'connectX',
|
|
106
|
+
'getXAccount',
|
|
107
|
+
];
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Service
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
/** Communicates with the MetaMask Profile API and exposes all operations via the messenger. */
|
|
112
|
+
export class ProfileService extends BaseDataService {
|
|
113
|
+
#baseUrl;
|
|
114
|
+
get #v1Url() {
|
|
115
|
+
return `${this.#baseUrl}/v1`;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Creates a new ProfileService instance.
|
|
119
|
+
*
|
|
120
|
+
* @param options - Constructor options.
|
|
121
|
+
* @param options.messenger - The messenger scoped to ProfileService.
|
|
122
|
+
* @param options.baseUrl - Base URL for the MetaMask Profile API.
|
|
123
|
+
* @param options.policyOptions - Optional service policy configuration.
|
|
124
|
+
*/
|
|
125
|
+
constructor({ messenger, baseUrl, policyOptions, }) {
|
|
126
|
+
super({ name: serviceName, messenger, policyOptions });
|
|
127
|
+
this.#baseUrl = baseUrl;
|
|
128
|
+
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Gets the authentication headers for the request.
|
|
132
|
+
*
|
|
133
|
+
* @returns The authentication headers.
|
|
134
|
+
*/
|
|
135
|
+
async #getAuthHeaders() {
|
|
136
|
+
const token = await this.messenger.call('AuthenticationController:getBearerToken');
|
|
137
|
+
return { Authorization: `Bearer ${token}` };
|
|
138
|
+
}
|
|
139
|
+
async #fetch(endpoint, { method = 'GET', error, json, searchParams, }) {
|
|
140
|
+
const authHeaders = await this.#getAuthHeaders();
|
|
141
|
+
const url = new URL(`${this.#v1Url}/${endpoint}`);
|
|
142
|
+
if (searchParams) {
|
|
143
|
+
for (const [key, value] of Object.entries(searchParams)) {
|
|
144
|
+
url.searchParams.append(key, value);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const response = await fetch(url.toString(), {
|
|
148
|
+
...(method === 'GET' ? {} : { method }),
|
|
149
|
+
headers: {
|
|
150
|
+
...authHeaders,
|
|
151
|
+
...(json === undefined ? {} : { 'Content-Type': 'application/json' }),
|
|
152
|
+
},
|
|
153
|
+
...(json === undefined ? {} : { body: JSON.stringify(json) }),
|
|
154
|
+
});
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
throw new HttpError(response.status, `${error}: ${response.status}`);
|
|
157
|
+
}
|
|
158
|
+
if (method === 'DELETE') {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
return (await response.json());
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Fetches a profile by its identifier.
|
|
165
|
+
*
|
|
166
|
+
* @param profileId - The profile identifier to fetch.
|
|
167
|
+
* @returns The profile data from the API.
|
|
168
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
169
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
170
|
+
*/
|
|
171
|
+
async getProfile(profileId) {
|
|
172
|
+
return this.fetchQuery({
|
|
173
|
+
queryKey: [`${this.name}:getProfile`, profileId],
|
|
174
|
+
responseStruct: ProfileApiResponseStruct,
|
|
175
|
+
queryFn: async () => this.#fetch(`profiles/${encodeURIComponent(profileId)}`, {
|
|
176
|
+
error: ProfileServiceErrorMessage.GET_PROFILE_FAILED,
|
|
177
|
+
}),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Creates a new MetaMask profile.
|
|
182
|
+
*
|
|
183
|
+
* @param params - The profile creation parameters.
|
|
184
|
+
* @returns The created profile data.
|
|
185
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
186
|
+
* @throws {StructError} If the response do not match the expected shape.
|
|
187
|
+
*/
|
|
188
|
+
async createProfile(params) {
|
|
189
|
+
return this.executeMutation({
|
|
190
|
+
mutationKey: [`${this.name}:createProfile`],
|
|
191
|
+
responseStruct: CreateProfileResponseStruct,
|
|
192
|
+
mutationFn: async () => this.#fetch('profiles', {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
error: ProfileServiceErrorMessage.CREATE_PROFILE_FAILED,
|
|
195
|
+
json: params,
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Fully replaces an existing profile (PUT).
|
|
201
|
+
*
|
|
202
|
+
* @param profileId - The identifier of the profile to replace.
|
|
203
|
+
* @param params - The replacement profile data.
|
|
204
|
+
* @returns The updated profile data.
|
|
205
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
206
|
+
* @throws {StructError} If the response do not match the expected shape.
|
|
207
|
+
*/
|
|
208
|
+
async replaceProfile(profileId, params) {
|
|
209
|
+
return this.executeMutation({
|
|
210
|
+
mutationKey: [`${this.name}:replaceProfile`, profileId],
|
|
211
|
+
responseStruct: ProfileApiResponseStruct,
|
|
212
|
+
mutationFn: async () => this.#fetch(`profiles/${encodeURIComponent(profileId)}`, {
|
|
213
|
+
method: 'PUT',
|
|
214
|
+
error: ProfileServiceErrorMessage.REPLACE_PROFILE_FAILED,
|
|
215
|
+
json: params,
|
|
216
|
+
}),
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Partially updates an existing profile (PATCH).
|
|
221
|
+
*
|
|
222
|
+
* @param profileId - The identifier of the profile to update.
|
|
223
|
+
* @param params - The fields to update.
|
|
224
|
+
* @returns The updated profile data.
|
|
225
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
226
|
+
* @throws {StructError} If the response do not match the expected shape.
|
|
227
|
+
*/
|
|
228
|
+
async updateProfile(profileId, params) {
|
|
229
|
+
return this.executeMutation({
|
|
230
|
+
mutationKey: [`${this.name}:updateProfile`, profileId],
|
|
231
|
+
responseStruct: ProfileApiResponseStruct,
|
|
232
|
+
mutationFn: async () => this.#fetch(`profiles/${encodeURIComponent(profileId)}`, {
|
|
233
|
+
method: 'PATCH',
|
|
234
|
+
error: ProfileServiceErrorMessage.UPDATE_PROFILE_FAILED,
|
|
235
|
+
json: params,
|
|
236
|
+
}),
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Deletes a profile by its identifier.
|
|
241
|
+
*
|
|
242
|
+
* @param profileId - The identifier of the profile to delete.
|
|
243
|
+
* @returns The result of the mutation.
|
|
244
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
245
|
+
*/
|
|
246
|
+
async deleteProfile(profileId) {
|
|
247
|
+
return this.executeMutation({
|
|
248
|
+
mutationKey: [`${this.name}:deleteProfile`, profileId],
|
|
249
|
+
mutationFn: async () => this.#fetch(`profiles/${encodeURIComponent(profileId)}`, {
|
|
250
|
+
method: 'DELETE',
|
|
251
|
+
error: ProfileServiceErrorMessage.DELETE_PROFILE_FAILED,
|
|
252
|
+
}),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Checks whether a username is available.
|
|
257
|
+
*
|
|
258
|
+
* @param username - The username to check.
|
|
259
|
+
* @returns Availability details including validity and normalized form.
|
|
260
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
261
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
262
|
+
*/
|
|
263
|
+
async checkUsernameAvailability(username) {
|
|
264
|
+
return this.fetchQuery({
|
|
265
|
+
queryKey: [`${this.name}:checkUsernameAvailability`, username],
|
|
266
|
+
staleTime: 0,
|
|
267
|
+
responseStruct: UsernameAvailabilityResponseStruct,
|
|
268
|
+
queryFn: async () => this.#fetch('profiles/username/availability', {
|
|
269
|
+
error: ProfileServiceErrorMessage.CHECK_USERNAME_AVAILABILITY_FAILED,
|
|
270
|
+
searchParams: { username },
|
|
271
|
+
}),
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Fetches the X OAuth PKCE authorization URL and its associated state parameter.
|
|
276
|
+
*
|
|
277
|
+
* @returns An object containing the authorization URL and the state token.
|
|
278
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
279
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
280
|
+
*/
|
|
281
|
+
async getXAuthUrl() {
|
|
282
|
+
return this.executeMutation({
|
|
283
|
+
mutationKey: [`${this.name}:getXAuthUrl`],
|
|
284
|
+
responseStruct: XAuthUrlResponseStruct,
|
|
285
|
+
mutationFn: async () => this.#fetch('profiles/x/authentication-url', {
|
|
286
|
+
error: ProfileServiceErrorMessage.GET_X_AUTH_URL_FAILED,
|
|
287
|
+
}),
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Completes the X OAuth PKCE flow and links the X account to the profile.
|
|
292
|
+
*
|
|
293
|
+
* @param params - The OAuth callback code and state from the X redirect.
|
|
294
|
+
* @returns The linked X account data.
|
|
295
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
296
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
297
|
+
*/
|
|
298
|
+
async connectX(params) {
|
|
299
|
+
return this.executeMutation({
|
|
300
|
+
mutationKey: [`${this.name}:connectX`],
|
|
301
|
+
responseStruct: XConnectResponseStruct,
|
|
302
|
+
mutationFn: async () => this.#fetch('profiles/x/connect', {
|
|
303
|
+
method: 'POST',
|
|
304
|
+
error: ProfileServiceErrorMessage.CONNECT_X_FAILED,
|
|
305
|
+
json: params,
|
|
306
|
+
}),
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Fetches the X account currently linked to the authenticated profile.
|
|
311
|
+
*
|
|
312
|
+
* @returns The linked X account data.
|
|
313
|
+
* @throws {HttpError} If the API returns a non-2xx response.
|
|
314
|
+
* @throws {StructError} If the response does not match the expected shape.
|
|
315
|
+
*/
|
|
316
|
+
async getXAccount() {
|
|
317
|
+
return this.fetchQuery({
|
|
318
|
+
queryKey: [`${this.name}:getXAccount`],
|
|
319
|
+
staleTime: 0,
|
|
320
|
+
responseStruct: XConnectResponseStruct,
|
|
321
|
+
queryFn: async () => this.#fetch('profiles/x/account', {
|
|
322
|
+
error: ProfileServiceErrorMessage.GET_X_ACCOUNT_FAILED,
|
|
323
|
+
}),
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=ProfileService.js.map
|