1 import { generateKey, importKey } from '@proton/crypto/lib/subtle/aesGcm';
3 import { base64StringToUint8Array, uint8ArrayToBase64String } from '../helpers/encoding';
5 export const getParsedClientKey = (value: string) => {
6 return base64StringToUint8Array(value);
9 const getSerializedClientKey = (value: Uint8Array) => {
10 return uint8ArrayToBase64String(value);
13 export const getClientKey = (value: string) => {
14 return importKey(getParsedClientKey(value));
17 export const generateClientKey = async () => {
18 const data = generateKey();
19 const serializedData = getSerializedClientKey(data);
20 const key = await importKey(data);