I would like to ask a question regarding id
and rawId
.
When implementing webauthn, in the authenticator attestation response, I see that we have both id
and rawId
. Reading the spec (https://www.w3.org/TR/webauthn-1/#dom-publickeycredential-rawid) , id
is base64url(rawId)
{
"type": "public-key",
"id": "AV1--2gCLXLF9_5bGWDwZn6FP_OqAWfKY74mckatWMgN65o5OW8q2k9XVbYl8kAqPtpEoBlM0opKEjwDqYRBDIYbAl058O8ZQWS-r0M0L-9ikcu3tKuMxfFnRZ9gU6tnDH6QqzYwUg",
"rawId": "AV1--2gCLXLF9_5bGWDwZn6FP_OqAWfKY74mckatWMgN65o5OW8q2k9XVbYl8kAqPtpEoBlM0opKEjwDqYRBDIYbAl058O8ZQWS-r0M0L-9ikcu3tKuMxfFnRZ9gU6tnDH6QqzYwUg",
"response": {
...
}
...
}
So here is my questions:
- why we need
id
- why in the example above, my
id
is exactly likerawId
?- does it's always the same? If it does, can we get rid of
id
in the response?
- does it's always the same? If it does, can we get rid of
- If I save the public key
id
to the database (later use that public keyid
to create theallowCredentials
list), which one below should I follow?- save
id
in the database, useid
to create allowCredentials list - save
base64url(rawId)
in the database, then use that base64 url encoded value to createallowCredentials
list
- save