@dynamic-labs-sdk/client 0.1.0 → 0.1.2
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 +12 -0
- package/constants.cjs.js +5 -4
- package/constants.esm.js +5 -4
- package/index.cjs.js +5 -2
- package/index.esm.js +5 -2
- package/package.json +3 -3
- package/src/errors/APIError/APIError.d.ts +2 -1
- package/src/errors/APIError/APIError.d.ts.map +1 -1
- package/src/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +7 -1
- package/src/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
- package/src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts +3 -1
- package/src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 0.1.2 (2025-12-19)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- add status to api error ([#715](https://github.com/dynamic-labs/dynamic-sdk/pull/715))
|
|
6
|
+
|
|
7
|
+
## 0.1.1 (2025-12-19)
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
- add getTransactionHistory method ([#702](https://github.com/dynamic-labs/dynamic-sdk/pull/702))
|
|
12
|
+
|
|
1
13
|
## 0.1.0 (2025-12-18)
|
|
2
14
|
|
|
3
15
|
### 🚀 Features
|
package/constants.cjs.js
CHANGED
|
@@ -4,9 +4,9 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
|
4
4
|
var buffer = require('buffer');
|
|
5
5
|
|
|
6
6
|
var name = "@dynamic-labs-sdk/client";
|
|
7
|
-
var version = "0.1.
|
|
7
|
+
var version = "0.1.2";
|
|
8
8
|
var dependencies = {
|
|
9
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
9
|
+
"@dynamic-labs/sdk-api-core": "0.0.843"};
|
|
10
10
|
|
|
11
11
|
const getCore = (client)=>{
|
|
12
12
|
// @ts-expect-error - this was hidden from the public API
|
|
@@ -212,14 +212,14 @@ class APIError extends BaseError {
|
|
|
212
212
|
const errorBody = await response.clone().json();
|
|
213
213
|
if (errorBody && 'error' in errorBody && typeof errorBody.error === 'string') {
|
|
214
214
|
const errorCode = 'code' in errorBody && typeof errorBody.code === 'string' ? errorBody.code : 'unknown_error';
|
|
215
|
-
return new APIError(errorBody.error, errorCode);
|
|
215
|
+
return new APIError(errorBody.error, errorCode, response.status);
|
|
216
216
|
}
|
|
217
217
|
return null;
|
|
218
218
|
} catch (e) {
|
|
219
219
|
return null;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
constructor(message, code){
|
|
222
|
+
constructor(message, code, status){
|
|
223
223
|
super({
|
|
224
224
|
cause: null,
|
|
225
225
|
code,
|
|
@@ -227,6 +227,7 @@ class APIError extends BaseError {
|
|
|
227
227
|
name: 'APIError',
|
|
228
228
|
shortMessage: message
|
|
229
229
|
});
|
|
230
|
+
this.status = status;
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
|
package/constants.esm.js
CHANGED
|
@@ -2,9 +2,9 @@ import { AuthStorageEnum, SDKApi, Configuration } from '@dynamic-labs/sdk-api-co
|
|
|
2
2
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
3
3
|
|
|
4
4
|
var name = "@dynamic-labs-sdk/client";
|
|
5
|
-
var version = "0.1.
|
|
5
|
+
var version = "0.1.2";
|
|
6
6
|
var dependencies = {
|
|
7
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
7
|
+
"@dynamic-labs/sdk-api-core": "0.0.843"};
|
|
8
8
|
|
|
9
9
|
const getCore = (client)=>{
|
|
10
10
|
// @ts-expect-error - this was hidden from the public API
|
|
@@ -210,14 +210,14 @@ class APIError extends BaseError {
|
|
|
210
210
|
const errorBody = await response.clone().json();
|
|
211
211
|
if (errorBody && 'error' in errorBody && typeof errorBody.error === 'string') {
|
|
212
212
|
const errorCode = 'code' in errorBody && typeof errorBody.code === 'string' ? errorBody.code : 'unknown_error';
|
|
213
|
-
return new APIError(errorBody.error, errorCode);
|
|
213
|
+
return new APIError(errorBody.error, errorCode, response.status);
|
|
214
214
|
}
|
|
215
215
|
return null;
|
|
216
216
|
} catch (e) {
|
|
217
217
|
return null;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
constructor(message, code){
|
|
220
|
+
constructor(message, code, status){
|
|
221
221
|
super({
|
|
222
222
|
cause: null,
|
|
223
223
|
code,
|
|
@@ -225,6 +225,7 @@ class APIError extends BaseError {
|
|
|
225
225
|
name: 'APIError',
|
|
226
226
|
shortMessage: message
|
|
227
227
|
});
|
|
228
|
+
this.status = status;
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
|
package/index.cjs.js
CHANGED
|
@@ -1255,12 +1255,13 @@ const getPasskeyRegistrationOptions = async (client)=>{
|
|
|
1255
1255
|
return options;
|
|
1256
1256
|
};
|
|
1257
1257
|
|
|
1258
|
-
const serverRegisterPasskey = async ({ registration }, client)=>{
|
|
1258
|
+
const serverRegisterPasskey = async ({ registration, createMfaToken }, client)=>{
|
|
1259
1259
|
const core = constants.getCore(client);
|
|
1260
1260
|
const apiClient = constants.createApiClient({}, client);
|
|
1261
1261
|
const response = await apiClient.registerPasskey({
|
|
1262
1262
|
environmentId: core.environmentId,
|
|
1263
1263
|
passkeyRegisterRequest: constants._extends({}, registration, {
|
|
1264
|
+
createMfaToken,
|
|
1264
1265
|
response: constants._extends({}, registration.response, {
|
|
1265
1266
|
clientDataJson: registration.response.clientDataJSON
|
|
1266
1267
|
})
|
|
@@ -1276,10 +1277,11 @@ const serverRegisterPasskey = async ({ registration }, client)=>{
|
|
|
1276
1277
|
* passwordless authentication. The user will be prompted to create a passkey
|
|
1277
1278
|
* using their device's biometric authentication or security key.
|
|
1278
1279
|
*
|
|
1280
|
+
* @param [params.createMfaToken] - Optional configuration for MFA token creation.
|
|
1279
1281
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1280
1282
|
* @returns A promise that resolves to the registration response.
|
|
1281
1283
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1282
|
-
*/ const registerPasskey = async (client = constants.getDefaultClient())=>{
|
|
1284
|
+
*/ const registerPasskey = async ({ createMfaToken } = {}, client = constants.getDefaultClient())=>{
|
|
1283
1285
|
const core = constants.getCore(client);
|
|
1284
1286
|
if (!core.passkey.isSupported()) {
|
|
1285
1287
|
throw new NoWebAuthNSupportError();
|
|
@@ -1289,6 +1291,7 @@ const serverRegisterPasskey = async ({ registration }, client)=>{
|
|
|
1289
1291
|
optionsJSON: options
|
|
1290
1292
|
});
|
|
1291
1293
|
const response = await serverRegisterPasskey({
|
|
1294
|
+
createMfaToken,
|
|
1292
1295
|
registration
|
|
1293
1296
|
}, client);
|
|
1294
1297
|
getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({
|
package/index.esm.js
CHANGED
|
@@ -1240,12 +1240,13 @@ const getPasskeyRegistrationOptions = async (client)=>{
|
|
|
1240
1240
|
return options;
|
|
1241
1241
|
};
|
|
1242
1242
|
|
|
1243
|
-
const serverRegisterPasskey = async ({ registration }, client)=>{
|
|
1243
|
+
const serverRegisterPasskey = async ({ registration, createMfaToken }, client)=>{
|
|
1244
1244
|
const core = getCore(client);
|
|
1245
1245
|
const apiClient = createApiClient({}, client);
|
|
1246
1246
|
const response = await apiClient.registerPasskey({
|
|
1247
1247
|
environmentId: core.environmentId,
|
|
1248
1248
|
passkeyRegisterRequest: _extends({}, registration, {
|
|
1249
|
+
createMfaToken,
|
|
1249
1250
|
response: _extends({}, registration.response, {
|
|
1250
1251
|
clientDataJson: registration.response.clientDataJSON
|
|
1251
1252
|
})
|
|
@@ -1261,10 +1262,11 @@ const serverRegisterPasskey = async ({ registration }, client)=>{
|
|
|
1261
1262
|
* passwordless authentication. The user will be prompted to create a passkey
|
|
1262
1263
|
* using their device's biometric authentication or security key.
|
|
1263
1264
|
*
|
|
1265
|
+
* @param [params.createMfaToken] - Optional configuration for MFA token creation.
|
|
1264
1266
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1265
1267
|
* @returns A promise that resolves to the registration response.
|
|
1266
1268
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1267
|
-
*/ const registerPasskey = async (client = getDefaultClient())=>{
|
|
1269
|
+
*/ const registerPasskey = async ({ createMfaToken } = {}, client = getDefaultClient())=>{
|
|
1268
1270
|
const core = getCore(client);
|
|
1269
1271
|
if (!core.passkey.isSupported()) {
|
|
1270
1272
|
throw new NoWebAuthNSupportError();
|
|
@@ -1274,6 +1276,7 @@ const serverRegisterPasskey = async ({ registration }, client)=>{
|
|
|
1274
1276
|
optionsJSON: options
|
|
1275
1277
|
});
|
|
1276
1278
|
const response = await serverRegisterPasskey({
|
|
1279
|
+
createMfaToken,
|
|
1277
1280
|
registration
|
|
1278
1281
|
}, client);
|
|
1279
1282
|
updateAuthFromVerifyResponse({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dynamic-labs-sdk/assert-package-version": "0.1.
|
|
33
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
32
|
+
"@dynamic-labs-sdk/assert-package-version": "0.1.2",
|
|
33
|
+
"@dynamic-labs/sdk-api-core": "0.0.843",
|
|
34
34
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.211",
|
|
35
35
|
"@simplewebauthn/browser": "13.1.0",
|
|
36
36
|
"buffer": "6.0.3",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseError } from '../base';
|
|
2
2
|
export declare class APIError extends BaseError {
|
|
3
|
-
|
|
3
|
+
status: number;
|
|
4
|
+
constructor(message: string, code: string, status: number);
|
|
4
5
|
static fromResponse(response: Response): Promise<APIError | null>;
|
|
5
6
|
}
|
|
6
7
|
//# sourceMappingURL=APIError.d.ts.map
|
|
@@ -1 +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;
|
|
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,MAAM,EAAE,MAAM,CAAC;gBAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;WAY5C,YAAY,CAAC,QAAQ,EAAE,QAAQ;CAsB7C"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
type RegisterPasskeyParams = {
|
|
3
|
+
createMfaToken?: CreateMfaToken;
|
|
4
|
+
};
|
|
1
5
|
/**
|
|
2
6
|
* Registers a new passkey for the current user.
|
|
3
7
|
*
|
|
@@ -5,9 +9,11 @@
|
|
|
5
9
|
* passwordless authentication. The user will be prompted to create a passkey
|
|
6
10
|
* using their device's biometric authentication or security key.
|
|
7
11
|
*
|
|
12
|
+
* @param [params.createMfaToken] - Optional configuration for MFA token creation.
|
|
8
13
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9
14
|
* @returns A promise that resolves to the registration response.
|
|
10
15
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
11
16
|
*/
|
|
12
|
-
export declare const registerPasskey: (client?: import("../../../../exports").DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
|
|
17
|
+
export declare const registerPasskey: ({ createMfaToken }?: RegisterPasskeyParams, client?: import("../../../../exports").DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
|
|
18
|
+
export {};
|
|
13
19
|
//# sourceMappingURL=registerPasskey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerPasskey.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/registerPasskey/registerPasskey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerPasskey.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/registerPasskey/registerPasskey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAUjE,KAAK,qBAAqB,GAAG;IAC3B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,wBACN,qBAAqB,uHAuB1C,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { CreateMfaToken } from '@dynamic-labs/sdk-api-core';
|
|
1
2
|
import { type RegistrationResponseJSON } from '@simplewebauthn/browser';
|
|
2
3
|
import type { DynamicClient } from '../../../../client/types';
|
|
3
4
|
type ServerRegisterPasskeyParams = {
|
|
5
|
+
createMfaToken?: CreateMfaToken;
|
|
4
6
|
registration: RegistrationResponseJSON;
|
|
5
7
|
};
|
|
6
|
-
export declare const serverRegisterPasskey: ({ registration }: ServerRegisterPasskeyParams, client: DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
|
|
8
|
+
export declare const serverRegisterPasskey: ({ registration, createMfaToken }: ServerRegisterPasskeyParams, client: DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").VerifyResponse>;
|
|
7
9
|
export {};
|
|
8
10
|
//# sourceMappingURL=serverRegisterPasskey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverRegisterPasskey.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,KAAK,2BAA2B,GAAG;IACjC,YAAY,EAAE,wBAAwB,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"serverRegisterPasskey.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,KAAK,2BAA2B,GAAG;IACjC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,EAAE,wBAAwB,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,qBAAqB,qCACE,2BAA2B,UACrD,aAAa,iEAoBtB,CAAC"}
|