Commit 9682924
committed
Drop the redundant copy in decodePublicKey
Buffer is a subclass of Uint8Array, so Buffer.from(encoded,
"base64url") already returns something that satisfies the
Uint8Array<ArrayBuffer> return type and the only downstream
caller (SimpleWebAuthn's verifyAuthenticationResponse) reads the
bytes either way. The previous version allocated a fresh
ArrayBuffer and copied the buffer's contents into a plain
Uint8Array; nothing here benefits from that round trip.
The two unit tests that round-trip a key now compare via
Array.from() rather than toEqual() on the typed-array instance,
since toEqual checks the prototype as well and a Buffer doesn't
deep-equal a Uint8Array under that rule.
#487 (comment)
Assisted-by: Claude Code:claude-opus-4-71 parent dc25d17 commit 9682924
2 files changed
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 228 | + | |
232 | 229 | | |
233 | 230 | | |
234 | 231 | | |
| |||
0 commit comments