add frontend AES-GCM and base64 helpers with Vitest coverage.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { base64ToBytes } from '@/utils/encoding/base64ToBytes';
|
||||
|
||||
export const base64UrlToBytes = (base64Url: string): Uint8Array => {
|
||||
let base64 = base64Url.split('-').join('+').split('_').join('/');
|
||||
|
||||
const padding = base64.length % 4;
|
||||
|
||||
if (padding > 0) {
|
||||
base64 += '='.repeat(4 - padding);
|
||||
}
|
||||
|
||||
return base64ToBytes(base64);
|
||||
};
|
||||
Reference in New Issue
Block a user