You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let uint8Array = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
let charCode = str.charCodeAt(i);
if (charCode > 127) {
throw new Error('Not ascii. Text must be in ascii encoding');
}
uint8Array[i] = charCode;
}
return uint8Array;
And I haven't had any issues. I would assume my use-case is not really supported, but I guess if you wanted to you could create a method asciiToUint8Array which you use internally which AFAICT is all you need. That said, TextEncoder seems like a pretty reasonable dependency, so makes sense if you want to leave it how it is.
The text was updated successfully, but these errors were encountered:
It's just because I'm using it from within an app that embeds v8 for the purpose of making plugins. Then I'm simply using your library to validate some digital signatures to make sure they're valid
Text Encoder is used in sister repositories, such as scure-base and noble-hashes and i'm positive charCodeAt is not 1:1 replacement.
Yeah, I think it only works for ascii. I think that's all you need for nobel-curves (cause it's just some of the hardcoded DST strings and what not, I think). But since you need it anyway for the other libraries, it is probably not reasonable for you to try avoid using TextEncoder just for my esoteric usecase. Actually the fact you always use utf8ToBytes instead of using TextEncoder throughout the code base makes it super easy to maintain a patch, so I shouldn't complain 👍
First of all, great work with your library you've done an amazing job.
I'm using it from a pure v8 runtime, and the only issue I have is the use of TextEncoder. I have patched your library to:
Replace the line:
https://github.com/paulmillr/noble-curves/blob/79dd7d342636f421d36acbf3dbe2014ad7ba7ece/src/abstract/utils.ts#LL118C8-L118C8
With:
And I haven't had any issues. I would assume my use-case is not really supported, but I guess if you wanted to you could create a method
asciiToUint8Array
which you use internally which AFAICT is all you need. That said, TextEncoder seems like a pretty reasonable dependency, so makes sense if you want to leave it how it is.The text was updated successfully, but these errors were encountered: