AxoneA
Denoβ€’3y agoβ€’
6 replies
Axone

Bad implementation of X25519?

I can't generate a shared secret with the current implementation of X25519

const alice = await crypto.subtle.generateKey({ name: "X25519" }, true, [
    "deriveKey",
    "deriveBits",
]) as CryptoKeyPair;

const bob = await crypto.subtle.generateKey({ name: "X25519" }, true, [
    "deriveKey",
    "deriveBits",
]) as CryptoKeyPair;

const secret = await crypto.subtle.deriveBits(
    { name: "X25519", public: alice.publicKey },
    bob.privateKey,
    256,
);

console.log(secret);
Was this page helpful?