Namespace in prep for a new method for unpadded

This commit is contained in:
Manav Rathi
2024-06-05 19:25:42 +05:30
parent 3e09fda76c
commit d3ddf92849
3 changed files with 5 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ export async function decryptAndStoreToken(
const decryptedTokenBytes = await cryptoWorker.fromB64(
urlUnsafeB64DecryptedToken,
);
decryptedToken = await cryptoWorker.toURLSafeB64(decryptedTokenBytes);
decryptedToken = await cryptoWorker.toB64URLSafe(decryptedTokenBytes);
setData(LS_KEYS.USER, {
...user,
token: decryptedToken,

View File

@@ -195,8 +195,8 @@ export class DedicatedCryptoWorker {
return libsodium.toB64(data);
}
async toURLSafeB64(data: Uint8Array) {
return libsodium.toURLSafeB64(data);
async toB64URLSafe(data: Uint8Array) {
return libsodium.toB64URLSafe(data);
}
async fromB64(string: string) {

View File

@@ -398,10 +398,10 @@ export async function toB64(input: Uint8Array) {
return sodium.to_base64(input, sodium.base64_variants.ORIGINAL);
}
export async function toURLSafeB64(input: Uint8Array) {
export const toB64URLSafe = async (input: Uint8Array) => {
await sodium.ready;
return sodium.to_base64(input, sodium.base64_variants.URLSAFE);
}
};
export async function fromUTF8(input: string) {
await sodium.ready;