@better-auth/passkey 1.4.4 → 1.4.6-beta.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/dist/client.d.mts
CHANGED
|
@@ -155,7 +155,6 @@ declare const passkey: (options?: PasskeyOptions | undefined) => {
|
|
|
155
155
|
name: z.ZodOptional<z.ZodString>;
|
|
156
156
|
}, z.core.$strip>>;
|
|
157
157
|
metadata: {
|
|
158
|
-
client: boolean;
|
|
159
158
|
openapi: {
|
|
160
159
|
operationId: string;
|
|
161
160
|
description: string;
|
|
@@ -608,7 +607,9 @@ declare const passkey: (options?: PasskeyOptions | undefined) => {
|
|
|
608
607
|
};
|
|
609
608
|
} & {
|
|
610
609
|
use: any[];
|
|
611
|
-
},
|
|
610
|
+
}, {
|
|
611
|
+
status: boolean;
|
|
612
|
+
}>;
|
|
612
613
|
/**
|
|
613
614
|
* ### Endpoint
|
|
614
615
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Passkey, r as PasskeyOptions, t as passkey } from "./index-
|
|
1
|
+
import { n as Passkey, r as PasskeyOptions, t as passkey } from "./index-DhzUw_n7.mjs";
|
|
2
2
|
export { Passkey, PasskeyOptions, passkey };
|
package/dist/index.mjs
CHANGED
|
@@ -102,85 +102,82 @@ const passkey = (options) => {
|
|
|
102
102
|
authenticatorAttachment: z.enum(["platform", "cross-platform"]).optional(),
|
|
103
103
|
name: z.string().optional()
|
|
104
104
|
}).optional(),
|
|
105
|
-
metadata: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
description: "
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
authenticatorAttachment: {
|
|
114
|
-
description: `Type of authenticator to use for registration.
|
|
105
|
+
metadata: { openapi: {
|
|
106
|
+
operationId: "generatePasskeyRegistrationOptions",
|
|
107
|
+
description: "Generate registration options for a new passkey",
|
|
108
|
+
responses: { 200: {
|
|
109
|
+
description: "Success",
|
|
110
|
+
parameters: { query: {
|
|
111
|
+
authenticatorAttachment: {
|
|
112
|
+
description: `Type of authenticator to use for registration.
|
|
115
113
|
"platform" for device-specific authenticators,
|
|
116
114
|
"cross-platform" for authenticators that can be used across devices.`,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
required: false
|
|
116
|
+
},
|
|
117
|
+
name: {
|
|
118
|
+
description: `Optional custom name for the passkey.
|
|
121
119
|
This can help identify the passkey when managing multiple credentials.`,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
120
|
+
required: false
|
|
121
|
+
}
|
|
122
|
+
} },
|
|
123
|
+
content: { "application/json": { schema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
challenge: { type: "string" },
|
|
127
|
+
rp: {
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
name: { type: "string" },
|
|
131
|
+
id: { type: "string" }
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
user: {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
id: { type: "string" },
|
|
138
|
+
name: { type: "string" },
|
|
139
|
+
displayName: { type: "string" }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
pubKeyCredParams: {
|
|
143
|
+
type: "array",
|
|
144
|
+
items: {
|
|
130
145
|
type: "object",
|
|
131
146
|
properties: {
|
|
132
|
-
|
|
133
|
-
|
|
147
|
+
type: { type: "string" },
|
|
148
|
+
alg: { type: "number" }
|
|
134
149
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
timeout: { type: "number" },
|
|
153
|
+
excludeCredentials: {
|
|
154
|
+
type: "array",
|
|
155
|
+
items: {
|
|
137
156
|
type: "object",
|
|
138
157
|
properties: {
|
|
139
158
|
id: { type: "string" },
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
pubKeyCredParams: {
|
|
145
|
-
type: "array",
|
|
146
|
-
items: {
|
|
147
|
-
type: "object",
|
|
148
|
-
properties: {
|
|
149
|
-
type: { type: "string" },
|
|
150
|
-
alg: { type: "number" }
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
timeout: { type: "number" },
|
|
155
|
-
excludeCredentials: {
|
|
156
|
-
type: "array",
|
|
157
|
-
items: {
|
|
158
|
-
type: "object",
|
|
159
|
-
properties: {
|
|
160
|
-
id: { type: "string" },
|
|
161
|
-
type: { type: "string" },
|
|
162
|
-
transports: {
|
|
163
|
-
type: "array",
|
|
164
|
-
items: { type: "string" }
|
|
165
|
-
}
|
|
159
|
+
type: { type: "string" },
|
|
160
|
+
transports: {
|
|
161
|
+
type: "array",
|
|
162
|
+
items: { type: "string" }
|
|
166
163
|
}
|
|
167
164
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
} }
|
|
182
|
-
}
|
|
183
|
-
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
authenticatorSelection: {
|
|
168
|
+
type: "object",
|
|
169
|
+
properties: {
|
|
170
|
+
authenticatorAttachment: { type: "string" },
|
|
171
|
+
requireResidentKey: { type: "boolean" },
|
|
172
|
+
userVerification: { type: "string" }
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
attestation: { type: "string" },
|
|
176
|
+
extensions: { type: "object" }
|
|
177
|
+
}
|
|
178
|
+
} } }
|
|
179
|
+
} }
|
|
180
|
+
} }
|
|
184
181
|
}, async (ctx) => {
|
|
185
182
|
const { session } = ctx.context;
|
|
186
183
|
const userPasskeys = await ctx.context.adapter.findMany({
|
|
@@ -506,17 +503,23 @@ const passkey = (options) => {
|
|
|
506
503
|
} }
|
|
507
504
|
} }
|
|
508
505
|
}, async (ctx) => {
|
|
509
|
-
await ctx.context.adapter.
|
|
506
|
+
const passkey$1 = await ctx.context.adapter.findOne({
|
|
510
507
|
model: "passkey",
|
|
511
508
|
where: [{
|
|
512
509
|
field: "id",
|
|
513
510
|
value: ctx.body.id
|
|
514
|
-
}, {
|
|
515
|
-
field: "userId",
|
|
516
|
-
value: ctx.context.session.user.id
|
|
517
511
|
}]
|
|
518
512
|
});
|
|
519
|
-
|
|
513
|
+
if (!passkey$1) throw new APIError("NOT_FOUND", { message: PASSKEY_ERROR_CODES.PASSKEY_NOT_FOUND });
|
|
514
|
+
if (passkey$1.userId !== ctx.context.session.user.id) throw new APIError("UNAUTHORIZED");
|
|
515
|
+
await ctx.context.adapter.delete({
|
|
516
|
+
model: "passkey",
|
|
517
|
+
where: [{
|
|
518
|
+
field: "id",
|
|
519
|
+
value: passkey$1.id
|
|
520
|
+
}]
|
|
521
|
+
});
|
|
522
|
+
return ctx.json({ status: true });
|
|
520
523
|
}),
|
|
521
524
|
updatePasskey: createAuthEndpoint("/passkey/update-passkey", {
|
|
522
525
|
method: "POST",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/passkey",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Passkey plugin for Better Auth",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsdown": "^0.16.0",
|
|
35
|
-
"@better-auth/core": "1.4.
|
|
36
|
-
"better-auth": "1.4.
|
|
35
|
+
"@better-auth/core": "1.4.6-beta.2",
|
|
36
|
+
"better-auth": "1.4.6-beta.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@simplewebauthn/browser": "^13.1.2",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@better-auth/utils": "0.3.0",
|
|
45
45
|
"@better-fetch/fetch": "1.1.18",
|
|
46
|
-
"better-call": "1.1.
|
|
46
|
+
"better-call": "1.1.4",
|
|
47
47
|
"nanostores": "^1.0.1",
|
|
48
|
-
"@better-auth/core": "1.4.
|
|
49
|
-
"better-auth": "1.4.
|
|
48
|
+
"@better-auth/core": "1.4.6-beta.2",
|
|
49
|
+
"better-auth": "1.4.6-beta.2"
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"dist"
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"license": "MIT",
|
|
67
67
|
"scripts": {
|
|
68
68
|
"test": "vitest",
|
|
69
|
+
"lint:package": "publint run --strict",
|
|
69
70
|
"build": "tsdown",
|
|
70
71
|
"dev": "tsdown --watch",
|
|
71
72
|
"typecheck": "tsc --project tsconfig.json"
|