Skip to content

Commit 8558aa9

Browse files
Add atomic api based passkey support
1 parent 4da8fb8 commit 8558aa9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9406
-197
lines changed

api/WIP/authentication.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ servers:
1717
default: "8090"
1818

1919
paths:
20-
/auth/webauthn/start:
20+
/auth/passkey/start:
2121
post:
22-
summary: Start WebAuthn authentication
23-
description: Initiate WebAuthn/Passkey authentication for a user.
22+
summary: Start Passkey authentication
23+
description: Initiate Passkey authentication for a user.
2424
tags:
25-
- WebAuthn / Passkey
25+
- Passkey / WebAuthn / FIDO2
2626
requestBody:
27-
description: WebAuthn authentication initiation data
27+
description: Passkey authentication initiation data
2828
required: true
2929
content:
3030
application/json:
3131
schema:
32-
$ref: '#/components/schemas/WebAuthnStartRequest'
32+
$ref: '#/components/schemas/PasskeyStartRequest'
3333
responses:
3434
"200":
3535
description: OK
3636
content:
3737
application/json:
3838
schema:
39-
$ref: '#/components/schemas/WebAuthnStartResponse'
39+
$ref: '#/components/schemas/PasskeyStartResponse'
4040
"400":
4141
description: 'Bad Request: The request body is malformed or contains invalid data'
4242
content:
@@ -46,7 +46,7 @@ paths:
4646
example:
4747
code: "AUTHN-1011"
4848
message: "Empty username"
49-
description: "The username is required to start WebAuthn authentication"
49+
description: "The username is required to start Passkey authentication"
5050
"404":
5151
description: 'Not Found: The user could not be found'
5252
content:
@@ -64,19 +64,19 @@ paths:
6464
schema:
6565
$ref: '#/components/schemas/ServerErrorResponse'
6666

67-
/auth/webauthn/finish:
67+
/auth/passkey/finish:
6868
post:
69-
summary: Finish WebAuthn authentication
70-
description: Complete WebAuthn/Passkey authentication for a user.
69+
summary: Finish Passkey authentication
70+
description: Complete Passkey authentication for a user.
7171
tags:
72-
- WebAuthn / Passkey
72+
- Passkey / WebAuthn / FIDO2
7373
requestBody:
74-
description: WebAuthn authentication completion data
74+
description: Passkey authentication completion data
7575
required: true
7676
content:
7777
application/json:
7878
schema:
79-
$ref: '#/components/schemas/WebAuthnFinishRequest'
79+
$ref: '#/components/schemas/PasskeyFinishRequest'
8080
responses:
8181
"200":
8282
description: OK
@@ -95,12 +95,12 @@ paths:
9595
value:
9696
code: "AUTHN-1012"
9797
message: "Empty credential ID"
98-
description: "The credential ID is required to complete WebAuthn authentication"
98+
description: "The credential ID is required to complete Passkey authentication"
9999
emptyCredentialType:
100100
value:
101101
code: "AUTHN-1013"
102102
message: "Empty credential type"
103-
description: "The credential type is required to complete WebAuthn authentication"
103+
description: "The credential type is required to complete Passkey authentication"
104104
invalidAuthenticatorResponse:
105105
value:
106106
code: "AUTHN-1014"
@@ -112,15 +112,15 @@ paths:
112112
message: "Empty session token"
113113
description: "The provided session token is empty"
114114
"401":
115-
description: 'Unauthorized: WebAuthn authentication failed'
115+
description: 'Unauthorized: Passkey authentication failed'
116116
content:
117117
application/json:
118118
schema:
119119
$ref: '#/components/schemas/ClientErrorResponse'
120120
example:
121-
code: "WEBAUTHN-1008"
121+
code: "PASS-1008"
122122
message: "Invalid signature"
123-
description: "The WebAuthn signature verification failed"
123+
description: "The Passkey signature verification failed"
124124
"404":
125125
description: 'Not Found: The user or credential could not be found'
126126
content:
@@ -159,7 +159,7 @@ components:
159159
description: "JWT assertion token for the authenticated user"
160160
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
161161

162-
WebAuthnStartRequest:
162+
PasskeyStartRequest:
163163
type: object
164164
properties:
165165
user_id:
@@ -174,12 +174,12 @@ components:
174174
- user_id
175175
- relying_party_id
176176

177-
WebAuthnStartResponse:
177+
PasskeyStartResponse:
178178
type: object
179179
properties:
180180
publicKeyCredentialRequestOptions:
181181
type: object
182-
description: PublicKeyCredentialRequestOptions as per WebAuthn standard
182+
description: PublicKeyCredentialRequestOptions as per Passkey standard
183183
properties:
184184
challenge:
185185
type: string
@@ -235,19 +235,19 @@ components:
235235
userVerification: "preferred"
236236
session_token:
237237
type: string
238-
description: JWT token for the WebAuthn authentication session
238+
description: JWT token for the Passkey authentication session
239239
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
240240
required:
241241
- publicKeyCredentialRequestOptions
242242
- session_token
243243

