convertPublicKeyToPEM not working #173
Replies: 4 comments 3 replies
-
@MartTave Can you include a code sample of how you're calling |
Beta Was this translation helpful? Give feedback.
-
Yup, here's the call
For the authenticator value, as you can see. I'm reading it from a file. Here's the file content
Thanks for you time ! Tavernier Martin |
Beta Was this translation helpful? Give feedback.
-
Aww dang, I didn't get an email that you'd responded, apologies for the delay. I'll take a look tonight or tomorrow and follow up |
Beta Was this translation helpful? Give feedback.
-
@MasterKale I'd like to follow up on this. This issue still persists for me. On the authentication generation side of thing;
On the verification end of things;
I still get the same error as defined |
Beta Was this translation helpful? Give feedback.
-
Hello,
First of all thank you for this lib, I was struggling trying to implement a simple webauthn lib and found your that worked perfectly !
But I encountered a small problem. While trying to validate the login (authenticate) challenge by calling
verifyAuthenticationResponse
, I got an error in the convertPublicKeyToPEM.js file on the line 17const kty = struct.get(convertCOSEtoPKCS_1.COSEKEYS.kty);
. It was telling meTypeError: struct.get is not a function
. While debugging, I found thatstruct
wasundefined
as thecbor_1.default.decodeAllSync
returned an empty array. While trying many things, I changed that line fromstruct = cbor_1.default.decodeAllSync(publicKey)[0];
tostruct = cbor_1.default.decodeAllSync(Buffer.from(publicKey))[0];
(Added aBuffer.from()
) before using the publicKey. And now it seems to work. I post here because I'm not confident in what i'm doing and I want to make the best implementation possible. Is it normal that I need to do that in order for this function to work ?For infos, I'm first trying to make this work, my plan is to have only my key registered in the db and authorize access only to people having access to my physical key (i.e. me). For now, I'm saving the data in a file in plaintext for convenience but in the near future I'll be setting a database for it. I've tested it while keeping the authenticator in memory from the registration to the authentication to see if it was the file encoding that was messing things up but it seems that that wasn't the case as it wasn't working either.
Sorry for my bad english
Tavernier Martin
Beta Was this translation helpful? Give feedback.
All reactions