Closed wbartels closed 3 years ago
Base64 can be easily converted to Base64-URL with just derivedKey.replace(/\+/g, '-').replace(/\//g, '_')
so I don't think this feature is worth it. (And padding can be stripped with .replace(/=/g, '')
)
For better results, check out my @stablelib packages which have a better base64 encoder (including base64url) and an improved scrypt implementation.
Thanks for the quick response and the suggested workaround! For my alternative login system I needs to send the result to the server. Then base64url encoding would be a good solution. But it is not big problem to use a hex output instead.
It would be nice if base64url encoding can be added. Reference: https://www.ietf.org/rfc/rfc4648.txt
Encoding Replace + with - Replace / with _
Delete the padding section:
Decoding: The padding can be reconstructed with the modulus 4 from the data length. Here is a PHP example: