js-libp2p-crypto/test/key-stretcher.spec.js
2016-05-20 14:41:25 +02:00

26 lines
649 B
JavaScript

/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const crypto = require('../src')
describe('keyStretcher', () => {
describe('generate', () => {
const ciphers = ['AES-128', 'AES-256', 'Blowfish']
const hashes = ['SHA1', 'SHA256']
const res = crypto.generateEphemeralKeyPair('P-256')
const secret = res.genSharedKey(res.key)
ciphers.forEach((cipher) => {
hashes.forEach((hash) => {
it(`${cipher} - ${hash}`, () => {
const keys = crypto.keyStretcher(cipher, hash, secret)
expect(keys.k1).to.exist
expect(keys.k2).to.exist
})
})
})
})
})