Closed yolmcore closed 7 months ago
Where is base64url not supported? In crypto.createHash()?
Maybe I misread the docs, but simple hasher in https://bun.sh/docs/api/hashing does not support SHA256 and the CryptoHasher digest method does not support base64url encoding and I don't see a base64url encoding method that takes a TypedArray.
this seems to work now. not sure when it was fixed
// Node API
const crypto = require("crypto");
const hasher = crypto.createHash("sha256");
hasher.update("hello world");
console.log(hasher.digest("base64url"));
// Bun
const hasher2 = new Bun.CryptoHasher("sha256");
hasher2.update("hello world");
console.log(hasher2.digest("base64url"));
as compared to base64 where there is a + in place of the -
What is the problem this feature would solve?
Right now I can only return a TypedArray or base64 string but I need a base64url for my usage.
What is the feature you are proposing to solve the problem?
add another option to digest "base64url"
What alternatives have you considered?
I'm replacing base64 to base64url (replaceAll), but it is very inefficient.