mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-03-15 16:51:02 +00:00
BREAKING CHANGE: API refactored to use async/await feat: WIP use async await fix: passing tests chore: update travis node.js versions fix: skip ursa optional tests on windows fix: benchmarks docs: update docs fix: remove broken and intested private key decrypt chore: update deps
24 lines
606 B
JavaScript
24 lines
606 B
JavaScript
/* eslint-disable no-console */
|
|
'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}`, async (d) => {
|
|
const res = await crypto.keys.generateEphemeralKeyPair('P-256')
|
|
const secret = await res.genSharedKey(res.key)
|
|
secrets.push(secret)
|
|
d.resolve()
|
|
}, { defer: true })
|
|
})
|
|
|
|
suite
|
|
.on('cycle', (event) => console.log(String(event.target)))
|
|
.run({ async: true })
|