feat: use webcrypto in favor of node-forge

BREAKING CHANGE: generateKeyPair is now async
This commit is contained in:
Friedel Ziegelmayer
2016-09-13 13:23:11 +02:00
parent 73a5258876
commit 08c5df5e79
32 changed files with 2728 additions and 334 deletions

View File

@ -0,0 +1,33 @@
'use strict'
const Benchmark = require('benchmark')
const crypto = require('../src')
const suite = new Benchmark.Suite('ephemeral-keys')
const secrets = []
const curves = ['P-256', 'P-384', 'P-521']
curves.forEach((curve) => {
suite.add(`ephemeral key with secrect ${curve}`, (d) => {
crypto.generateEphemeralKeyPair('P-256', (err, res) => {
if (err) throw err
res.genSharedKey(res.key, (err, secret) => {
if (err) throw err
secrets.push(secret)
d.resolve()
})
})
}, {
defer: true
})
})
suite
.on('cycle', (event) => {
console.log(String(event.target))
})
.run({
'async': true
})