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

WIP documentation of the WebAuthn signature payload #1314

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
27 changes: 27 additions & 0 deletions docs/en/pact-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,33 @@ signers:
type: exec
```

### WebAuthn Signature Format

The Pact REST API can accept transactions signed by the WebAuthn protocol.
imalsogreg marked this conversation as resolved.
Show resolved Hide resolved

A web client can use this scheme for authenticating and
signing Pact transactions without manually managing private keys. The client must:

- Modify the `Signer`, it must have `scheme` set to `"WebAuthn"`.
- Construct the challenge as: `base64( blake2b ( CommandPayload ))`
- Issue a JavaScript `navigator.credentials.get` with this challenge.
- Construct a `Signature` from the credentials response.
- Prefix any public keys generated by the WebAuthn client with `"WEBAUTHN-"`,
both in the `signers` field and in any keys supplied via env data.

The `"signature"` to pass to Pact (in the `"sigs"` field) is a stringified JSON
object composed of pieces taken from the browser's credential response, (the
`response` object, below). Some of the response fields must be converted from
the Base64URL alphabet to Base64:

```
{
imalsogreg marked this conversation as resolved.
Show resolved Hide resolved
"signature": toBase64(response.signature),
"authenticatorData": toBase64(response.authenticatorData),
"clientDataJSON": toBase64URL(response.clientDataJSON)
}
```


Concepts {#concepts}
========
Expand Down
Loading