Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Raw & Base64 support #23

Open
halaei opened this issue Jul 12, 2020 · 3 comments
Open

[Feature request] Raw & Base64 support #23

halaei opened this issue Jul 12, 2020 · 3 comments

Comments

@halaei
Copy link

halaei commented Jul 12, 2020

Is it possible to provide raw, base64, and/or base64url output support as well. This is will be handy for implementing OAuth clients, for example.

@halaei
Copy link
Author

halaei commented Jul 12, 2020

I find this simple snippet from stackoverflow to convert hex to base64:

btoa("4142434445464748494a4b4c4d4e4f505152535455565758595a".match(/\w{2}/g).map(function(a){return String.fromCharCode(parseInt(a, 16));} ).join("")) 

It is going to fix my problem.
Thanks.

@sevaa
Copy link

sevaa commented Mar 8, 2023

The following works for me as of React Native 0.70.5:

function hexToBase64(s:string)
{
  return Buffer.from(s, 'hex').toString('base64');
}

@Beat-YT
Copy link

Beat-YT commented Mar 12, 2024

it would still be nice to have support for base64 straight from the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants