Skip to content

Commit

Permalink
feat: add support for passkey nodes (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl authored Jan 3, 2024
1 parent 8d3a0ed commit 276607f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
5 changes: 4 additions & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"COOKIE_SECRET": "I_AM_VERY_SECRET",
"CSRF_COOKIE_SECRET": "I_AM_VERY_SECRET_TOO",
"DANGEROUSLY_DISABLE_SECURE_CSRF_COOKIES": "true",
"ORY_SDK_URL": "http://localhost:4000"
"ORY_SDK_URL": "http://localhost:4433",
"KRATOS_PUBLIC_URL": "http://localhost:4433",
"KRATOS_ADMIN_URL": "http://localhost:4434",
"PORT": "4455"
}
}
2 changes: 1 addition & 1 deletion src/routes/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const createLoginRoute: RouteCreator =
nodes: flow.ui.nodes,
webAuthnHandler: filterNodesByGroups({
nodes: flow.ui.nodes,
groups: ["webauthn"],
groups: ["webauthn", "passkey"],
attributes: ["button"],
withoutDefaultAttributes: true,
withoutDefaultGroup: true,
Expand Down
25 changes: 13 additions & 12 deletions src/routes/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,21 @@ export const createRegistrationRoute: RouteCreator =
flow.oauth2_login_request.challenge,
)
}
res.render("registration", {
const webAuthnHandler = filterNodesByGroups({
nodes: flow.ui.nodes,
webAuthnHandler: filterNodesByGroups({
nodes: flow.ui.nodes,
groups: ["webauthn"],
attributes: ["button"],
withoutDefaultAttributes: true,
withoutDefaultGroup: true,
groups: ["webauthn", "passkey"],
attributes: ["button"],
withoutDefaultAttributes: true,
withoutDefaultGroup: true,
})
.filter(({ attributes }) => isUiNodeInputAttributes(attributes))
.map(({ attributes }) => {
return (attributes as UiNodeInputAttributes).onclick
})
.filter(({ attributes }) => isUiNodeInputAttributes(attributes))
.map(({ attributes }) => {
return (attributes as UiNodeInputAttributes).onclick
})
.filter((onClickAction) => !!onClickAction),
.filter((onClickAction) => !!onClickAction)
res.render("registration", {
nodes: flow.ui.nodes,
webAuthnHandler: webAuthnHandler,
card: UserAuthCard(
{
flow,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const createSettingsRoute: RouteCreator =
settingsScreen: settingsScreen.Body,
webAuthnHandler: filterNodesByGroups({
nodes: flow.ui.nodes,
groups: ["webauthn"],
groups: ["webauthn", "passkey"],
attributes: ["button"],
withoutDefaultAttributes: true,
withoutDefaultGroup: true,
Expand Down

0 comments on commit 276607f

Please sign in to comment.