Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added sequence diagrams to docs for enroll and auth #19

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ trusona.Initializer.initialize(origin)

## Enroll Your Users

![Enrollment sequence diagram](docs/images/tac-passkey-sdk-enrollment.png)

To enroll a user, from within your backend, generate a `JWT` token with the `subject` claim as a user's identifier or username.

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.
Expand All @@ -127,6 +129,9 @@ new trusona.WebAuthnEnrollment().enroll(jwt, controller.signal)

## Authenticate Your Users

![Authentication sequence diagram](docs/images/tac-passkey-sdk-authentication.png)


To authenticate a user, you can provide a username hint to the SDK or not - `lastUserHint()` is available to provide such a hint.

On success, a JWT is going to be provided in the SDK response that you can examine and verify the identity of the user.
Expand Down
Binary file added docs/images/tac-passkey-sdk-authentication.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tac-passkey-sdk-enrollment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/tac-passkey-sdk-authentication.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml
!include ../../../../style_puml.config

participant "Browser" as bro
participant "Trusona SDK" as sdk
participant "Customer Backend" as cust
participant "Trusona Auth Cloud" as core

== Authentication ==
bro -> sdk: authenticate (optional user hint)
sdk -> core: POST /authentications
core --> sdk: authentication response
sdk --> bro: (idToken, accessToken)
== Verification of accessToken ==
bro -> sdk: get Initializer.jwksEndpoint
sdk --> bro: jwks_endpoint
bro -> cust: verify accessToken with jwks_endpoint
cust -> core: GET /jwks_endpoint
core --> cust: jwks response
cust -> cust: verify accessToken with jwks
cust --> bro: verification success
bro -> cust: access with accessToken

@enduml
24 changes: 24 additions & 0 deletions docs/tac-passkey-sdk-enrollment.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml
!include ../../../../style_puml.config

participant "Browser" as bro
participant "Trusona SDK" as sdk
participant "Customer Backend" as cust
participant "Trusona Auth Cloud" as core

bro -> cust: Sign in using existing authentication method
cust --> bro: Success
bro -> sdk: enroll with JWT
sdk -> core: POST /attestation/options (JWT)
core -> cust: GET /jwks_endpoint
cust --> core: jwks response
core -> core: Validate JWT with jwks
core --> sdk: attestation_options, transaction_id
sdk -> bro: create webauthn credentials using attestation_options
bro --> sdk: attestation_options
sdk -> core: POST /enrollments (attestation_options, transaction_id)
core -> core: create passkey credential
core --> sdk: enrollment result
sdk --> bro: enrollment result

@enduml
Loading