Skip to content

Commit 0215e09

Browse files
authored
Merge pull request #19 from trusona/add-doc-diagrams
added sequence diagrams to docs for enroll and auth
2 parents 02ecb7e + ee996a6 commit 0215e09

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ trusona.Initializer.initialize(origin)
105105

106106
## Enroll Your Users
107107

108+
![Enrollment sequence diagram](docs/images/tac-passkey-sdk-enrollment.png)
109+
108110
To enroll a user, from within your backend, generate a `JWT` token with the `subject` claim as a user's identifier or username.
109111

110112
This identifier does not need to be an email address, but it should uniquely identify the user and they should be able to recognize it as their username.
@@ -127,6 +129,9 @@ new trusona.WebAuthnEnrollment().enroll(jwt, controller.signal)
127129

128130
## Authenticate Your Users
129131

132+
![Authentication sequence diagram](docs/images/tac-passkey-sdk-authentication.png)
133+
134+
130135
To authenticate a user, you can provide a username hint to the SDK or not - `lastUserHint()` is available to provide such a hint.
131136

132137
On success, a JWT is going to be provided in the SDK response that you can examine and verify the identity of the user.
39.4 KB
Loading
40.2 KB
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@startuml
2+
!include ../../../../style_puml.config
3+
4+
participant "Browser" as bro
5+
participant "Trusona SDK" as sdk
6+
participant "Customer Backend" as cust
7+
participant "Trusona Auth Cloud" as core
8+
9+
== Authentication ==
10+
bro -> sdk: authenticate (optional user hint)
11+
sdk -> core: POST /authentications
12+
core --> sdk: authentication response
13+
sdk --> bro: (idToken, accessToken)
14+
== Verification of accessToken ==
15+
bro -> sdk: get Initializer.jwksEndpoint
16+
sdk --> bro: jwks_endpoint
17+
bro -> cust: verify accessToken with jwks_endpoint
18+
cust -> core: GET /jwks_endpoint
19+
core --> cust: jwks response
20+
cust -> cust: verify accessToken with jwks
21+
cust --> bro: verification success
22+
bro -> cust: access with accessToken
23+
24+
@enduml

docs/tac-passkey-sdk-enrollment.puml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@startuml
2+
!include ../../../../style_puml.config
3+
4+
participant "Browser" as bro
5+
participant "Trusona SDK" as sdk
6+
participant "Customer Backend" as cust
7+
participant "Trusona Auth Cloud" as core
8+
9+
bro -> cust: Sign in using existing authentication method
10+
cust --> bro: Success
11+
bro -> sdk: enroll with JWT
12+
sdk -> core: POST /attestation/options (JWT)
13+
core -> cust: GET /jwks_endpoint
14+
cust --> core: jwks response
15+
core -> core: Validate JWT with jwks
16+
core --> sdk: attestation_options, transaction_id
17+
sdk -> bro: create webauthn credentials using attestation_options
18+
bro --> sdk: attestation_options
19+
sdk -> core: POST /enrollments (attestation_options, transaction_id)
20+
core -> core: create passkey credential
21+
core --> sdk: enrollment result
22+
sdk --> bro: enrollment result
23+
24+
@enduml

0 commit comments

Comments
 (0)