Skip to content

Commit c643902

Browse files
committed
ref(go): move and simplify go-webauthn/webauthn example
1 parent 048c97d commit c643902

File tree

6 files changed

+175
-269
lines changed

6 files changed

+175
-269
lines changed

go-webauthn-verify-demo/go.mod

Lines changed: 0 additions & 19 deletions
This file was deleted.

go-webauthn-verify-demo/main.go

Lines changed: 0 additions & 250 deletions
This file was deleted.

go/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,28 @@ implementaiton of OAuth2).
1919
One of the most practically useful features is that if an authenticator has ever
2020
given a counter, then any subsequent use must have a counter higher than the
2121
previous one, or it should fail. This prevents hardware cloning.
22+
23+
# PassKeys with go-webauthn/webauthn
24+
25+
This follows all of the WebAuthn _ceremonies_, but implements far more than is
26+
used in a practical setting among any of the authenticators that implement
27+
WebAuthn, which can be confusing.
28+
29+
```sh
30+
go run ./cmd/webauthn-verify/ ../fixtures/apple-m2-01-credential-creation-response.json ../fixtures/apple-m2-02-credential-request-response.json
31+
```
32+
33+
The key bits that you'll need to know are:
34+
35+
```go
36+
err = parsedCredentialRequest.Verify(
37+
challenge,
38+
rpID,
39+
allowedOrigins,
40+
topOrigins,
41+
protocol.TopOriginAutoVerificationMode,
42+
appId,
43+
userVerification,
44+
parsedCredentialCreation.Response.AttestationObject.AuthData.AttData.CredentialPublicKey,
45+
)
46+
```

0 commit comments

Comments
 (0)