244244

245-
WebAuthnFinishRequest:
245+
PasskeyFinishRequest:
246246
type: object
247247
properties:
248248
publicKeyCredential:
249249
type: object
250-
description: PublicKeyCredential as per WebAuthn standard
250+
description: PublicKeyCredential as per Passkey standard
251251
properties:
252252
id:
253253
type: string
@@ -307,7 +307,7 @@ components:
307307
authenticatorAttachment: "platform"
308308
session_token:
309309
type: string
310-
description: JWT token for the WebAuthn authentication session
310+
description: JWT token for the Passkey authentication session
311311
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
312312
skip_assertion:
313313
type: boolean

api/WIP/registration.yaml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.0.3
22

33
info:
44
title: Registration API
5-
description: This API is used for user registration operations including WebAuthn/Passkey registration.
5+
description: This API is used for user registration operations including Passkey registration.
66
version: "1.0"
77
license:
88
name: Apache 2.0
@@ -17,26 +17,26 @@ servers:
1717
default: "8090"
1818

1919
paths:
20-
/register/webauthn/start:
20+
/register/passkey/start:
2121
post:
22-
summary: Start WebAuthn credential registration
23-
description: Initiate WebAuthn/Passkey credential creation for a user.
22+
summary: Start Passkey credential registration
23+
description: Initiate Passkey credential creation for a user.
2424
tags:
25-
- WebAuthn / Passkey Registration
25+
- Passkey / WebAuthn / FIDO2 Registration
2626
requestBody:
27-
description: WebAuthn credential creation initiation data
27+
description: Passkey credential creation initiation data
2828
required: true
2929
content:
3030
application/json:
3131
schema:
32-
$ref: '#/components/schemas/WebAuthnRegistrationStartRequest'
32+
$ref: '#/components/schemas/PasskeyRegistrationStartRequest'
3333
responses:
3434
"200":
3535
description: OK
3636
content:
3737
application/json:
3838
schema:
39-
$ref: '#/components/schemas/WebAuthnRegistrationStartResponse'
39+
$ref: '#/components/schemas/PasskeyRegistrationStartResponse'
4040
"400":
4141
description: 'Bad Request: The request body is malformed or contains invalid data'
4242
content:
@@ -46,7 +46,7 @@ paths:
4646
example:
4747
code: "AUTHN-1011"
4848
message: "Empty user ID"
49-
description: "The user ID is required to start WebAuthn registration"
49+
description: "The user ID is required to start registration"
5050
"404":
5151
description: 'Not Found: The user could not be found'
5252
content:
@@ -68,26 +68,26 @@ paths:
6868
message: "Internal server error"
6969
description: "An unexpected error occurred while processing the request"
7070

71-
/register/webauthn/finish:
71+
/register/passkey/finish:
7272
post:
73-
summary: Finish WebAuthn credential registration
74-
description: Complete WebAuthn/Passkey credential creation for a user.
73+
summary: Finish Passkey credential registration
74+
description: Complete Passkey credential creation for a user.
7575
tags:
76-
- WebAuthn / Passkey Registration
76+
- Passkey / WebAuthn / FIDO2 Registration
7777
requestBody:
78-
description: WebAuthn credential creation completion data
78+
description: Passkey credential creation completion data
7979
required: true
8080
content:
8181
application/json:
8282
schema:
83-
$ref: '#/components/schemas/WebAuthnRegistrationFinishRequest'
83+
$ref: '#/components/schemas/PasskeyRegistrationFinishRequest'
8484
responses:
8585
"200":
8686
description: OK
8787
content:
8888
application/json:
8989
schema:
90-
$ref: '#/components/schemas/WebAuthnRegistrationFinishResponse'
90+
$ref: '#/components/schemas/PasskeyRegistrationFinishResponse'
9191
"400":
9292
description: 'Bad Request: The request body is malformed or contains invalid data'
9393
content:
@@ -99,12 +99,12 @@ paths:
9999
value:
100100
code: "AUTHN-1012"
101101
message: "Empty credential ID"
102-
description: "The credential ID is required to complete WebAuthn registration"
102+
description: "The credential ID is required to complete registration"
103103
emptyCredentialType:
104104
value:
105105
code: "AUTHN-1013"
106106
message: "Empty credential type"
107-
description: "The credential type is required to complete WebAuthn registration"
107+
description: "The credential type is required to complete registration"
108108
invalidAttestationResponse:
109109
value:
110110
code: "AUTHN-1015"
@@ -116,15 +116,15 @@ paths:
116116
message: "Empty session token"
117117
description: "The provided session token is empty"
118118
"401":
119-
description: 'Unauthorized: WebAuthn registration verification failed'
119+
description: 'Unauthorized: Passkey registration verification failed'
120120
content:
121121
application/json:
122122
schema:
123123
$ref: '#/components/schemas/ClientErrorResponse'
124124
example:
125-
code: "WEBAUTHN-1009"
125+
code: "PASS-1009"
126126
message: "Invalid attestation"
127-
description: "The WebAuthn attestation verification failed"
127+
description: "The Passkey attestation verification failed"
128128
"404":
129129
description: 'Not Found: The user could not be found'
130130
content:
@@ -148,7 +148,7 @@ paths:
148148

