added new crypto function toHex

This commit is contained in:
Abhinav-grd 2021-04-05 13:32:02 +05:30
parent 687b68a11f
commit d674717cb0
2 changed files with 7 additions and 0 deletions

View file

@ -361,3 +361,7 @@ export async function fromString(input: string) {
await sodium.ready; await sodium.ready;
return sodium.from_string(input); return sodium.from_string(input);
} }
export async function toHex(input: string) {
await sodium.ready;
return sodium.to_hex(input);
}

View file

@ -131,6 +131,9 @@ export class Crypto {
async fromB64(string) { async fromB64(string) {
return libsodium.fromB64(string); return libsodium.fromB64(string);
} }
async toHex(string) {
return libsodium.toHex(string);
}
} }
Comlink.expose(Crypto); Comlink.expose(Crypto);