Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
How to convert Node crypto.generateKeyPairSync to Deno?

I want to convert the following code from a Node (v18.1) program to Deno (v1.22), where a key pair is generated during SSH key exchange:

// generate.mjs
import { generateKeyPairSync } from "crypto";

const keys = generateKeyPairSync("x25519");

The code above is part of a larger SSH client, which mostly works in Deno when run in Node compatibility mode (--compat). However, generateKeyPairSync is not yet implemented, so I want to change it to a Deno equivalent:

deno run --compat --unstable --allow-env ./generate.mjs

error: Uncaught Error: Not implemented: crypto.generateKeyPairSync
  throw new Error(message);
        ^
    at notImplemented (https://deno.land/std@0.142.0/node/_utils.ts:22:9)
    at generateKeyPairSync (https://deno.land/std@0.142.0/node/internal/crypto/keygen.ts:662:3)
    at file:///C:/Users/gjzwiers/repos/nodeno_ssh/generate.mjs:3:14

I have looked at generateKey in the WebCrypto API, but it seems that it does not support x25519? Is there an alternative for x25519 in the WebCrypto API , or is there another way to get this working in Deno?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I ended up using an external module as suggested in the comments. I used node-forge to generate a keypair, which works nicely when run in Node compatibility mode for Deno:

// run with: deno run --compat --unstable --allow-env --allow-read generate.mjs
import forge from 'node-forge';

const ed25519 = forge.pki.ed25519;

const keypair = ed25519.generateKeyPair();
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda