webauthn icon indicating copy to clipboard operation
webauthn copied to clipboard

Allow non-JSON assertions/attestations

Open lorenz opened this issue 3 years ago • 0 comments

Currently the parsing of credential data is wrapped up within UmarshalJSON, which is inconvenient if one uses a binary encoding (I use gRPC/Protobuf) to communicate with the client. The Webauthn Browser API already exposes the values as ArrayBuffers, which can be directly encoded by Protobuf.

Something like this (adapted from the existing interface in UnmarshalJSON) could work:

type RawAuthenticatorAttestationResponse struct {
  ClientDataJSON    []byte  // JSON-serialized client data passed to the authenticator by the client.
  AttestationObject []byte `json:"attestationObject"` // Attestation object, containing authenticator data and attestation statement.
}
type RawPublicKeyCredential struct {
  ID       []byte // Credential ID
  Response RawAuthenticatorAttestationResponse  // Authenticator's response to client's request to create a public key credential.
  Type     string                              `json:"type"`            // "public-key"
}

All []byte values would already be in binary.

lorenz avatar Jan 06 '21 21:01 lorenz