From 3d8dfc7668ef8027c2e92fb928fefeabe9799f2f Mon Sep 17 00:00:00 2001 From: James Elliott Date: Sun, 29 Jan 2023 10:26:20 +1100 Subject: [PATCH] fix(protocol): user entity id not encoded correctly (#98) This fixes an issue where the protocol.UserEntity field ID was encoded with Base64 URL Encoding with padding instead of without padding. Fixes #97 --- protocol/attestation_test.go | 6 +++--- protocol/entities.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol/attestation_test.go b/protocol/attestation_test.go index cfe5e247..2bee34de 100644 --- a/protocol/attestation_test.go +++ b/protocol/attestation_test.go @@ -91,7 +91,7 @@ var testAttestationOptions = []string{ "user": { "name": "self", "displayName": "self", - "id": "2iEAAAAAAAAAAA==" + "id": "2iEAAAAAAAAAAA" }, "pubKeyCredParams": [ { @@ -116,7 +116,7 @@ var testAttestationOptions = []string{ "user": { "name": "flort", "displayName": "flort", - "id": "1DMAAAAAAAAAAA==" + "id": "1DMAAAAAAAAAAA" }, "pubKeyCredParams": [ { @@ -142,7 +142,7 @@ var testAttestationOptions = []string{ "user": { "name": "testuser1", "displayName": "testuser1", - "id": "1zMAAAAAAAAAAA==" + "id": "1zMAAAAAAAAAAA" }, "pubKeyCredParams": [ { diff --git a/protocol/entities.go b/protocol/entities.go index 5b146caa..cbe829f5 100644 --- a/protocol/entities.go +++ b/protocol/entities.go @@ -44,5 +44,5 @@ type UserEntity struct { // authentication and authorization decisions MUST be made on the basis of this id // member, not the displayName nor name members. See Section 6.1 of // [RFC8266](https://www.w3.org/TR/webauthn/#biblio-rfc8266). - ID []byte `json:"id"` + ID URLEncodedBase64 `json:"id"` }