@textrp/briij-js-sdk 43.0.0 → 43.1.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +7 -4
  2. package/lib/@types/auth.d.ts +7 -5
  3. package/lib/@types/auth.d.ts.map +1 -1
  4. package/lib/@types/auth.js.map +1 -1
  5. package/lib/@types/event.d.ts +3 -32
  6. package/lib/@types/event.d.ts.map +1 -1
  7. package/lib/@types/event.js.map +1 -1
  8. package/lib/@types/synapse.d.ts +64 -0
  9. package/lib/@types/synapse.d.ts.map +1 -1
  10. package/lib/@types/synapse.js.map +1 -1
  11. package/lib/briij.d.ts +1 -0
  12. package/lib/briij.d.ts.map +1 -1
  13. package/lib/briij.js +1 -0
  14. package/lib/briij.js.map +1 -1
  15. package/lib/client.d.ts +64 -1
  16. package/lib/client.d.ts.map +1 -1
  17. package/lib/client.js +360 -195
  18. package/lib/client.js.map +1 -1
  19. package/lib/wallet-recovery.d.ts +1 -1
  20. package/lib/wallet-recovery.d.ts.map +1 -1
  21. package/lib/wallet-recovery.js +32 -8
  22. package/lib/wallet-recovery.js.map +1 -1
  23. package/lib/xrpl/identity.d.ts +2 -1
  24. package/lib/xrpl/identity.d.ts.map +1 -1
  25. package/lib/xrpl/identity.js +70 -47
  26. package/lib/xrpl/identity.js.map +1 -1
  27. package/lib/xrpl/trust.d.ts +4 -2
  28. package/lib/xrpl/trust.d.ts.map +1 -1
  29. package/lib/xrpl/trust.js +31 -19
  30. package/lib/xrpl/trust.js.map +1 -1
  31. package/lib/xrpl/verification.js +17 -6
  32. package/lib/xrpl/verification.js.map +1 -1
  33. package/package.json +127 -129
  34. package/src/@types/auth.ts +6 -7
  35. package/src/@types/event.ts +3 -32
  36. package/src/@types/synapse.ts +77 -0
  37. package/src/briij.ts +1 -0
  38. package/src/client.ts +241 -36
  39. package/src/wallet-recovery.ts +101 -26
  40. package/src/xrpl/identity.ts +66 -39
  41. package/src/xrpl/trust.ts +35 -18
  42. package/src/xrpl/verification.ts +19 -6
@@ -65,6 +65,7 @@ import { type LocalNotificationSettings } from "./local_notifications.ts";
65
65
  import { type IPushRules } from "./PushRules.ts";
66
66
  import { type SecretInfo, type SecretStorageKeyDescription } from "../secret-storage.ts";
67
67
  import { type POLICIES_ACCOUNT_EVENT_TYPE } from "../models/invites-ignorer-types.ts";
68
+ import { type WalletE2eeRecoveryEnvelope, type WalletIdentityAccountData } from "./auth.ts";
68
69
 
