@dynamic-labs-sdk/client 0.0.1-alpha.6 → 0.0.1-alpha.7

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 (54) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/getWalletProviderFromWalletAccount.cjs.js +94 -59
  3. package/getWalletProviderFromWalletAccount.esm.js +94 -60
  4. package/index.cjs.js +154 -19
  5. package/index.esm.js +151 -22
  6. package/package.json +2 -2
  7. package/src/errors/APIError/APIError.d.ts +7 -0
  8. package/src/errors/APIError/APIError.d.ts.map +1 -0
  9. package/src/errors/APIError/index.d.ts +2 -0
  10. package/src/errors/APIError/index.d.ts.map +1 -0
  11. package/src/exports/index.d.ts +8 -0
  12. package/src/exports/index.d.ts.map +1 -1
  13. package/src/modules/apiClient/createApiClient.d.ts.map +1 -1
  14. package/src/modules/apiClient/middleware/convertToApiErrorMiddleware.d.ts +3 -0
  15. package/src/modules/apiClient/middleware/convertToApiErrorMiddleware.d.ts.map +1 -0
  16. package/src/modules/auth/passkeys/errors/NoPasskeyCredentialsFoundError.d.ts +5 -0
  17. package/src/modules/auth/passkeys/errors/NoPasskeyCredentialsFoundError.d.ts.map +1 -0
  18. package/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.d.ts +4 -0
  19. package/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.d.ts.map +1 -0
  20. package/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/index.d.ts +4 -0
  21. package/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/index.d.ts.map +1 -0
  22. package/src/modules/auth/passkeys/serverAuthenticatePasskey/index.d.ts +2 -0
  23. package/src/modules/auth/passkeys/serverAuthenticatePasskey/index.d.ts.map +1 -0
  24. package/src/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.d.ts +5 -0
  25. package/src/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.d.ts.map +1 -0
  26. package/src/modules/mfa/authMfaRecoveryCode/authMfaRecoveryCode.d.ts +4 -1
  27. package/src/modules/mfa/authMfaRecoveryCode/authMfaRecoveryCode.d.ts.map +1 -1
  28. package/src/modules/mfa/authTotpMfaDevice/authTotpMfaDevice.d.ts +7 -2
  29. package/src/modules/mfa/authTotpMfaDevice/authTotpMfaDevice.d.ts.map +1 -1
  30. package/src/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts +6 -0
  31. package/src/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts.map +1 -0
  32. package/src/modules/mfa/authenticatePasskeyMFA/index.d.ts +2 -0
  33. package/src/modules/mfa/authenticatePasskeyMFA/index.d.ts.map +1 -0
  34. package/src/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts +4 -1
  35. package/src/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts.map +1 -1
  36. package/src/modules/mfa/errors/MfaInvalidOtpError.d.ts +6 -0
  37. package/src/modules/mfa/errors/MfaInvalidOtpError.d.ts.map +1 -0
  38. package/src/modules/mfa/errors/MfaRateLimitedError.d.ts +6 -0
  39. package/src/modules/mfa/errors/MfaRateLimitedError.d.ts.map +1 -0
  40. package/src/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.d.ts +4 -1
  41. package/src/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.d.ts.map +1 -1
  42. package/src/modules/mfa/isPendingRecoveryCodesAcknowledgment/index.d.ts +2 -0
  43. package/src/modules/mfa/isPendingRecoveryCodesAcknowledgment/index.d.ts.map +1 -0
  44. package/src/modules/mfa/isPendingRecoveryCodesAcknowledgment/isPendingRecoveryCodesAcknowledgment.d.ts +3 -0
  45. package/src/modules/mfa/isPendingRecoveryCodesAcknowledgment/isPendingRecoveryCodesAcknowledgment.d.ts.map +1 -0
  46. package/src/modules/mfa/isUserMissingMfaAuth/index.d.ts +2 -0
  47. package/src/modules/mfa/isUserMissingMfaAuth/index.d.ts.map +1 -0
  48. package/src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.d.ts +3 -0
  49. package/src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.d.ts.map +1 -0
  50. package/src/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts.map +1 -1
  51. package/src/modules/mfa/utils/mapMfaErrorsAndThrow/index.d.ts +2 -0
  52. package/src/modules/mfa/utils/mapMfaErrorsAndThrow/index.d.ts.map +1 -0
  53. package/src/modules/mfa/utils/mapMfaErrorsAndThrow/mapMfaErrorsAndThrow.d.ts +2 -0
  54. package/src/modules/mfa/utils/mapMfaErrorsAndThrow/mapMfaErrorsAndThrow.d.ts.map +1 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.0.1-alpha.7 (2025-07-02)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **mfa:** make device id optional ([#175](https://github.com/dynamic-labs/dynamic-sdk/pull/175))
6
+ - **mfa:** allow create mfa options to authTotpMfaDevice ([#178](https://github.com/dynamic-labs/dynamic-sdk/pull/178))
7
+
1
8
  ## 0.0.1-alpha.6 (2025-06-30)
2
9
 
3
10
  ### 🚀 Features
@@ -70,66 +70,9 @@ function _extends() {
70
70
  return _extends.apply(this, arguments);
71
71
  }
72
72
 
73
- var version = "0.0.1-alpha.6";
73
+ var version = "0.0.1-alpha.7";
74
74
  var dependencies = {
75
- "@dynamic-labs/sdk-api-core": "0.0.691"};
76
-
77
- /**
78
- * Returns a new instance of the SDK API client.
79
- *
80
- * This is not meant for storing, as it is very light we can create it whenever needed.
81
- */ const createApiClient = (client)=>{
82
- const core = getCore(client);
83
- const settings = {
84
- basePath: core.apiBaseUrl,
85
- headers: {
86
- 'Content-Type': 'application/json',
87
- 'x-dyn-api-version': dependencies['@dynamic-labs/sdk-api-core'],
88
- 'x-dyn-version': core.version
89
- }
90
- };
91
- if (client.token) {
92
- settings.headers.Authorization = `Bearer ${client.token}`;
93
- }
94
- return new sdkApiCore.SDKApi(new sdkApiCore.Configuration(_extends({}, settings, {
95
- fetchApi: core.fetch
96
- })));
97
- };
98
-
99
- /**
100
- * Listen to an event from the client.
101
- *
102
- * @returns A function that can be called to remove the listener.
103
- */ const onEvent = (client, event, listener)=>{
104
- const { eventEmitter } = getCore(client);
105
- eventEmitter.on(event, listener);
106
- return ()=>{
107
- eventEmitter.off(event, listener);
108
- };
109
- };
110
- /**
111
- * Remove a listener from an event.
112
- */ const offEvent = (client, event, listener)=>{
113
- const { eventEmitter } = getCore(client);
114
- eventEmitter.off(event, listener);
115
- };
116
- /**
117
- * Listen to an event that will only fire once.
118
- *
119
- * @returns A function that can be called to remove the listener.
120
- */ const onceEvent = (client, event, listener)=>{
121
- const { eventEmitter } = getCore(client);
122
- eventEmitter.once(event, listener);
123
- return ()=>{
124
- eventEmitter.off(event, listener);
125
- };
126
- };
127
- /**
128
- * Emit an event.
129
- */ const emitEvent = (client, event, ...args)=>{
130
- const { eventEmitter } = getCore(client);
131
- eventEmitter.emit(event, ...args);
132
- };
75
+ "@dynamic-labs/sdk-api-core": "0.0.702"};
133
76
 
134
77
  const getDetails = ({ details, cause })=>{
135
78
  if (cause instanceof BaseError) {
@@ -188,6 +131,97 @@ const getDetails = ({ details, cause })=>{
188
131
  }
189
132
  }
190
133
 
134
+ class APIError extends BaseError {
135
+ static async fromResponse(response) {
136
+ const errorBody = await response.json();
137
+ if ('code' in errorBody && typeof errorBody.code === 'string' && 'error' in errorBody && typeof errorBody.error === 'string') {
138
+ return new APIError(errorBody.error, errorBody.code);
139
+ }
140
+ return null;
141
+ }
142
+ constructor(message, code){
143
+ super({
144
+ cause: null,
145
+ docsUrl: null,
146
+ name: 'APIError',
147
+ shortMessage: message
148
+ });
149
+ this.code = code;
150
+ }
151
+ }
152
+
153
+ const convertToApiErrorMiddleware = {
154
+ post: async (context)=>{
155
+ if (context.response.status >= 400) {
156
+ const apiError = await APIError.fromResponse(context.response);
157
+ if (apiError) {
158
+ throw apiError;
159
+ }
160
+ }
161
+ return context.response;
162
+ }
163
+ };
164
+
165
+ /**
166
+ * Returns a new instance of the SDK API client.
167
+ *
168
+ * This is not meant for storing, as it is very light we can create it whenever needed.
169
+ */ const createApiClient = (client)=>{
170
+ const core = getCore(client);
171
+ const settings = {
172
+ basePath: core.apiBaseUrl,
173
+ headers: {
174
+ 'Content-Type': 'application/json',
175
+ 'x-dyn-api-version': dependencies['@dynamic-labs/sdk-api-core'],
176
+ 'x-dyn-version': core.version
177
+ }
178
+ };
179
+ if (client.token) {
180
+ settings.headers.Authorization = `Bearer ${client.token}`;
181
+ }
182
+ return new sdkApiCore.SDKApi(new sdkApiCore.Configuration(_extends({}, settings, {
183
+ fetchApi: core.fetch,
184
+ middleware: [
185
+ convertToApiErrorMiddleware
186
+ ]
187
+ })));
188
+ };
189
+
190
+ /**
191
+ * Listen to an event from the client.
192
+ *
193
+ * @returns A function that can be called to remove the listener.
194
+ */ const onEvent = (client, event, listener)=>{
195
+ const { eventEmitter } = getCore(client);
196
+ eventEmitter.on(event, listener);
197
+ return ()=>{
198
+ eventEmitter.off(event, listener);
199
+ };
200
+ };
201
+ /**
202
+ * Remove a listener from an event.
203
+ */ const offEvent = (client, event, listener)=>{
204
+ const { eventEmitter } = getCore(client);
205
+ eventEmitter.off(event, listener);
206
+ };
207
+ /**
208
+ * Listen to an event that will only fire once.
209
+ *
210
+ * @returns A function that can be called to remove the listener.
211
+ */ const onceEvent = (client, event, listener)=>{
212
+ const { eventEmitter } = getCore(client);
213
+ eventEmitter.once(event, listener);
214
+ return ()=>{
215
+ eventEmitter.off(event, listener);
216
+ };
217
+ };
218
+ /**
219
+ * Emit an event.
220
+ */ const emitEvent = (client, event, ...args)=>{
221
+ const { eventEmitter } = getCore(client);
222
+ eventEmitter.emit(event, ...args);
223
+ };
224
+
191
225
  class ValueMustBeDefinedError extends BaseError {
192
226
  constructor(message){
193
227
  super({
@@ -414,6 +448,7 @@ const getWalletProviderFromWalletAccount = (walletAccount)=>{
414
448
  return walletProvider;
415
449
  };
416
450
 
451
+ exports.APIError = APIError;
417
452
  exports.BaseError = BaseError;
418
453
  exports.CannotTrackError = CannotTrackError;
419
454
  exports.ClientNotPresentError = ClientNotPresentError;
@@ -68,66 +68,9 @@ function _extends() {
68
68
  return _extends.apply(this, arguments);
69
69
  }
70
70
 
71
- var version = "0.0.1-alpha.6";
71
+ var version = "0.0.1-alpha.7";
72
72
  var dependencies = {
73
- "@dynamic-labs/sdk-api-core": "0.0.691"};
74
-
75
- /**
76
- * Returns a new instance of the SDK API client.
77
- *
78
- * This is not meant for storing, as it is very light we can create it whenever needed.
79
- */ const createApiClient = (client)=>{
80
- const core = getCore(client);
81
- const settings = {
82
- basePath: core.apiBaseUrl,
83
- headers: {
84
- 'Content-Type': 'application/json',
85
- 'x-dyn-api-version': dependencies['@dynamic-labs/sdk-api-core'],
86
- 'x-dyn-version': core.version
87
- }
88
- };
89
- if (client.token) {
90
- settings.headers.Authorization = `Bearer ${client.token}`;
91
- }
92
- return new SDKApi(new Configuration(_extends({}, settings, {
93
- fetchApi: core.fetch
94
- })));
95
- };
96
-
97
- /**
98
- * Listen to an event from the client.
99
- *
100
- * @returns A function that can be called to remove the listener.
101
- */ const onEvent = (client, event, listener)=>{
102
- const { eventEmitter } = getCore(client);
103
- eventEmitter.on(event, listener);
104
- return ()=>{
105
- eventEmitter.off(event, listener);
106
- };
107
- };
108
- /**
109
- * Remove a listener from an event.
110
- */ const offEvent = (client, event, listener)=>{
111
- const { eventEmitter } = getCore(client);
112
- eventEmitter.off(event, listener);
113
- };
114
- /**
115
- * Listen to an event that will only fire once.
116
- *
117
- * @returns A function that can be called to remove the listener.
118
- */ const onceEvent = (client, event, listener)=>{
119
- const { eventEmitter } = getCore(client);
120
- eventEmitter.once(event, listener);
121
- return ()=>{
122
- eventEmitter.off(event, listener);
123
- };
124
- };
125
- /**
126
- * Emit an event.
127
- */ const emitEvent = (client, event, ...args)=>{
128
- const { eventEmitter } = getCore(client);
129
- eventEmitter.emit(event, ...args);
130
- };
73
+ "@dynamic-labs/sdk-api-core": "0.0.702"};
131
74
 
132
75
  const getDetails = ({ details, cause })=>{
133
76
  if (cause instanceof BaseError) {
@@ -186,6 +129,97 @@ const getDetails = ({ details, cause })=>{
186
129
  }
187
130
  }
188
131
 
132
+ class APIError extends BaseError {
133
+ static async fromResponse(response) {
134
+ const errorBody = await response.json();
135
+ if ('code' in errorBody && typeof errorBody.code === 'string' && 'error' in errorBody && typeof errorBody.error === 'string') {
136
+ return new APIError(errorBody.error, errorBody.code);
137
+ }
138
+ return null;
139
+ }
140
+ constructor(message, code){
141
+ super({
142
+ cause: null,
143
+ docsUrl: null,
144
+ name: 'APIError',
145
+ shortMessage: message
146
+ });
147
+ this.code = code;
148
+ }
149
+ }
150
+
151
+ const convertToApiErrorMiddleware = {
152
+ post: async (context)=>{
153
+ if (context.response.status >= 400) {
154
+ const apiError = await APIError.fromResponse(context.response);
155
+ if (apiError) {
156
+ throw apiError;
157
+ }
158
+ }
159
+ return context.response;
160
+ }
161
+ };
162
+
163
+ /**
164
+ * Returns a new instance of the SDK API client.
165
+ *
166
+ * This is not meant for storing, as it is very light we can create it whenever needed.
167
+ */ const createApiClient = (client)=>{
168
+ const core = getCore(client);
169
+ const settings = {
170
+ basePath: core.apiBaseUrl,
171
+ headers: {
172
+ 'Content-Type': 'application/json',
173
+ 'x-dyn-api-version': dependencies['@dynamic-labs/sdk-api-core'],
174
+ 'x-dyn-version': core.version
175
+ }
176
+ };
177
+ if (client.token) {
178
+ settings.headers.Authorization = `Bearer ${client.token}`;
179
+ }
180
+ return new SDKApi(new Configuration(_extends({}, settings, {
181
+ fetchApi: core.fetch,
182
+ middleware: [
183
+ convertToApiErrorMiddleware
184
+ ]
185
+ })));
186
+ };
187
+
188
+ /**
189
+ * Listen to an event from the client.
190
+ *
191
+ * @returns A function that can be called to remove the listener.
192
+ */ const onEvent = (client, event, listener)=>{
193
+ const { eventEmitter } = getCore(client);
194
+ eventEmitter.on(event, listener);
195
+ return ()=>{
196
+ eventEmitter.off(event, listener);
197
+ };
198
+ };
199
+ /**
200
+ * Remove a listener from an event.
201
+ */ const offEvent = (client, event, listener)=>{
202
+ const { eventEmitter } = getCore(client);
203
+ eventEmitter.off(event, listener);
204
+ };
205
+ /**
206
+ * Listen to an event that will only fire once.
207
+ *
208
+ * @returns A function that can be called to remove the listener.
209
+ */ const onceEvent = (client, event, listener)=>{
210
+ const { eventEmitter } = getCore(client);
211
+ eventEmitter.once(event, listener);
212
+ return ()=>{
213
+ eventEmitter.off(event, listener);
214
+ };
215
+ };
216
+ /**
217
+ * Emit an event.
218
+ */ const emitEvent = (client, event, ...args)=>{
219
+ const { eventEmitter } = getCore(client);
220
+ eventEmitter.emit(event, ...args);
221
+ };
222
+
189
223
  class ValueMustBeDefinedError extends BaseError {
190
224
  constructor(message){
191
225
  super({
@@ -412,4 +446,4 @@ const getWalletProviderFromWalletAccount = (walletAccount)=>{
412
446
  return walletProvider;
413
447
  };
414
448
 
415
- export { BaseError as B, CannotTrackError as C, InvalidStorageSet as I, WalletProviderPriority as W, _extends as _, assertDefined as a, assignClient as b, createApiClient as c, dependencies as d, emitEvent as e, getClient as f, getCore as g, getWalletProviderFromWalletAccount as h, isEqualShallow as i, getWalletProviderRegistry as j, onceEvent as k, onEvent as l, hasExtension as m, ClientNotPresentError as n, offEvent as o, subscribeWithSelector as s, version as v };
449
+ export { APIError as A, BaseError as B, CannotTrackError as C, InvalidStorageSet as I, WalletProviderPriority as W, _extends as _, assertDefined as a, assignClient as b, createApiClient as c, dependencies as d, emitEvent as e, getClient as f, getCore as g, getWalletProviderFromWalletAccount as h, isEqualShallow as i, getWalletProviderRegistry as j, onceEvent as k, onEvent as l, hasExtension as m, ClientNotPresentError as n, offEvent as o, subscribeWithSelector as s, version as v };
package/index.cjs.js CHANGED
@@ -788,6 +788,15 @@ const defaultConsole = console;
788
788
  return client;
789
789
  };
790
790
 
791
+ const getPasskeyAuthenticationOptions = async (client)=>{
792
+ const core = getWalletProviderFromWalletAccount.getCore(client);
793
+ const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
794
+ const options = await apiClient.getPasskeyAuthenticationOptions({
795
+ environmentId: core.environmentId
796
+ });
797
+ return options;
798
+ };
799
+
791
800
  const getPasskeys = async (client)=>{
792
801
  const core = getWalletProviderFromWalletAccount.getCore(client);
793
802
  const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
@@ -1103,7 +1112,69 @@ const acknowledgeRecoveryCodes = async (client)=>{
1103
1112
  });
1104
1113
  };
1105
1114
 
1106
- const authMfaRecoveryCode = async (client, { code })=>{
1115
+ class NoPasskeyCredentialsFoundError extends getWalletProviderFromWalletAccount.BaseError {
1116
+ constructor(){
1117
+ super({
1118
+ cause: null,
1119
+ docsUrl: null,
1120
+ name: 'NoPasskeyCredentialsFoundError',
1121
+ shortMessage: 'No passkey credentials found'
1122
+ });
1123
+ }
1124
+ }
1125
+
1126
+ const serverAuthenticatePasskey = async (client, authentication, createMfaToken)=>{
1127
+ const core = getWalletProviderFromWalletAccount.getCore(client);
1128
+ const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1129
+ const response = await apiClient.authenticateMfaPasskeyDevice({
1130
+ environmentId: core.environmentId,
1131
+ passkeyAuthRequest: getWalletProviderFromWalletAccount._extends({}, authentication, {
1132
+ createMfaToken,
1133
+ response: getWalletProviderFromWalletAccount._extends({}, authentication.response, {
1134
+ clientDataJson: authentication.response.clientDataJSON
1135
+ })
1136
+ })
1137
+ });
1138
+ return response;
1139
+ };
1140
+
1141
+ const authenticatePasskeyMFA = async (client, { createMfaToken } = {})=>{
1142
+ try {
1143
+ var _options_allowCredentials;
1144
+ if (!browser.browserSupportsWebAuthn()) {
1145
+ throw new NoWebAuthNSupportError();
1146
+ }
1147
+ const options = await getPasskeyAuthenticationOptions(client);
1148
+ const allowCredentials = (_options_allowCredentials = options.allowCredentials) == null ? void 0 : _options_allowCredentials.map((credential)=>getWalletProviderFromWalletAccount._extends({}, credential, {
1149
+ type: 'public-key'
1150
+ }));
1151
+ if (!(allowCredentials == null ? void 0 : allowCredentials.length)) {
1152
+ throw new NoPasskeyCredentialsFoundError();
1153
+ }
1154
+ // Ensure allowCredentials has the required type property
1155
+ const formattedOptions = getWalletProviderFromWalletAccount._extends({}, options, {
1156
+ allowCredentials
1157
+ });
1158
+ const authentication = await browser.startAuthentication({
1159
+ optionsJSON: formattedOptions
1160
+ });
1161
+ const response = await serverAuthenticatePasskey(client, authentication, createMfaToken);
1162
+ updateAuthFromVerifyResponse(client, response);
1163
+ getWalletProviderFromWalletAccount.emitEvent(client, 'mfaCompletionSuccess', {
1164
+ mfaToken: response.mfaToken
1165
+ });
1166
+ return response;
1167
+ } catch (error) {
1168
+ getWalletProviderFromWalletAccount.emitEvent(client, 'mfaCompletionFailure', {
1169
+ error
1170
+ });
1171
+ throw error;
1172
+ }
1173
+ };
1174
+
1175
+ /**
1176
+ * Authenticates and return the MFA token with a recovery code.
1177
+ */ const authMfaRecoveryCode = async (client, { code })=>{
1107
1178
  const core = getWalletProviderFromWalletAccount.getCore(client);
1108
1179
  const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1109
1180
  try {
@@ -1117,7 +1188,7 @@ const authMfaRecoveryCode = async (client, { code })=>{
1117
1188
  getWalletProviderFromWalletAccount.emitEvent(client, 'mfaCompletionSuccess', {
1118
1189
  mfaToken: response.mfaToken
1119
1190
  });
1120
- return response.mfaToken;
1191
+ return response;
1121
1192
  } catch (error) {
1122
1193
  getWalletProviderFromWalletAccount.emitEvent(client, 'mfaCompletionFailure', {
1123
1194
  error
@@ -1126,7 +1197,9 @@ const authMfaRecoveryCode = async (client, { code })=>{
1126
1197
  }
1127
1198
  };
1128
1199
 
1129
- const authTotpMfaDevice = async (client, { deviceId, code })=>{
1200
+ /**
1201
+ * Authenticates and return the MFA token for a TOTP device.
1202
+ */ const authTotpMfaDevice = async (client, { deviceId, code, createMfaTokenOptions })=>{
1130
1203
  const core = getWalletProviderFromWalletAccount.getCore(client);
1131
1204
  const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1132
1205
  try {
@@ -1134,9 +1207,7 @@ const authTotpMfaDevice = async (client, { deviceId, code })=>{
1134
1207
  environmentId: core.environmentId,
1135
1208
  mFAAuthTotpDevicePostRequest: {
1136
1209
  code,
1137
- createMfaToken: {
1138
- singleUse: true
1139
- },
1210
+ createMfaToken: createMfaTokenOptions,
1140
1211
  id: deviceId
1141
1212
  }
1142
1213
  });
@@ -1145,7 +1216,7 @@ const authTotpMfaDevice = async (client, { deviceId, code })=>{
1145
1216
  deviceId,
1146
1217
  mfaToken: response.mfaToken
1147
1218
  });
1148
- return response.mfaToken;
1219
+ return response;
1149
1220
  } catch (error) {
1150
1221
  getWalletProviderFromWalletAccount.emitEvent(client, 'mfaCompletionFailure', {
1151
1222
  deviceId,
@@ -1155,13 +1226,14 @@ const authTotpMfaDevice = async (client, { deviceId, code })=>{
1155
1226
  }
1156
1227
  };
1157
1228
 
1158
- const createNewMfaRecoveryCodes = async (client)=>{
1229
+ /**
1230
+ * Creates new MFA recovery codes for the user.
1231
+ */ const createNewMfaRecoveryCodes = async (client)=>{
1159
1232
  const core = getWalletProviderFromWalletAccount.getCore(client);
1160
1233
  const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1161
- const { recoveryCodes } = await apiClient.createNewRecoveryCodes({
1234
+ return apiClient.createNewRecoveryCodes({
1162
1235
  environmentId: core.environmentId
1163
1236
  });
1164
- return recoveryCodes;
1165
1237
  };
1166
1238
 
1167
1239
  /**
@@ -1179,6 +1251,28 @@ const createNewMfaRecoveryCodes = async (client)=>{
1179
1251
  });
1180
1252
  };
1181
1253
 
1254
+ class MfaInvalidOtpError extends getWalletProviderFromWalletAccount.BaseError {
1255
+ constructor({ cause }){
1256
+ super({
1257
+ cause,
1258
+ docsUrl: null,
1259
+ name: 'MfaInvalidOtpError',
1260
+ shortMessage: 'Invalid OTP'
1261
+ });
1262
+ }
1263
+ }
1264
+
1265
+ class MfaRateLimitedError extends getWalletProviderFromWalletAccount.BaseError {
1266
+ constructor({ cause }){
1267
+ super({
1268
+ cause,
1269
+ docsUrl: null,
1270
+ name: 'MfaRateLimitedError',
1271
+ shortMessage: 'Rate limited'
1272
+ });
1273
+ }
1274
+ }
1275
+
1182
1276
  const getMfaDevices = async (client)=>{
1183
1277
  const core = getWalletProviderFromWalletAccount.getCore(client);
1184
1278
  const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
@@ -1188,22 +1282,57 @@ const getMfaDevices = async (client)=>{
1188
1282
  return devices.map((device)=>getWalletProviderFromWalletAccount.assignClient(device, client));
1189
1283
  };
1190
1284
 
1191
- const getMfaRecoveryCodes = async (client)=>{
1285
+ /**
1286
+ * Returns the recovery codes for the user's MFA device.
1287
+ */ const getMfaRecoveryCodes = async (client)=>{
1192
1288
  const core = getWalletProviderFromWalletAccount.getCore(client);
1193
1289
  const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1194
- const { recoveryCodes } = await apiClient.getRecoveryCodes({
1290
+ return apiClient.getRecoveryCodes({
1195
1291
  environmentId: core.environmentId
1196
1292
  });
1197
- return recoveryCodes;
1293
+ };
1294
+
1295
+ const isPendingRecoveryCodesAcknowledgment = (client)=>{
1296
+ const user = client.user;
1297
+ getWalletProviderFromWalletAccount.assertDefined(user, 'User not logged in');
1298
+ return user.mfaBackupCodeAcknowledgement !== sdkApiCore.MfaBackupCodeAcknowledgement.Complete;
1299
+ };
1300
+
1301
+ const isUserMissingMfaAuth = (client)=>{
1302
+ var _user_scope;
1303
+ const user = client.user;
1304
+ getWalletProviderFromWalletAccount.assertDefined(user, 'User not logged in');
1305
+ return Boolean((_user_scope = user.scope) == null ? void 0 : _user_scope.includes('requiresAdditionalAuth'));
1306
+ };
1307
+
1308
+ const mapMfaErrorsAndThrow = (error)=>{
1309
+ if (!(error instanceof getWalletProviderFromWalletAccount.APIError)) {
1310
+ return;
1311
+ }
1312
+ if (error.code === 'mfa_invalid_code') {
1313
+ throw new MfaInvalidOtpError({
1314
+ cause: error
1315
+ });
1316
+ }
1317
+ if (error.code === 'mfa_rate_limited') {
1318
+ throw new MfaRateLimitedError({
1319
+ cause: error
1320
+ });
1321
+ }
1198
1322
  };
1199
1323
 
1200
1324
  const registerTotpMfaDevice = async (client)=>{
1201
- const core = getWalletProviderFromWalletAccount.getCore(client);
1202
- const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1203
- const response = await apiClient.registerTotpMfaDevice({
1204
- environmentId: core.environmentId
1205
- });
1206
- return response;
1325
+ try {
1326
+ const core = getWalletProviderFromWalletAccount.getCore(client);
1327
+ const apiClient = getWalletProviderFromWalletAccount.createApiClient(client);
1328
+ const response = await apiClient.registerTotpMfaDevice({
1329
+ environmentId: core.environmentId
1330
+ });
1331
+ return response;
1332
+ } catch (error) {
1333
+ mapMfaErrorsAndThrow(error);
1334
+ throw error;
1335
+ }
1207
1336
  };
1208
1337
 
1209
1338
  const setDefaultMfaDevice = async (device)=>{
@@ -2501,6 +2630,8 @@ exports.offEvent = getWalletProviderFromWalletAccount.offEvent;
2501
2630
  exports.onEvent = getWalletProviderFromWalletAccount.onEvent;
2502
2631
  exports.onceEvent = getWalletProviderFromWalletAccount.onceEvent;
2503
2632
  exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
2633
+ exports.MfaInvalidOtpError = MfaInvalidOtpError;
2634
+ exports.MfaRateLimitedError = MfaRateLimitedError;
2504
2635
  exports.NoAddressFoundError = NoAddressFoundError;
2505
2636
  exports.WalletAccountAlreadyVerifiedError = WalletAccountAlreadyVerifiedError;
2506
2637
  exports.WalletAccountNotSelectedError = WalletAccountNotSelectedError;
@@ -2509,6 +2640,7 @@ exports.acknowledgeRecoveryCodes = acknowledgeRecoveryCodes;
2509
2640
  exports.assertWalletAccountSigningAvailability = assertWalletAccountSigningAvailability;
2510
2641
  exports.authMfaRecoveryCode = authMfaRecoveryCode;
2511
2642
  exports.authTotpMfaDevice = authTotpMfaDevice;
2643
+ exports.authenticatePasskeyMFA = authenticatePasskeyMFA;
2512
2644
  exports.completeSocialRedirectSignIn = completeSocialRedirectSignIn;
2513
2645
  exports.connectWithWalletProvider = connectWithWalletProvider;
2514
2646
  exports.createDynamicClient = createDynamicClient;
@@ -2518,12 +2650,15 @@ exports.detectOAuthRedirect = detectOAuthRedirect;
2518
2650
  exports.fetchProjectSettings = fetchProjectSettings;
2519
2651
  exports.getMfaDevices = getMfaDevices;
2520
2652
  exports.getMfaRecoveryCodes = getMfaRecoveryCodes;
2653
+ exports.getPasskeyAuthenticationOptions = getPasskeyAuthenticationOptions;
2521
2654
  exports.getPasskeys = getPasskeys;
2522
2655
  exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
2523
2656
  exports.getWalletAccounts = getWalletAccounts;
2524
2657
  exports.getWalletProviders = getWalletProviders;
2525
2658
  exports.initializeClient = initializeClient;
2659
+ exports.isPendingRecoveryCodesAcknowledgment = isPendingRecoveryCodesAcknowledgment;
2526
2660
  exports.isSignedIn = isSignedIn;
2661
+ exports.isUserMissingMfaAuth = isUserMissingMfaAuth;
2527
2662
  exports.logout = logout;
2528
2663
  exports.registerPasskey = registerPasskey;
2529
2664
  exports.registerTotpMfaDevice = registerTotpMfaDevice;
package/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import { B as BaseError, a as assertDefined, g as getCore, b as assignClient, I as InvalidStorageSet, c as createApiClient, e as emitEvent, s as subscribeWithSelector, i as isEqualShallow, d as dependencies, C as CannotTrackError, v as version, _ as _extends, f as getClient, h as getWalletProviderFromWalletAccount, j as getWalletProviderRegistry } from './getWalletProviderFromWalletAccount.esm.js';
1
+ import { B as BaseError, a as assertDefined, g as getCore, b as assignClient, I as InvalidStorageSet, c as createApiClient, e as emitEvent, s as subscribeWithSelector, i as isEqualShallow, d as dependencies, C as CannotTrackError, v as version, _ as _extends, f as getClient, A as APIError, h as getWalletProviderFromWalletAccount, j as getWalletProviderRegistry } from './getWalletProviderFromWalletAccount.esm.js';
2
2
  export { m as hasExtension, o as offEvent, l as onEvent, k as onceEvent } from './getWalletProviderFromWalletAccount.esm.js';
3
3
  import { JwtVerifiedCredentialFormatEnum, ProviderEnum, MfaBackupCodeAcknowledgement } from '@dynamic-labs/sdk-api-core';
4
4
  import { z } from '@zod/mini';
5
5
  import EventEmitter$1, { EventEmitter } from 'eventemitter3';
6
- import { browserSupportsWebAuthn, startRegistration } from '@simplewebauthn/browser';
6
+ import { browserSupportsWebAuthn, startRegistration, startAuthentication } from '@simplewebauthn/browser';
7
7
 
8
8
  /**
9
9
  * Maps the state keys to the event names.
@@ -787,6 +787,15 @@ const defaultConsole = console;
787
787
  return client;
788
788
  };
789
789
 
790
+ const getPasskeyAuthenticationOptions = async (client)=>{
791
+ const core = getCore(client);
792
+ const apiClient = createApiClient(client);
793
+ const options = await apiClient.getPasskeyAuthenticationOptions({
794
+ environmentId: core.environmentId
795
+ });
796
+ return options;
797
+ };
798
+
790
799
  const getPasskeys = async (client)=>{
791
800
  const core = getCore(client);
792
801
  const apiClient = createApiClient(client);
@@ -1102,7 +1111,69 @@ const acknowledgeRecoveryCodes = async (client)=>{
1102
1111
  });
1103
1112
  };
1104
1113
 
1105
- const authMfaRecoveryCode = async (client, { code })=>{
1114
+ class NoPasskeyCredentialsFoundError extends BaseError {
1115
+ constructor(){
1116
+ super({
1117
+ cause: null,
1118
+ docsUrl: null,
1119
+ name: 'NoPasskeyCredentialsFoundError',
1120
+ shortMessage: 'No passkey credentials found'
1121
+ });
1122
+ }
1123
+ }
1124
+
1125
+ const serverAuthenticatePasskey = async (client, authentication, createMfaToken)=>{
1126
+ const core = getCore(client);
1127
+ const apiClient = createApiClient(client);
1128
+ const response = await apiClient.authenticateMfaPasskeyDevice({
1129
+ environmentId: core.environmentId,
1130
+ passkeyAuthRequest: _extends({}, authentication, {
1131
+ createMfaToken,
1132
+ response: _extends({}, authentication.response, {
1133
+ clientDataJson: authentication.response.clientDataJSON
1134
+ })
1135
+ })
1136
+ });
1137
+ return response;
1138
+ };
1139
+
1140
+ const authenticatePasskeyMFA = async (client, { createMfaToken } = {})=>{
1141
+ try {
1142
+ var _options_allowCredentials;
1143
+ if (!browserSupportsWebAuthn()) {
1144
+ throw new NoWebAuthNSupportError();
1145
+ }
1146
+ const options = await getPasskeyAuthenticationOptions(client);
1147
+ const allowCredentials = (_options_allowCredentials = options.allowCredentials) == null ? void 0 : _options_allowCredentials.map((credential)=>_extends({}, credential, {
1148
+ type: 'public-key'
1149
+ }));
1150
+ if (!(allowCredentials == null ? void 0 : allowCredentials.length)) {
1151
+ throw new NoPasskeyCredentialsFoundError();
1152
+ }
1153
+ // Ensure allowCredentials has the required type property
1154
+ const formattedOptions = _extends({}, options, {
1155
+ allowCredentials
1156
+ });
1157
+ const authentication = await startAuthentication({
1158
+ optionsJSON: formattedOptions
1159
+ });
1160
+ const response = await serverAuthenticatePasskey(client, authentication, createMfaToken);
1161
+ updateAuthFromVerifyResponse(client, response);
1162
+ emitEvent(client, 'mfaCompletionSuccess', {
1163
+ mfaToken: response.mfaToken
1164
+ });
1165
+ return response;
1166
+ } catch (error) {
1167
+ emitEvent(client, 'mfaCompletionFailure', {
1168
+ error
1169
+ });
1170
+ throw error;
1171
+ }
1172
+ };
1173
+
1174
+ /**
1175
+ * Authenticates and return the MFA token with a recovery code.
1176
+ */ const authMfaRecoveryCode = async (client, { code })=>{
1106
1177
  const core = getCore(client);
1107
1178
  const apiClient = createApiClient(client);
1108
1179
  try {
@@ -1116,7 +1187,7 @@ const authMfaRecoveryCode = async (client, { code })=>{
1116
1187
  emitEvent(client, 'mfaCompletionSuccess', {
1117
1188
  mfaToken: response.mfaToken
1118
1189
  });
1119
- return response.mfaToken;
1190
+ return response;
1120
1191
  } catch (error) {
1121
1192
  emitEvent(client, 'mfaCompletionFailure', {
1122
1193
  error
@@ -1125,7 +1196,9 @@ const authMfaRecoveryCode = async (client, { code })=>{
1125
1196
  }
1126
1197
  };
1127
1198
 
1128
- const authTotpMfaDevice = async (client, { deviceId, code })=>{
1199
+ /**
1200
+ * Authenticates and return the MFA token for a TOTP device.
1201
+ */ const authTotpMfaDevice = async (client, { deviceId, code, createMfaTokenOptions })=>{
1129
1202
  const core = getCore(client);
1130
1203
  const apiClient = createApiClient(client);
1131
1204
  try {
@@ -1133,9 +1206,7 @@ const authTotpMfaDevice = async (client, { deviceId, code })=>{
1133
1206
  environmentId: core.environmentId,
1134
1207
  mFAAuthTotpDevicePostRequest: {
1135
1208
  code,
1136
- createMfaToken: {
1137
- singleUse: true
1138
- },
1209
+ createMfaToken: createMfaTokenOptions,
1139
1210
  id: deviceId
1140
1211
  }
1141
1212
  });
@@ -1144,7 +1215,7 @@ const authTotpMfaDevice = async (client, { deviceId, code })=>{
1144
1215
  deviceId,
1145
1216
  mfaToken: response.mfaToken
1146
1217
  });
1147
- return response.mfaToken;
1218
+ return response;
1148
1219
  } catch (error) {
1149
1220
  emitEvent(client, 'mfaCompletionFailure', {
1150
1221
  deviceId,
@@ -1154,13 +1225,14 @@ const authTotpMfaDevice = async (client, { deviceId, code })=>{
1154
1225
  }
1155
1226
  };
1156
1227
 
1157
- const createNewMfaRecoveryCodes = async (client)=>{
1228
+ /**
1229
+ * Creates new MFA recovery codes for the user.
1230
+ */ const createNewMfaRecoveryCodes = async (client)=>{
1158
1231
  const core = getCore(client);
1159
1232
  const apiClient = createApiClient(client);
1160
- const { recoveryCodes } = await apiClient.createNewRecoveryCodes({
1233
+ return apiClient.createNewRecoveryCodes({
1161
1234
  environmentId: core.environmentId
1162
1235
  });
1163
- return recoveryCodes;
1164
1236
  };
1165
1237
 
1166
1238
  /**
@@ -1178,6 +1250,28 @@ const createNewMfaRecoveryCodes = async (client)=>{
1178
1250
  });
1179
1251
  };
1180
1252
 
1253
+ class MfaInvalidOtpError extends BaseError {
1254
+ constructor({ cause }){
1255
+ super({
1256
+ cause,
1257
+ docsUrl: null,
1258
+ name: 'MfaInvalidOtpError',
1259
+ shortMessage: 'Invalid OTP'
1260
+ });
1261
+ }
1262
+ }
1263
+
1264
+ class MfaRateLimitedError extends BaseError {
1265
+ constructor({ cause }){
1266
+ super({
1267
+ cause,
1268
+ docsUrl: null,
1269
+ name: 'MfaRateLimitedError',
1270
+ shortMessage: 'Rate limited'
1271
+ });
1272
+ }
1273
+ }
1274
+
1181
1275
  const getMfaDevices = async (client)=>{
1182
1276
  const core = getCore(client);
1183
1277
  const apiClient = createApiClient(client);
@@ -1187,22 +1281,57 @@ const getMfaDevices = async (client)=>{
1187
1281
  return devices.map((device)=>assignClient(device, client));
1188
1282
  };
1189
1283
 
1190
- const getMfaRecoveryCodes = async (client)=>{
1284
+ /**
1285
+ * Returns the recovery codes for the user's MFA device.
1286
+ */ const getMfaRecoveryCodes = async (client)=>{
1191
1287
  const core = getCore(client);
1192
1288
  const apiClient = createApiClient(client);
1193
- const { recoveryCodes } = await apiClient.getRecoveryCodes({
1289
+ return apiClient.getRecoveryCodes({
1194
1290
  environmentId: core.environmentId
1195
1291
  });
1196
- return recoveryCodes;
1292
+ };
1293
+
1294
+ const isPendingRecoveryCodesAcknowledgment = (client)=>{
1295
+ const user = client.user;
1296
+ assertDefined(user, 'User not logged in');
1297
+ return user.mfaBackupCodeAcknowledgement !== MfaBackupCodeAcknowledgement.Complete;
1298
+ };
1299
+
1300
+ const isUserMissingMfaAuth = (client)=>{
1301
+ var _user_scope;
1302
+ const user = client.user;
1303
+ assertDefined(user, 'User not logged in');
1304
+ return Boolean((_user_scope = user.scope) == null ? void 0 : _user_scope.includes('requiresAdditionalAuth'));
1305
+ };
1306
+
1307
+ const mapMfaErrorsAndThrow = (error)=>{
1308
+ if (!(error instanceof APIError)) {
1309
+ return;
1310
+ }
1311
+ if (error.code === 'mfa_invalid_code') {
1312
+ throw new MfaInvalidOtpError({
1313
+ cause: error
1314
+ });
1315
+ }
1316
+ if (error.code === 'mfa_rate_limited') {
1317
+ throw new MfaRateLimitedError({
1318
+ cause: error
1319
+ });
1320
+ }
1197
1321
  };
1198
1322
 
1199
1323
  const registerTotpMfaDevice = async (client)=>{
1200
- const core = getCore(client);
1201
- const apiClient = createApiClient(client);
1202
- const response = await apiClient.registerTotpMfaDevice({
1203
- environmentId: core.environmentId
1204
- });
1205
- return response;
1324
+ try {
1325
+ const core = getCore(client);
1326
+ const apiClient = createApiClient(client);
1327
+ const response = await apiClient.registerTotpMfaDevice({
1328
+ environmentId: core.environmentId
1329
+ });
1330
+ return response;
1331
+ } catch (error) {
1332
+ mapMfaErrorsAndThrow(error);
1333
+ throw error;
1334
+ }
1206
1335
  };
1207
1336
 
1208
1337
  const setDefaultMfaDevice = async (device)=>{
@@ -2494,4 +2623,4 @@ class WalletAlreadyLinkedToAnotherUserError extends BaseError {
2494
2623
  return verifiedWalletAccount;
2495
2624
  };
2496
2625
 
2497
- export { BaseError, ClientAlreadyInitializedError, NoAddressFoundError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, acknowledgeRecoveryCodes, assertWalletAccountSigningAvailability, authMfaRecoveryCode, authTotpMfaDevice, completeSocialRedirectSignIn, connectWithWalletProvider, createDynamicClient, createNewMfaRecoveryCodes, deleteMfaDevice, detectOAuthRedirect, fetchProjectSettings, getMfaDevices, getMfaRecoveryCodes, getPasskeys, getPrimaryWalletAccount, getWalletAccounts, getWalletProviders, initializeClient, isSignedIn, logout, registerPasskey, registerTotpMfaDevice, removeWalletAccount, selectPrimaryWalletAccount, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithSocialRedirect, signMessage, updateUser, verifyOTP, verifyWalletAccount };
2626
+ export { BaseError, ClientAlreadyInitializedError, MfaInvalidOtpError, MfaRateLimitedError, NoAddressFoundError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, acknowledgeRecoveryCodes, assertWalletAccountSigningAvailability, authMfaRecoveryCode, authTotpMfaDevice, authenticatePasskeyMFA, completeSocialRedirectSignIn, connectWithWalletProvider, createDynamicClient, createNewMfaRecoveryCodes, deleteMfaDevice, detectOAuthRedirect, fetchProjectSettings, getMfaDevices, getMfaRecoveryCodes, getPasskeyAuthenticationOptions, getPasskeys, getPrimaryWalletAccount, getWalletAccounts, getWalletProviders, initializeClient, isPendingRecoveryCodesAcknowledgment, isSignedIn, isUserMissingMfaAuth, logout, registerPasskey, registerTotpMfaDevice, removeWalletAccount, selectPrimaryWalletAccount, sendEmailOTP, sendSmsOTP, setDefaultMfaDevice, signInWithSocialRedirect, signMessage, updateUser, verifyOTP, verifyWalletAccount };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs-sdk/client",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.7",
4
4
  "type": "module",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -19,7 +19,7 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@dynamic-labs/sdk-api-core": "0.0.691",
22
+ "@dynamic-labs/sdk-api-core": "0.0.702",
23
23
  "@simplewebauthn/browser": "^13.1.0",
24
24
  "@zod/mini": "^4.0.0-beta.0",
25
25
  "buffer": "6.0.3",
@@ -0,0 +1,7 @@
1
+ import { BaseError } from '../base';
2
+ export declare class APIError extends BaseError {
3
+ readonly code: string;
4
+ constructor(message: string, code: string);
5
+ static fromResponse(response: Response): Promise<APIError | null>;
6
+ }
7
+ //# sourceMappingURL=APIError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"APIError.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/errors/APIError/APIError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,qBAAa,QAAS,SAAQ,SAAS;IACrC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;WAW5B,YAAY,CAAC,QAAQ,EAAE,QAAQ;CAS7C"}
@@ -0,0 +1,2 @@
1
+ export { APIError } from './APIError';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/errors/APIError/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -7,12 +7,15 @@ import '../modules/mfa/events';
7
7
  import '../modules/state/raiseStateEvents/events';
8
8
  import '../modules/wallets/walletAccount/events';
9
9
  import '../modules/wallets/walletProviderRegistry/events';
10
+ export type { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
10
11
  export type { DynamicCoreConfig } from '../client/core/types';
11
12
  export { createDynamicClient } from '../client/createDynamicClient';
12
13
  export type { DynamicClient, DynamicClientConfig } from '../client/types';
13
14
  export { BaseError } from '../errors/base/BaseError';
14
15
  export { isSignedIn } from '../modules/auth/isSignedIn';
15
16
  export { logout } from '../modules/auth/logout';
17
+ export { getPasskeyAuthenticationOptions } from '../modules/auth/passkeys/getPasskeyAuthenticationOptions';
18
+ export type { PublicKeyCredentialRequestOptionsJSON } from '../modules/auth/passkeys/getPasskeyAuthenticationOptions';
16
19
  export { getPasskeys } from '../modules/auth/passkeys/getPasskeys';
17
20
  export { registerPasskey } from '../modules/auth/passkeys/registerPasskey';
18
21
  export { completeSocialRedirectSignIn } from '../modules/auth/social/oauth/completeSocialRedirectSignIn';
@@ -26,12 +29,17 @@ export { initializeClient } from '../modules/initializeClient';
26
29
  export { ClientAlreadyInitializedError } from '../modules/initializeClient/errors/ClientAlreadyInitializedError';
27
30
  export type { DynamicInitStatus } from '../modules/initializeClient/state';
28
31
  export { acknowledgeRecoveryCodes } from '../modules/mfa/acknowledgeRecoveryCodes';
32
+ export { authenticatePasskeyMFA } from '../modules/mfa/authenticatePasskeyMFA';
29
33
  export { authMfaRecoveryCode } from '../modules/mfa/authMfaRecoveryCode';
30
34
  export { authTotpMfaDevice } from '../modules/mfa/authTotpMfaDevice';
31
35
  export { createNewMfaRecoveryCodes } from '../modules/mfa/createNewMfaRecoveryCodes';
32
36
  export { deleteMfaDevice } from '../modules/mfa/deleteMfaDevice';
37
+ export { MfaInvalidOtpError } from '../modules/mfa/errors/MfaInvalidOtpError';
38
+ export { MfaRateLimitedError } from '../modules/mfa/errors/MfaRateLimitedError';
33
39
  export { getMfaDevices } from '../modules/mfa/getMfaDevices';
34
40
  export { getMfaRecoveryCodes } from '../modules/mfa/getMfaRecoveryCodes';
41
+ export { isPendingRecoveryCodesAcknowledgment } from '../modules/mfa/isPendingRecoveryCodesAcknowledgment';
42
+ export { isUserMissingMfaAuth } from '../modules/mfa/isUserMissingMfaAuth';
35
43
  export { registerTotpMfaDevice } from '../modules/mfa/registerTotpMfaDevice';
36
44
  export { setDefaultMfaDevice } from '../modules/mfa/setDefaultMfaDevice';
37
45
  export type { MFADevice } from '../modules/mfa/types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/client/src/exports/index.ts"],"names":[],"mappings":"AAGA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mDAAmD,CAAC;AAG3D,OAAO,+BAA+B,CAAC;AACvC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,0CAA0C,CAAC;AAClD,OAAO,yCAAyC,CAAC;AACjD,OAAO,kDAAkD,CAAC;AAE1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,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BAA4B,CAAC;AACxD,OAAO,EAAE,sCAAsC,EAAE,MAAM,2DAA2D,CAAC;AACnH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gGAAgG,CAAC;AAC/I,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yEAAyE,CAAC;AAC9G,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iEAAiE,CAAC;AAC1G,OAAO,EAAE,0BAA0B,EAAE,MAAM,oEAAoE,CAAC;AAChH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iCAAiC,EAAE,MAAM,iFAAiF,CAAC;AACpI,OAAO,EAAE,qCAAqC,EAAE,MAAM,qFAAqF,CAAC;AAC5I,YAAY,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createApiClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/apiClient/createApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAaxD;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,aAAa,WAsBpD,CAAC"}
1
+ {"version":3,"file":"createApiClient.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/modules/apiClient/createApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAInE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAaxD;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,aAAa,WAyBpD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Middleware } from '@dynamic-labs/sdk-api-core';
2
+ export declare const convertToApiErrorMiddleware: Middleware;
3
+ //# sourceMappingURL=convertToApiErrorMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertToApiErrorMiddleware.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/apiClient/middleware/convertToApiErrorMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,4BAA4B,CAAC;AAI9E,eAAO,MAAM,2BAA2B,EAAE,UAYzC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { BaseError } from '../../../../errors/base';
2
+ export declare class NoPasskeyCredentialsFoundError extends BaseError {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=NoPasskeyCredentialsFoundError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoPasskeyCredentialsFoundError.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/errors/NoPasskeyCredentialsFoundError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,qBAAa,8BAA+B,SAAQ,SAAS;;CAS5D"}
@@ -0,0 +1,4 @@
1
+ import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/browser';
2
+ import type { DynamicClient } from '../../../../client/types';
3
+ export declare const getPasskeyAuthenticationOptions: (client: DynamicClient) => Promise<PublicKeyCredentialRequestOptionsJSON>;
4
+ //# sourceMappingURL=getPasskeyAuthenticationOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPasskeyAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAGrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,eAAO,MAAM,+BAA+B,WAClC,aAAa,KACpB,OAAO,CAAC,qCAAqC,CAW/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/browser';
2
+ export { getPasskeyAuthenticationOptions } from './getPasskeyAuthenticationOptions';
3
+ export type { PublicKeyCredentialRequestOptionsJSON };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,YAAY,EAAE,qCAAqC,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { serverAuthenticatePasskey } from './serverAuthenticatePasskey';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/serverAuthenticatePasskey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
2
+ import type { AuthenticationResponseJSON } from '@simplewebauthn/browser';
3
+ import type { DynamicClient } from '../../../../client/types';
4
+ export declare const serverAuthenticatePasskey: (client: DynamicClient, authentication: AuthenticationResponseJSON, createMfaToken?: CreateMfaToken) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
5
+ //# sourceMappingURL=serverAuthenticatePasskey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverAuthenticatePasskey.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,eAAO,MAAM,yBAAyB,WAC5B,aAAa,kBACL,0BAA0B,mBACzB,cAAc,iEAkBhC,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import type { DynamicClient } from '../../../client/types';
2
+ /**
3
+ * Authenticates and return the MFA token with a recovery code.
4
+ */
2
5
  export declare const authMfaRecoveryCode: (client: DynamicClient, { code }: {
3
6
  code: string;
4
- }) => Promise<string | undefined>;
7
+ }) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
5
8
  //# sourceMappingURL=authMfaRecoveryCode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authMfaRecoveryCode.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/authMfaRecoveryCode/authMfaRecoveryCode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,eAAO,MAAM,mBAAmB,WACtB,aAAa,YACX;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,gCAsB3B,CAAC"}
1
+ {"version":3,"file":"authMfaRecoveryCode.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/authMfaRecoveryCode/authMfaRecoveryCode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D;;GAEG;AACH,eAAO,MAAM,mBAAmB,WACtB,aAAa,YACX;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,iEAsB3B,CAAC"}
@@ -1,8 +1,13 @@
1
+ import type { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
1
2
  import type { DynamicClient } from '../../../client/types';
2
3
  type AuthTotpMfaDeviceParams = {
3
4
  code: string;
4
- deviceId: string;
5
+ createMfaTokenOptions?: CreateMfaToken;
6
+ deviceId?: string;
5
7
  };
6
- export declare const authTotpMfaDevice: (client: DynamicClient, { deviceId, code }: AuthTotpMfaDeviceParams) => Promise<string | undefined>;
8
+ /**
9
+ * Authenticates and return the MFA token for a TOTP device.
10
+ */
11
+ export declare const authTotpMfaDevice: (client: DynamicClient, { deviceId, code, createMfaTokenOptions }: AuthTotpMfaDeviceParams) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
7
12
  export {};
8
13
  //# sourceMappingURL=authTotpMfaDevice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authTotpMfaDevice.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/authTotpMfaDevice/authTotpMfaDevice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,WACpB,aAAa,sBACD,uBAAuB,gCA6B5C,CAAC"}
1
+ {"version":3,"file":"authTotpMfaDevice.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/authTotpMfaDevice/authTotpMfaDevice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,WACpB,aAAa,6CACsB,uBAAuB,iEA2BnE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
2
+ import type { DynamicClient } from '../../../client/types';
3
+ export declare const authenticatePasskeyMFA: (client: DynamicClient, { createMfaToken }?: {
4
+ createMfaToken?: CreateMfaToken;
5
+ }) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
6
+ //# sourceMappingURL=authenticatePasskeyMFA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticatePasskeyMFA.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,eAAO,MAAM,sBAAsB,WACzB,aAAa,uBACD;IAAE,cAAc,CAAC,EAAE,cAAc,CAAA;CAAE,iEAyCxD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { authenticatePasskeyMFA } from './authenticatePasskeyMFA';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/authenticatePasskeyMFA/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,3 +1,6 @@
1
1
  import type { DynamicClient } from '../../../client/types';
2
- export declare const createNewMfaRecoveryCodes: (client: DynamicClient) => Promise<string[]>;
2
+ /**
3
+ * Creates new MFA recovery codes for the user.
4
+ */
5
+ export declare const createNewMfaRecoveryCodes: (client: DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").MFARegenRecoveryCodesResponse>;
3
6
  //# sourceMappingURL=createNewMfaRecoveryCodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createNewMfaRecoveryCodes.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,eAAO,MAAM,yBAAyB,WAAkB,aAAa,sBASpE,CAAC"}
1
+ {"version":3,"file":"createNewMfaRecoveryCodes.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D;;GAEG;AACH,eAAO,MAAM,yBAAyB,WAAkB,aAAa,gFAOpE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { BaseErrorParameters } from '../../../errors/base';
2
+ import { BaseError } from '../../../exports';
3
+ export declare class MfaInvalidOtpError extends BaseError {
4
+ constructor({ cause }: Pick<BaseErrorParameters, 'cause'>);
5
+ }
6
+ //# sourceMappingURL=MfaInvalidOtpError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MfaInvalidOtpError.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/errors/MfaInvalidOtpError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC;CAQ1D"}
@@ -0,0 +1,6 @@
1
+ import type { BaseErrorParameters } from '../../../errors/base';
2
+ import { BaseError } from '../../../exports';
3
+ export declare class MfaRateLimitedError extends BaseError {
4
+ constructor({ cause }: Pick<BaseErrorParameters, 'cause'>);
5
+ }
6
+ //# sourceMappingURL=MfaRateLimitedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MfaRateLimitedError.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/errors/MfaRateLimitedError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC;CAQ1D"}
@@ -1,3 +1,6 @@
1
1
  import type { DynamicClient } from '../../../client/types';
2
- export declare const getMfaRecoveryCodes: (client: DynamicClient) => Promise<string[]>;
2
+ /**
3
+ * Returns the recovery codes for the user's MFA device.
4
+ */
5
+ export declare const getMfaRecoveryCodes: (client: DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").MFAGetRecoveryCodesResponse>;
3
6
  //# sourceMappingURL=getMfaRecoveryCodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getMfaRecoveryCodes.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,eAAO,MAAM,mBAAmB,WAAkB,aAAa,sBAS9D,CAAC"}
1
+ {"version":3,"file":"getMfaRecoveryCodes.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D;;GAEG;AACH,eAAO,MAAM,mBAAmB,WAAkB,aAAa,8EAO9D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { isPendingRecoveryCodesAcknowledgment } from './isPendingRecoveryCodesAcknowledgment';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/isPendingRecoveryCodesAcknowledgment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DynamicClient } from '../../../client/types';
2
+ export declare const isPendingRecoveryCodesAcknowledgment: (client: DynamicClient) => boolean;
3
+ //# sourceMappingURL=isPendingRecoveryCodesAcknowledgment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPendingRecoveryCodesAcknowledgment.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/isPendingRecoveryCodesAcknowledgment/isPendingRecoveryCodesAcknowledgment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,eAAO,MAAM,oCAAoC,WAAY,aAAa,YAQzE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { isUserMissingMfaAuth } from './isUserMissingMfaAuth';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/isUserMissingMfaAuth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DynamicClient } from '../../../client/types';
2
+ export declare const isUserMissingMfaAuth: (client: DynamicClient) => boolean;
3
+ //# sourceMappingURL=isUserMissingMfaAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUserMissingMfaAuth.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/isUserMissingMfaAuth/isUserMissingMfaAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,eAAO,MAAM,oBAAoB,WAAY,aAAa,YAMzD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"registerTotpMfaDevice.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,eAAO,MAAM,qBAAqB,WAAkB,aAAa,mFAShE,CAAC"}
1
+ {"version":3,"file":"registerTotpMfaDevice.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,eAAO,MAAM,qBAAqB,WAAkB,aAAa,mFAehE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { mapMfaErrorsAndThrow } from './mapMfaErrorsAndThrow';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/mfa/utils/mapMfaErrorsAndThrow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const mapMfaErrorsAndThrow: (error: unknown) => void;
2
+ //# sourceMappingURL=mapMfaErrorsAndThrow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapMfaErrorsAndThrow.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/mfa/utils/mapMfaErrorsAndThrow/mapMfaErrorsAndThrow.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,UAAW,OAAO,SAYlD,CAAC"}