Код: Выделить всё
export const generateKeyPair = async (): Promise => {
return await window.crypto.subtle.generateKey(
{
name: "ECDH",
namedCurve: "P-384",
},
true,
["deriveKey", "deriveBits"],
);
};
Код: Выделить всё
const keyPair: CryptoKeyPair = yield generateKeyPair();
const publicKeyArrayBuffer: ArrayBuffer = yield window.crypto.subtle.exportKey("raw", keyPair.publicKey);
const publicKeyAsBase64 = arrayBufferToBase64(publicKeyArrayBuffer);
Подробнее здесь: https://stackoverflow.com/questions/690 ... a-sequence
Мобильная версия