69
70
  export enum EventType {
70
71
  // Room state events
@@ -455,38 +456,8 @@ export interface AccountDataEvents extends SecretStorageAccountDataEvents {
455
456
  [POLICIES_ACCOUNT_EVENT_TYPE.altName]: { [key: string]: any };
456
457
 
457
458
  [EventType.InvitePermissionConfig]: { default_action?: string };
458
- "org.textrp.wallet.e2ee_recovery.v1": {
459
- envelope_version: number;
460
- chain_id: string;
461
- account_id: string;
462
- created_at_ms: number;
463
- key_id: string;
464
- wallet_wrap: {
465
- alg: string;
466
- kdf: string;
467
- salt: string;
468
- nonce: string;
469
- ciphertext: string;
470
- aad?: string;
471
- params?: Record<string, unknown>;
472
- };
473
- password_wrap: {
474
- alg: string;
475
- kdf: string;
476
- salt: string;
477
- nonce: string;
478
- ciphertext: string;
479
- aad?: string;
480
- params?: Record<string, unknown>;
481
- };
482
- };
483
- "org.textrp.wallet.identity": {
484
- chain_id: string;
485
- account_id: string;
486
- public_key: string | null;
487
- network?: string | null;
488
- key_type?: string | null;
489
- };
459
+ "org.textrp.wallet.e2ee_recovery.v1": WalletE2eeRecoveryEnvelope;
460
+ "org.textrp.wallet.identity": WalletIdentityAccountData;
490
461
  }
491
462
 
492
463
  /**
@@ -37,4 +37,81 @@ export interface ISynapseAdminWhoisResponse {
37
37
  export interface ISynapseAdminDeactivateResponse {
38
38
  id_server_unbind_result: IdServerUnbindResult;
39
39
  }
40
+
41
+ export interface IBriijPremiumFeature {
42
+ feature_id: number;
43
+ feature_key: string;
44
+ name: string;
45
+ description: string | null;
46
+ mcredits_cost: number;
47
+ category: string | null;
48
+ is_active: boolean;
49
+ created_ts: number;
50
+ }
51
+
52
+ export interface IBriijMcreditsFeature {
53
+ feature_key: string;
54
+ name: string;
55
+ description: string | null;
56
+ mcredits_cost: number;
57
+ category: string | null;
58
+ is_active: boolean;
59
+ }
60
+
61
+ export interface IBriijMcreditsFeaturesResponse {
62
+ features: IBriijMcreditsFeature[];
63
+ }
64
+
65
+ export interface IBriijMcreditsBalanceResponse {
66
+ balance: number;
67
+ }
68
+
69
+ export interface IBriijMcreditsSpendResponse {
70
+ feature_key: string;
71
+ balance: number;
72
+ }
73
+
74
+ export interface IBriijLegacyMyAddressUserCredit {
75
+ balance?: string;
76
+ }
77
+
78
+ export interface IBriijLegacyMyAddressUser {
79
+ address?: string;
80
+ discount?: Record<string, unknown>;
81
+ subscriptions?: unknown[];
82
+ credit?: IBriijLegacyMyAddressUserCredit;
83
+ }
84
+
85
+ export interface IBriijLegacyMyAddressResponse {
86
+ user: IBriijLegacyMyAddressUser;
87
+ address: string;
88
+ }
89
+
90
+ export interface IBriijLegacyEnabledFeature {
91
+ feature: string;
92
+ [key: string]: unknown;
93
+ }
94
+
95
+ export interface IBriijLegacyEnabledFeaturesResponse {
96
+ nfts?: IBriijLegacyEnabledFeature[];
97
+ [key: string]: unknown;
98
+ }
99
+
100
+ export interface IBriijAdminPremiumFeaturesResponse {
101
+ premium_features: IBriijPremiumFeature[];
102
+ }
103
+
104
+ export interface IBriijAdminCreatePremiumFeatureRequest {
105
+ feature_key: string;
106
+ name: string;
107
+ description?: string | null;
108
+ mcredits_cost: number;
109
+ category?: string | null;
110
+ }
111
+
112
+ export interface IBriijAdminUpdatePremiumFeatureRequest {
113
+ mcredits_cost?: number;
114
+ description?: string | null;
115
+ is_active?: boolean;
116
+ }
40
117
  /* eslint-enable camelcase */
package/src/briij.ts CHANGED
@@ -74,6 +74,7 @@ export * from "./@types/topic.ts";
74
74
  export * from "./@types/location.ts";
75
75
  export * from "./@types/threepids.ts";
76
76
  export * from "./@types/auth.ts";
77
+ export * from "./@types/synapse.ts";
77
78
  export * from "./@types/polls.ts";
78
79
  export type * from "./@types/local_notifications.ts";
79
80
  export type * from "./@types/registration.ts";
package/src/client.ts CHANGED
@@ -170,7 +170,19 @@ import {
170
170
  type IStateEventWithRoomId,
171
171
  SearchOrderBy,
172
172
  } from "./@types/search.ts";
173
- import { type ISynapseAdminDeactivateResponse, type ISynapseAdminWhoisResponse } from "./@types/synapse.ts";
173
+ import {
174
+ type IBriijAdminCreatePremiumFeatureRequest,
175
+ type IBriijAdminPremiumFeaturesResponse,
176
+ type IBriijAdminUpdatePremiumFeatureRequest,
177
+ type IBriijLegacyEnabledFeaturesResponse,
178
+ type IBriijLegacyMyAddressResponse,
179
+ type IBriijMcreditsBalanceResponse,
180
+ type IBriijMcreditsFeaturesResponse,
181
+ type IBriijMcreditsSpendResponse,
182
+ type IBriijPremiumFeature,
183
+ type ISynapseAdminDeactivateResponse,
184
+ type ISynapseAdminWhoisResponse,
185
+ } from "./@types/synapse.ts";
174
186
  import { type IHierarchyRoom } from "./@types/spaces.ts";
175
187
  import {
176
188
  type IPusher,
@@ -255,13 +267,14 @@ import {
255
267
  type OidcClientConfig,
256
268
  validateAuthMetadataAndKeys,
257
269
  } from "./oidc/index.ts";
258
- import { configureXrplIdentityMinting, mintSoulboundIdentityNFT } from "./xrpl/identity.ts";
259
270
  import {
260
- XRPL_VERIFIED_EVENT,
261
- XRPL_VERIFY_ACCEPT_EVENT,
262
- XRPL_VERIFY_REQUEST_EVENT,
263
- } from "./xrpl/verification.ts";
264
- import { configureXrplTrust } from "./xrpl/trust.ts";
271
+ getConfiguredXrplIdentityMintingConfig,
272
+ mintSoulboundIdentityNFT,
273
+ type XamanWalletAdapter,
274
+ type XrplIdentityMintingConfig,
275
+ } from "./xrpl/identity.ts";
276
+ import { XRPL_VERIFIED_EVENT, XRPL_VERIFY_ACCEPT_EVENT, XRPL_VERIFY_REQUEST_EVENT } from "./xrpl/verification.ts";
277
+ import { type XrplTrustConfig } from "./xrpl/trust.ts";
265
278
  import { type EmptyObject } from "./@types/common.ts";
266
279
  import { UnsupportedDelayedEventsEndpointError, UnsupportedStickyEventsEndpointError } from "./errors.ts";
267
280
  import { type Transport } from "./matrixrtc/index.ts";
@@ -478,6 +491,17 @@ export interface ICreateClientOpts {
478
491
  * Defaults to the built-in global logger; see {@link DebugLogger} for an alternative.
479
492
  */
480
493
  logger?: Logger;
494
+
495
+ /**
496
+ * Optional per-client XRPL trust configuration.
497
+ */
498
+ xrplTrust?: Partial<XrplTrustConfig>;
499
+
500
+ /**
501
+ * Optional per-client XRPL identity minting configuration.
502
+ */
503
+ xrplIdentityMinting?: Partial<Omit<XrplIdentityMintingConfig, "homeserverBaseUrl" | "accessToken">>;
504
+ xamanWallet?: XamanWalletAdapter;
481
505
  }
482
506
 
483
507
  export interface IBriijClientCreateOpts extends ICreateClientOpts {
@@ -1298,6 +1322,9 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
1298
1322
  protected clientOpts?: IStoredClientOpts;
1299
1323
  protected clientWellKnownIntervalID?: ReturnType<typeof setInterval>;
1300
1324
  protected canResetTimelineCallback?: ResetTimelineCallback;
1325
+ private xrplTrustConfig?: XrplTrustConfig;
1326
+ private xrplIdentityMintingConfig: Partial<Omit<XrplIdentityMintingConfig, "homeserverBaseUrl" | "accessToken">> =
1327
+ {};
1301
1328
 
1302
1329
  public canSupport = new Map<Feature, ServerSupport>();
1303
1330
 
@@ -1358,6 +1385,17 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
1358
1385
 
1359
1386
  const userId = opts.userId || null;
1360
1387
  this.credentials = { userId };
1388
+ if (opts.xrplTrust) {
1389
+ this.xrplTrustConfig = {
1390
+ homeserverBaseUrl: opts.xrplTrust.homeserverBaseUrl ?? this.baseUrl,
1391
+ accessToken: opts.xrplTrust.accessToken ?? opts.accessToken ?? "",
1392
+ trustPath: opts.xrplTrust.trustPath,
1393
+ };
1394
+ }
1395
+ this.xrplIdentityMintingConfig = {
1396
+ ...(opts.xrplIdentityMinting ?? {}),
1397
+ ...(opts.xamanWallet ? { xamanWallet: opts.xamanWallet } : {}),
1398
+ };
1361
1399
 
1362
1400
  this.http = new BriijHttpApi(this as ConstructorParameters<typeof BriijHttpApi>[0], {
1363
1401
  fetchFn: opts.fetchFn,
@@ -6063,6 +6101,41 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6063
6101
  return this.fallbackICEServerAllowed;
6064
6102
  }
6065
6103
 
6104
+ /**
6105
+ * Some briij deployments mount admin resources under `/_briij/admin` while
6106
+ * Synapse defaults to `/_synapse/admin`. Try both prefixes to stay compatible.
6107
+ */
6108
+ private async authedRequestWithAdminPrefixes<T>(
6109
+ method: Method,
6110
+ adminSubPath: string,
6111
+ queryParams?: QueryDict,
6112
+ body?: Body,
6113
+ ): Promise<T> {
6114
+ const normalizedSubPath = adminSubPath.replace(/^\/+/, "");
6115
+ const adminPrefixes = ["/_synapse/admin", "/_briij/admin"];
6116
+ let lastError: unknown;
6117
+
6118
+ for (const adminPrefix of adminPrefixes) {
6119
+ try {
6120
+ return await this.http.authedRequest<T>(
6121
+ method,
6122
+ `${adminPrefix}/${normalizedSubPath}`,
6123
+ queryParams,
6124
+ body,
6125
+ { prefix: "" },
6126
+ );
6127
+ } catch (error) {
6128
+ if (error instanceof BriijError && error.httpStatus === 404) {
6129
+ lastError = error;
6130
+ continue;
6131
+ }
6132
+ throw error;
6133
+ }
6134
+ }
6135
+
6136
+ throw lastError ?? new Error("Admin API endpoint not found");
6137
+ }
6138
+
6066
6139
  /**
6067
6140
  * Determines if the current user is an administrator of the Synapse homeserver.
6068
6141
  * Returns false if untrue or the homeserver does not appear to be a Synapse
@@ -6070,11 +6143,20 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6070
6143
  * as a result.</strong>
6071
6144
  * @returns true if the user appears to be a Synapse administrator.
6072
6145
  */
6073
- public isSynapseAdministrator(): Promise<boolean> {
6074
- const path = utils.encodeUri("/_synapse/admin/v1/users/$userId/admin", { $userId: this.getUserId()! });
6075
- return this.http
6076
- .authedRequest<{ admin: boolean }>(Method.Get, path, undefined, undefined, { prefix: "" })
6077
- .then((r) => r.admin); // pull out the specific boolean we want
6146
+ public async isSynapseAdministrator(): Promise<boolean> {
6147
+ const adminSubPath = utils.encodeUri("v1/users/$userId/admin", { $userId: this.getUserId()! });
6148
+ try {
6149
+ const response = await this.authedRequestWithAdminPrefixes<{ admin: boolean }>(Method.Get, adminSubPath);
6150
+ return response.admin;
6151
+ } catch (error) {
6152
+ if (error instanceof BriijError && error.httpStatus === 404) {
6153
+ return false;
6154
+ }
6155
+ if (error instanceof Error && /Admin API endpoint not found/i.test(error.message)) {
6156
+ return false;
6157
+ }
6158
+ throw error;
6159
+ }
6078
6160
  }
6079
6161
 
6080
6162
  /**
@@ -6085,8 +6167,8 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6085
6167
  * @returns the whois response - see Synapse docs for information.
6086
6168
  */
6087
6169
  public whoisSynapseUser(userId: string): Promise<ISynapseAdminWhoisResponse> {
6088
- const path = utils.encodeUri("/_synapse/admin/v1/whois/$userId", { $userId: userId });
6089
- return this.http.authedRequest(Method.Get, path, undefined, undefined, { prefix: "" });
6170
+ const adminSubPath = utils.encodeUri("v1/whois/$userId", { $userId: userId });
6171
+ return this.authedRequestWithAdminPrefixes(Method.Get, adminSubPath);
6090
6172
  }
6091
6173
 
6092
6174
  /**
@@ -6096,8 +6178,117 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6096
6178
  * @returns the deactivate response - see Synapse docs for information.
6097
6179
  */
6098
6180
  public deactivateSynapseUser(userId: string): Promise<ISynapseAdminDeactivateResponse> {
6099
- const path = utils.encodeUri("/_synapse/admin/v1/deactivate/$userId", { $userId: userId });
6100
- return this.http.authedRequest(Method.Post, path, undefined, undefined, { prefix: "" });
6181
+ const adminSubPath = utils.encodeUri("v1/deactivate/$userId", { $userId: userId });
6182
+ return this.authedRequestWithAdminPrefixes(Method.Post, adminSubPath);
6183
+ }
6184
+
6185
+ /**
6186
+ * Lists active mCredits features for the authenticated user.
6187
+ */
6188
+ public getBriijMcreditsFeatures(): Promise<IBriijMcreditsFeaturesResponse> {
6189
+ return this.http.authedRequest(Method.Get, "/mcredits/features", undefined, undefined, {
6190
+ prefix: ClientPrefix.V3,
6191
+ });
6192
+ }
6193
+
6194
+ /**
6195
+ * Retrieves the authenticated user's mCredits balance.
6196
+ */
6197
+ public getBriijMcreditsBalance(): Promise<IBriijMcreditsBalanceResponse> {
6198
+ return this.http.authedRequest(Method.Get, "/mcredits/balance", undefined, undefined, {
6199
+ prefix: ClientPrefix.V3,
6200
+ });
6201
+ }
6202
+
6203
+ /**
6204
+ * Spends mCredits for a premium feature.
6205
+ * @param featureKey - The premium feature identifier to spend against.
6206
+ */
6207
+ public spendBriijMcredits(featureKey: string): Promise<IBriijMcreditsSpendResponse> {
6208
+ return this.http.authedRequest(
6209
+ Method.Post,
6210
+ "/mcredits/spend",
6211
+ undefined,
6212
+ { feature_key: featureKey },
6213
+ {
6214
+ prefix: ClientPrefix.V3,
6215
+ },
6216
+ );
6217
+ }
6218
+
6219
+ /**
6220
+ * Calls Briij's legacy-compatible endpoint to resolve a Matrix user to wallet/mcredit payload.
6221
+ * @param matrixUserId - Matrix user ID used by legacy clients.
6222
+ */
6223
+ public getBriijLegacyMyAddress(matrixUserId: string): Promise<IBriijLegacyMyAddressResponse> {
6224
+ return this.http.authedRequest(
6225
+ Method.Post,
6226
+ "/my-address",
6227
+ undefined,
6228
+ { address: matrixUserId },
6229
+ { prefix: "" },
6230
+ );
6231
+ }
6232
+
6233
+ /**
6234
+ * Calls Briij's legacy-compatible enabled-features endpoint.
6235
+ * @param walletAddress - XRPL wallet address.
6236
+ * @param network - Legacy network segment; defaults to `main`.
6237
+ */
6238
+ public getBriijLegacyEnabledFeatures(
6239
+ walletAddress: string,
6240
+ network = "main",
6241
+ ): Promise<IBriijLegacyEnabledFeaturesResponse> {
6242
+ const path = utils.encodeUri("/my-features/$walletAddress/$network/enabled", {
6243
+ $walletAddress: walletAddress,
6244
+ $network: network,
6245
+ });
6246
+ return this.http.authedRequest(Method.Get, path, undefined, undefined, { prefix: "" });
6247
+ }
6248
+
6249
+ /**
6250
+ * Lists mCredits premium features from Synapse admin APIs.
6251
+ */
6252
+ public async getBriijAdminPremiumFeatures(): Promise<IBriijPremiumFeature[]> {
6253
+ const response = await this.authedRequestWithAdminPrefixes<IBriijAdminPremiumFeaturesResponse>(
6254
+ Method.Get,
6255
+ "v2/briij/premium_features",
6256
+ );
6257
+ return response.premium_features;
6258
+ }
6259
+
6260
+ /**
6261
+ * Creates an mCredits premium feature via Synapse admin APIs.
6262
+ * @param body - Feature fields to create.
6263
+ */
6264
+ public createBriijAdminPremiumFeature(body: IBriijAdminCreatePremiumFeatureRequest): Promise<IBriijPremiumFeature> {
6265
+ return this.authedRequestWithAdminPrefixes(Method.Post, "v2/briij/premium_features", undefined, body);
6266
+ }
6267
+
6268
+ /**
6269
+ * Updates an mCredits premium feature via Synapse admin APIs.
6270
+ * @param featureKey - The premium feature key to update.
6271
+ * @param body - Updatable feature fields.
6272
+ */
6273
+ public updateBriijAdminPremiumFeature(
6274
+ featureKey: string,
6275
+ body: IBriijAdminUpdatePremiumFeatureRequest,
6276
+ ): Promise<IBriijPremiumFeature> {
6277
+ const adminSubPath = utils.encodeUri("v2/briij/premium_features/$featureKey", {
6278
+ $featureKey: featureKey,
6279
+ });
6280
+ return this.authedRequestWithAdminPrefixes(Method.Put, adminSubPath, undefined, body);
6281
+ }
6282
+
6283
+ /**
6284
+ * Soft-deactivates an mCredits premium feature via Synapse admin APIs.
6285
+ * @param featureKey - The premium feature key to deactivate.
6286
+ */
6287
+ public deactivateBriijAdminPremiumFeature(featureKey: string): Promise<IBriijPremiumFeature> {
6288
+ const adminSubPath = utils.encodeUri("v2/briij/premium_features/$featureKey", {
6289
+ $featureKey: featureKey,
6290
+ });
6291
+ return this.authedRequestWithAdminPrefixes(Method.Delete, adminSubPath);
6101
6292
  }
6102
6293
 
6103
6294
  protected async fetchClientWellKnown(): Promise<void> {
@@ -6687,32 +6878,44 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6687
6878
  type: loginType,
6688
6879
  });
6689
6880
 
6690
- if (response.access_token && response.user_id) {
6691
- this.http.opts.accessToken = response.access_token;
6692
- this.credentials = {
6693
- userId: response.user_id,
6694
- };
6695
- configureXrplTrust({
6696
- homeserverBaseUrl: this.baseUrl,
6697
- accessToken: response.access_token,
6698
- });
6881
+ await this.applyLoginResponse(response, loginType);
6882
+
6883
+ return response;
6884
+ }
6885
+
6886
+ private async applyLoginResponse(response: LoginResponse, loginType?: LoginRequest["type"]): Promise<void> {
6887
+ if (!response.access_token || !response.user_id) {
6888
+ return;
6699
6889
  }
6700
6890
 
6891
+ this.http.opts.accessToken = response.access_token;
6892
+ this.credentials = {
6893
+ userId: response.user_id,
6894
+ };
6895
+ this.deviceId = response.device_id ?? this.deviceId;
6896
+ this.xrplTrustConfig = {
6897
+ homeserverBaseUrl: this.baseUrl,
6898
+ accessToken: response.access_token,
6899
+ trustPath: this.xrplTrustConfig?.trustPath,
6900
+ };
6901
+
6701
6902
  // After Xaman-backed SSO login, mint once and persist identity metadata in account_data.
6702
- if (loginType === "m.login.token" && response.access_token && response.user_id) {
6703
- configureXrplIdentityMinting({
6704
- homeserverBaseUrl: this.baseUrl,
6705
- accessToken: response.access_token,
6706
- });
6903
+ if (loginType === "m.login.token") {
6904
+ const fallbackMintingConfig = getConfiguredXrplIdentityMintingConfig();
6905
+ const xamanWallet = this.xrplIdentityMintingConfig.xamanWallet ?? fallbackMintingConfig.xamanWallet;
6707
6906
 
6708
6907
  try {
6709
- await mintSoulboundIdentityNFT(response.user_id);
6908
+ await mintSoulboundIdentityNFT(response.user_id, {
6909
+ ...fallbackMintingConfig,
6910
+ ...this.xrplIdentityMintingConfig,
6911
+ homeserverBaseUrl: this.baseUrl,
6912
+ accessToken: response.access_token,
6913
+ xamanWallet,
6914
+ });
6710
6915
  } catch (error) {
6711
6916
  logger.warn("XRPL identity NFT minting skipped/failed", error);
6712
6917
  }
6713
6918
  }
6714
-
6715
- return response;
6716
6919
  }
6717
6920
 
6718
6921
  /**
@@ -6781,8 +6984,8 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6781
6984
  *
6782
6985
  * @param envelope - Wallet recovery envelope payload.
6783
6986
  */
6784
- public setWalletRecoveryEnvelope(envelope: WalletE2eeRecoveryEnvelope): Promise<EmptyObject> {
6785
- return this.setAccountDataRaw(WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE, envelope);
6987
+ public async setWalletRecoveryEnvelope(envelope: WalletE2eeRecoveryEnvelope): Promise<EmptyObject> {
6988
+ return await this.setAccountData(WALLET_E2EE_RECOVERY_ACCOUNT_DATA_TYPE, envelope);
6786
6989
  }
6787
6990
 
6788
6991
  /**
@@ -6831,7 +7034,7 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6831
7034
  throw new Error("XRPL challenge payload is missing session; call getXrplAuthChallenge first");
6832
7035
  }
6833
7036
 
6834
- return this.completeXrplAuth({
7037
+ const response = await this.completeXrplAuth({
6835
7038
  user,
6836
7039
  identifier: {
6837
7040
  type: "m.id.user",
@@ -6843,6 +7046,8 @@ export class BriijClient extends TypedEventEmitter<EmittedEvents, ClientEventHan
6843
7046
  public_key: parsedChallenge?.public_key,
6844
7047
  network,
6845
7048
  });
7049
+ await this.applyLoginResponse(response, XRPL_WALLET_LOGIN_TYPE);
7050
+ return response;
6846
7051
  }
6847
7052
 
6848
7053
  /**