error converting public key to pem #272
Replies: 8 comments 10 replies
-
Are you able to grab a full callstack? I imagine this is an error raised when you called |
Beta Was this translation helpful? Give feedback.
-
Did some additional troubleshooting. When I said earlier it worked locally, that wasn't precisely correct. It works locally running |
Beta Was this translation helpful? Give feedback.
-
Huh, interesting. So I'm looking at the source for that particular file: https://github.com/MasterKale/SimpleWebAuthn/blob/master/packages/server/src/helpers/convertPublicKeyToPEM.ts The lines there are:
But the dist version I have downloaded completely drops the |
Beta Was this translation helpful? Give feedback.
-
I took a closer look at the method when running without webpack - the types of |
Beta Was this translation helpful? Give feedback.
-
Hmm, you mentioned Nuxt. Is |
Beta Was this translation helpful? Give feedback.
-
Ran into another weird probably-just-me blocker but I figured I'd toss it out here just in case. Webpack (4, if it matters) seems to be doing something funky. In my Vue component I'm using
The stack trace shows a bunch of webpack stuff and I can only imagine that webpack is trying to convert this into a CommonJS format for some reason. :sigh: Nothing is ever simple, huh... |
Beta Was this translation helpful? Give feedback.
-
Oh, interesting. I'll have to see if I can switch it up to some sort of
middleware context instead. Weird that it still works though in dev mode
though...
…On Wed, Sep 21, 2022, 15:36 Matthew Miller ***@***.***> wrote:
Hmm, you mentioned Nuxt. Is verifyAuthenticationResponse() being executed
in the browser? Because Buffer is a *Node-specific* type, and is not
supported in browsers. Uint8Array is what Buffers are under the hood, but
***@***.***/server* methods expect to be run in a Node-like runtime
with Buffer support, which does not include browsers. 🤔
—
Reply to this email directly, view it on GitHub
<#272 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJF3W52JCZZLIJHKT5TAF3V7NPTZANCNFSM6AAAAAAQSCD77I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Finally got it up and running with Nuxt! I'm taking advantage of my platform's ability to fire up a serverless environment and using Firebase as both a user repository (Firebase Auth) and as a metadata store about those users (Realtime DB). Source code available at https://github.com/tmountjr/webauthn-firebase-nuxt. It's deployed at https://webauthn.tommount.net. Nuxt has the ability to run what it calls "server middleware" - basically running an express server in the background that handles requests exclusively serverside. I could also have those auth routes handled by Nuxt directly rather than shortcutting things with a platform that does that maybe slightly more reliably, but that's a project for later. I think the original intent of this discussion - "why doesn't the server code work in a browser?" - has been answered, and there's a proof-of-concept how something like this integrates with a complete jamstack environment, so I'm fine with this being closed out. I know the discussion did veer a little more towards how to make a more universal set of packages so I'm also happy to keep it open and discuss that too. :) |
Beta Was this translation helpful? Give feedback.
-
I should put in a caveat that I'm very much an end user here - my crypto knowledge is super basic. I've been working on integrating this library with a Nuxt site as a proof of concept and got it working locally; when I pushed it up onto a hosting platform, though, I found I was able to register credentials but not verify them. The specific error I get (
Invalid key for curve: "Public key is not a point"
) seems to come fromconvertPublicKeyToPEM.js
, specifically here:I did some in-browser debugging and found that
x
andy
are objects, not arrays, eg. instead of[129, 107, 105, 135, 73, 183]
they're{ 0: 129, 1: 107, 2: 105, 3: 135, 4: 73, 5: 183 }
. When they're converted to strings, they get passed as'[object Object]'
instead of what they probably should be, base64-encoded versions of an integer buffer. I did verify that the objects do have 32 sequentially numbered keys and if you do something likeBuffer.from(Object.values(x)).toString('base64')
you get something more like what I'd expect to see.I realize there could be a thousand places along the way that could be breaking but I'm hoping someone can provide insight into why those values came through as objects instead of Buffers, and perhaps why that would only happen when running on something that isn't localhost.
Beta Was this translation helpful? Give feedback.
All reactions