149149
components:
150150
schemas:
151-
WebAuthnRegistrationStartRequest:
151+
PasskeyRegistrationStartRequest:
152152
type: object
153153
properties:
154154
userId:
@@ -195,7 +195,7 @@ components:
195195
- userId
196196
- relyingPartyId
197197

198-
WebAuthnRegistrationStartResponse:
198+
PasskeyRegistrationStartResponse:
199199
type: object
200200
properties:
201201
publicKeyCredentialCreationOptions:
@@ -342,12 +342,12 @@ components:
342342
- publicKeyCredentialCreationOptions
343343
- sessionToken
344344

345-
WebAuthnRegistrationFinishRequest:
345+
PasskeyRegistrationFinishRequest:
346346
type: object
347347
properties:
348348
publicKeyCredential:
349349
type: object
350-
description: PublicKeyCredential as per WebAuthn standard
350+
description: PublicKeyCredential as per Passkey standard
351351
properties:
352352
id:
353353
type: string
@@ -404,7 +404,7 @@ components:
404404
authenticatorAttachment: "platform"
405405
sessionToken:
406406
type: string
407-
description: JWT token for the WebAuthn registration session
407+
description: JWT token for the Passkey registration session
408408
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
409409
credentialName:
410410
type: string
@@ -414,7 +414,7 @@ components:
414414
- publicKeyCredential
415415
- sessionToken
416416

417-
WebAuthnRegistrationFinishResponse:
417+
PasskeyRegistrationFinishResponse:
418418
type: object
419419
properties:
420420
credentialId:

backend/cmd/server/repository/conf/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ crypto:
3939
cors:
4040
allowed_origins:
4141
- "https://localhost:3000"
42+
43+
passkey:
44+
allowed_origins:
45+
- "https://localhost:8090"
46+
- "https://localhost:5190"
47+
- "https://localhost:5191"

backend/dbscripts/runtimedb/postgres.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,21 @@ CREATE TABLE FLOW_USER_DATA (
6868

6969
-- Index for deployment isolation on FLOW_USER_DATA
7070
CREATE INDEX idx_flow_user_data_deployment_id ON FLOW_USER_DATA (DEPLOYMENT_ID);
71+
72+
-- Table to store WebAuthn session data
73+
CREATE TABLE WEBAUTHN_SESSION (
74+
SESSION_KEY VARCHAR(255) NOT NULL,
75+
DEPLOYMENT_ID VARCHAR(255) NOT NULL,
76+
USER_ID VARCHAR(36) NOT NULL,
77+
RELYING_PARTY_ID VARCHAR(255) NOT NULL,
78+
SESSION_DATA JSONB NOT NULL,
79+
CREATED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
80+
EXPIRY_TIME TIMESTAMP NOT NULL,
81+
PRIMARY KEY (SESSION_KEY, DEPLOYMENT_ID)
82+
);
83+
84+
-- Index for deployment isolation on WEBAUTHN_SESSION
85+
CREATE INDEX idx_webauthn_session_deployment_id ON WEBAUTHN_SESSION (DEPLOYMENT_ID);
86+
87+
-- Index for expiry time on WEBAUTHN_SESSION
88+
CREATE INDEX idx_webauthn_session_expiry_time ON WEBAUTHN_SESSION (EXPIRY_TIME);

backend/dbscripts/runtimedb/sqlite.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,21 @@ CREATE TABLE FLOW_USER_DATA (
6868

6969
-- Index for deployment isolation on FLOW_USER_DATA
7070
CREATE INDEX idx_flow_user_data_deployment_id ON FLOW_USER_DATA (DEPLOYMENT_ID);
71+
72+
-- Table to store WebAuthn session data
73+
CREATE TABLE WEBAUTHN_SESSION (
74+
SESSION_KEY VARCHAR(255) NOT NULL,
75+
DEPLOYMENT_ID VARCHAR(255) NOT NULL,
76+
USER_ID VARCHAR(36) NOT NULL,
77+
RELYING_PARTY_ID VARCHAR(255) NOT NULL,
78+
SESSION_DATA TEXT NOT NULL,
79+
CREATED_AT TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
80+
EXPIRY_TIME DATETIME NOT NULL,
81+
PRIMARY KEY (SESSION_KEY, DEPLOYMENT_ID)
82+
);
83+
84+
-- Index for deployment isolation on WEBAUTHN_SESSION
85+
CREATE INDEX idx_webauthn_session_deployment_id ON WEBAUTHN_SESSION (DEPLOYMENT_ID);
86+
87+
-- Index for expiry time on WEBAUTHN_SESSION
88+
CREATE INDEX idx_webauthn_session_expiry_time ON WEBAUTHN_SESSION (EXPIRY_TIME);

0 commit comments

Comments
 (0)