diff --git a/protocol/attestation_test.go b/protocol/attestation_test.go index 2bee34d..cfe5e24 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/base64.go b/protocol/base64.go index 99362b2..37a151b 100644 --- a/protocol/base64.go +++ b/protocol/base64.go @@ -22,8 +22,13 @@ func (e *URLEncodedBase64) UnmarshalJSON(data []byte) error { return nil } + // TODO: Investigate this line. It is commented as trimming the leading spaces but appears to trim the leading and trailing double quotes instead. // Trim the leading spaces data = bytes.Trim(data, "\"") + + // Trim the trailing equal characters. + data = bytes.TrimRight(data, "=") + out := make([]byte, base64.RawURLEncoding.DecodedLen(len(data))) n, err := base64.RawURLEncoding.Decode(out, data) if err != nil {