As discussed here and here, even though we are storing credentialID as a base64Url, the generateAuthenticationOptions function requires it to be a buffer, and then converts it back to a base64Url.
This PR adds the ability to generateAuthenticationOptions to check if it is a string (i.e base64Url) and if it is will return it as is, if it is not a string (i.e it is a buffer) it will go through the existing conversion of buffer to base64Url. This allows users who are storing credentialID as a base64Url (which is recommended), to pass it in directly to generateAuthenticationOptions without having to convert it to a buffer first.
Thank you for the contribution @H3RSKO, but I'm closing this because I'll be solving this problem more comprehensively as part of addressing #528 (which was inspired by your PR.)
As discussed here and here, even though we are storing
credentialID
as abase64Url
, thegenerateAuthenticationOptions
function requires it to be a buffer, and then converts it back to abase64Url
.This PR adds the ability to
generateAuthenticationOptions
to check if it is a string (i.e base64Url) and if it is will return it as is, if it is not a string (i.e it is a buffer) it will go through the existing conversion of buffer to base64Url. This allows users who are storing credentialID as a base64Url (which is recommended), to pass it in directly to generateAuthenticationOptions without having to convert it to a buffer first.