Skip to content

Commit 276607f

Browse files
authored
feat: add support for passkey nodes (#306)
1 parent 8d3a0ed commit 276607f

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

nodemon.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"COOKIE_SECRET": "I_AM_VERY_SECRET",
88
"CSRF_COOKIE_SECRET": "I_AM_VERY_SECRET_TOO",
99
"DANGEROUSLY_DISABLE_SECURE_CSRF_COOKIES": "true",
10-
"ORY_SDK_URL": "http://localhost:4000"
10+
"ORY_SDK_URL": "http://localhost:4433",
11+
"KRATOS_PUBLIC_URL": "http://localhost:4433",
12+
"KRATOS_ADMIN_URL": "http://localhost:4434",
13+
"PORT": "4455"
1114
}
1215
}

src/routes/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const createLoginRoute: RouteCreator =
173173
nodes: flow.ui.nodes,
174174
webAuthnHandler: filterNodesByGroups({
175175
nodes: flow.ui.nodes,
176-
groups: ["webauthn"],
176+
groups: ["webauthn", "passkey"],
177177
attributes: ["button"],
178178
withoutDefaultAttributes: true,
179179
withoutDefaultGroup: true,

src/routes/registration.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,21 @@ export const createRegistrationRoute: RouteCreator =
7979
flow.oauth2_login_request.challenge,
8080
)
8181
}
82-
res.render("registration", {
82+
const webAuthnHandler = filterNodesByGroups({
8383
nodes: flow.ui.nodes,
84-
webAuthnHandler: filterNodesByGroups({
85-
nodes: flow.ui.nodes,
86-
groups: ["webauthn"],
87-
attributes: ["button"],
88-
withoutDefaultAttributes: true,
89-
withoutDefaultGroup: true,
84+
groups: ["webauthn", "passkey"],
85+
attributes: ["button"],
86+
withoutDefaultAttributes: true,
87+
withoutDefaultGroup: true,
88+
})
89+
.filter(({ attributes }) => isUiNodeInputAttributes(attributes))
90+
.map(({ attributes }) => {
91+
return (attributes as UiNodeInputAttributes).onclick
9092
})
91-
.filter(({ attributes }) => isUiNodeInputAttributes(attributes))
92-
.map(({ attributes }) => {
93-
return (attributes as UiNodeInputAttributes).onclick
94-
})
95-
.filter((onClickAction) => !!onClickAction),
93+
.filter((onClickAction) => !!onClickAction)
94+
res.render("registration", {
95+
nodes: flow.ui.nodes,
96+
webAuthnHandler: webAuthnHandler,
9697
card: UserAuthCard(
9798
{
9899
flow,

src/routes/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const createSettingsRoute: RouteCreator =
7979
settingsScreen: settingsScreen.Body,
8080
webAuthnHandler: filterNodesByGroups({
8181
nodes: flow.ui.nodes,
82-
groups: ["webauthn"],
82+
groups: ["webauthn", "passkey"],
8383
attributes: ["button"],
8484
withoutDefaultAttributes: true,
8585
withoutDefaultGroup: true,

0 commit comments

Comments
 (0)