@better-auth/passkey 1.6.9 → 1.6.10

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/dist/client.d.mts CHANGED
@@ -39,6 +39,14 @@ declare const getPasskeyActions: ($fetch: BetterFetch, {
39
39
  user: User;
40
40
  };
41
41
  error: null;
42
+ } | {
43
+ data: null;
44
+ error: {
45
+ code: string;
46
+ message: string;
47
+ status: number;
48
+ statusText: string;
49
+ };
42
50
  } | {
43
51
  webauthn: {
44
52
  response: AuthenticationResponseJSON;
@@ -60,14 +68,6 @@ declare const getPasskeyActions: ($fetch: BetterFetch, {
60
68
  user: User;
61
69
  };
62
70
  error: null;
63
- } | {
64
- data: null;
65
- error: {
66
- code: string;
67
- message: string;
68
- status: number;
69
- statusText: string;
70
- };
71
71
  }>;
72
72
  };
73
73
  passkey: {
@@ -165,6 +165,14 @@ declare const passkeyClient: () => {
165
165
  user: User;
166
166
  };
167
167
  error: null;
168
+ } | {
169
+ data: null;
170
+ error: {
171
+ code: string;
172
+ message: string;
173
+ status: number;
174
+ statusText: string;
175
+ };
168
176
  } | {
169
177
  webauthn: {
170
178
  response: AuthenticationResponseJSON;
@@ -186,14 +194,6 @@ declare const passkeyClient: () => {
186
194
  user: User;
187
195
  };
188
196
  error: null;
189
- } | {
190
- data: null;
191
- error: {
192
- code: string;
193
- message: string;
194
- status: number;
195
- statusText: string;
196
- };
197
197
  }>;
198
198
  };
199
199
  passkey: {
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as PASSKEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-CAPMe0T2.mjs";
1
+ import { n as PASSKEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-DbMZAmvp.mjs";
2
2
  import { WebAuthnError, startAuthentication, startRegistration } from "@simplewebauthn/browser";
3
3
  import { useAuthQuery } from "better-auth/client";
4
4
  import { atom } from "nanostores";
@@ -10,18 +10,31 @@ const getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
10
10
  throw: false
11
11
  });
12
12
  if (!response.data) return response;
13
+ const mergedExtensions = response.data.extensions || opts?.extensions ? {
14
+ ...response.data.extensions || {},
15
+ ...opts?.extensions || {}
16
+ } : void 0;
17
+ let res;
13
18
  try {
14
- const mergedExtensions = response.data.extensions || opts?.extensions ? {
15
- ...response.data.extensions || {},
16
- ...opts?.extensions || {}
17
- } : void 0;
18
- const res = await startAuthentication({
19
+ res = await startAuthentication({
19
20
  optionsJSON: {
20
21
  ...response.data,
21
22
  extensions: mergedExtensions
22
23
  },
23
24
  useBrowserAutofill: opts?.autoFill
24
25
  });
26
+ } catch (err) {
27
+ return {
28
+ data: null,
29
+ error: {
30
+ code: err instanceof WebAuthnError ? err.code : "AUTH_CANCELLED",
31
+ message: PASSKEY_ERROR_CODES.AUTH_CANCELLED.message,
32
+ status: 400,
33
+ statusText: "BAD_REQUEST"
34
+ }
35
+ };
36
+ }
37
+ try {
25
38
  const { clientExtensionResults, ...responseBody } = res;
26
39
  const verified = await $fetch("/passkey/verify-authentication", {
27
40
  body: { response: responseBody },
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as PASSKEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-CAPMe0T2.mjs";
1
+ import { n as PASSKEY_ERROR_CODES, t as PACKAGE_VERSION } from "./version-DbMZAmvp.mjs";
2
2
  import { mergeSchema } from "better-auth/db";
3
3
  import { createAuthEndpoint } from "@better-auth/core/api";
4
4
  import { APIError } from "@better-auth/core/error";
@@ -18,6 +18,6 @@ const PASSKEY_ERROR_CODES = defineErrorCodes({
18
18
  });
19
19
  //#endregion
20
20
  //#region src/version.ts
21
- const PACKAGE_VERSION = "1.6.9";
21
+ const PACKAGE_VERSION = "1.6.10";
22
22
  //#endregion
23
23
  export { PASSKEY_ERROR_CODES as n, PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/passkey",
3
- "version": "1.6.9",
3
+ "version": "1.6.10",
4
4
  "description": "Passkey plugin for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -55,16 +55,16 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "tsdown": "0.21.1",
58
- "@better-auth/core": "1.6.9",
59
- "better-auth": "1.6.9"
58
+ "@better-auth/core": "1.6.10",
59
+ "better-auth": "1.6.10"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@better-auth/utils": "0.4.0",
63
63
  "@better-fetch/fetch": "1.1.21",
64
64
  "better-call": "1.3.5",
65
65
  "nanostores": "^1.0.1",
66
- "@better-auth/core": "^1.6.9",
67
- "better-auth": "^1.6.9"
66
+ "@better-auth/core": "^1.6.10",
67
+ "better-auth": "^1.6.10"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsdown",