-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: ensure that Keypair.secretKey is a Uint8Array #27700
Conversation
Wait. Really? Not at a keyboard right now but doesn’t What’s the different |
Codecov Report
@@ Coverage Diff @@
## master #27700 +/- ##
=========================================
+ Coverage 76.9% 77.2% +0.3%
=========================================
Files 48 55 +7
Lines 2505 2888 +383
Branches 355 402 +47
=========================================
+ Hits 1927 2232 +305
- Misses 448 514 +66
- Partials 130 142 +12 |
It supports the interface but the |
Oh, I just read #27684. Sigh. It’s a shame to have to cast and recast values, but here we are! |
Yeah, but fortunately the recast is cheap in this case because it's just creating a view over the same array buffer under the hood! |
Are we super sure we should change this? Any use case that stringifies the secret key is almost certainly not a good one, right? |
Yeah, I was surprised that anyone hit this at all but I don't see any harm in reverting to previous behavior. A utf8 encoded secret is no better or worse than a csv string with the same data |
The test failure is unrelated, I'll patch that up in a follow up |
Problem
An unintended side effect of #27435 is that the
Keypair.secretKey
property is no longer coerced into aUint8Array
and therefore thetoString
behavior has been changed.Summary of Changes
Ensure that
Keypair.secretKey
is always a properUint8Array
and not aBuffer
in disguiseFixes #27684