Skip to content

Commit f0f82bb

Browse files
committed
update readme
1 parent ed70791 commit f0f82bb

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ and `WebAuthn` dependency to your target:
2323

2424
## Usage
2525

26-
The library exposes just four core methods through the `WebAuthnManager` struct:
26+
The library exposes just four core methods through the `WebAuthnManager` type:
2727

2828
- `WebAuthnManager.beginRegistration()`
2929
- `WebAuthnManager.finishRegistration()`
3030
- `WebAuthnManager.beginAuthentication()`
3131
- `WebAuthnManager.finishAuthentication()`
3232

3333
Generally, the library makes the following assumptions about how a Relying Party implementing this library will
34-
interface with a webpage that will handle calling the WebAuthn API:
34+
interface with a client that will handle calling the WebAuthn API:
3535

3636
1. JSON is the preferred data type for transmitting registration and authentication options from the server to
37-
the webpage to feed to `navigator.credentials.create()` and `navigator.credentials.get()` respectively.
37+
the client to feed to `navigator.credentials.create()` and `navigator.credentials.get()` respectively.
3838

39-
2. JSON is the preferred data type for transmitting WebAuthn responses from the browser to the Relying Party.
39+
2. JSON is the preferred data type for transmitting WebAuthn responses from the client to the Relying Party.
4040

4141
3. Bytes are not directly transmittable in either direction as JSON, and so should be encoded to and decoded
42-
from base64url. To make life a little bit easier there are two typealiases indicating whether something is expected,
43-
or returned, as base64/base64url:
42+
using Base64 URL encoding. To make life a little bit easier there are two typealiases indicating whether
43+
something is expected, or returned, as base64/base64url:
4444

4545
- `public typealias URLEncodedBase64 = String`
4646
- `public typealias EncodedBase64 = String`
@@ -81,7 +81,7 @@ Scenario: A user wants to signup on a website using WebAuthn.
8181
generated challenge and the received `RegistrationCredential`. If `finishRegistration` succeeds a new `Credential`
8282
object will be returned. This object contains information about the new credential, including an id and the generated public-key. Persist this data in e.g. a database and link the entry to the user.
8383

84-
#### Example implementation
84+
##### Example implementation (using Vapor)
8585

8686
```swift
8787
authSessionRoutes.get("makeCredential") { req -> PublicKeyCredentialCreationOptions in
@@ -120,9 +120,9 @@ Scenario: A user wants to log in on a website using WebAuthn.
120120

121121
1. When tapping the "Login" button the client sends a request to
122122
the backend. The backend responds to this request with a call to `beginAuthentication()` which then in turn
123-
returns a new `PublicKeyCredentialRequestOptions`. This must be send back to the client so it can pass it to
123+
returns a new `PublicKeyCredentialRequestOptions`. This must be sent back to the client so it can pass it to
124124
`navigator.credentials.get()`.
125-
2. Whatever `navigator.credentials.get()` returns will be send back to the backend, parsing it into
125+
2. Whatever `navigator.credentials.get()` returns will be sent back to the backend, parsing it into
126126
`AuthenticationCredential`.
127127
```swift
128128
let authenticationCredential = try req.content.decode(AuthenticationCredential.self)
@@ -137,8 +137,8 @@ Scenario: A user wants to log in on a website using WebAuthn.
137137
`credentialCurrentSignCount`.
138138

139139
4. If `finishAuthentication` succeeds you can safely login the user linked to the credential! `finishAuthentication`
140-
will return a `VerifiedAuthentication` with the updated sign count and a few other information meant to be persisted.
141-
Use this to update the credential in the database.
140+
will return a `VerifiedAuthentication` with the updated sign count and a few other pieces of information to be
141+
persisted. Use this to update the credential in the database.
142142

143143
#### Example implementation
144144

@@ -173,7 +173,8 @@ authSessionRoutes.post("authenticate") { req -> HTTPStatus in
173173

174174
## Credits
175175

176-
Swift WebAuthn is heavily inspired by existing WebAuthn libraries like [py_webauthn](https://github.com/duo-labs/py_webauthn) and [go-webauthn](https://github.com/go-webauthn/webauthn).
176+
Swift WebAuthn is heavily inspired by existing WebAuthn libraries like
177+
[py_webauthn](https://github.com/duo-labs/py_webauthn) and [go-webauthn](https://github.com/go-webauthn/webauthn).
177178

178179
## Links
179180

0 commit comments

Comments
 (0)