How to use the getCurves function from crypto

Find comprehensive JavaScript crypto.getCurves code examples handpicked from public code repositorys.

193
194
195
196
197
198
199
200
201
202
203
204
// Test ECDH.


test(crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' }),
     crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' }));


const not256k1 = crypto.getCurves().find((c) => /^sec.*(224|384|512)/.test(c));
assert.throws(() => {
  test(crypto.generateKeyPairSync('ec', { namedCurve: 'secp256k1' }),
       crypto.generateKeyPairSync('ec', { namedCurve: not256k1 }));
}, {
fork icon0
star icon0
watch icon0

+ 7 other calls in file