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

24
test/hmac.spec.js Normal file
View File

@ -0,0 +1,24 @@
/* eslint max-nested-callbacks: ["error", 8] */
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const crypto = require('../src')
const hashes = ['SHA1', 'SHA256', 'SHA512']
describe('HMAC', () => {
hashes.forEach((hash) => {
it(`${hash} - sign and verify`, (done) => {
crypto.hmac.create(hash, new Buffer('secret'), (err, hmac) => {
expect(err).to.not.exist
hmac.digest(new Buffer('hello world'), (err, sig) => {
expect(err).to.not.exist
expect(sig).to.have.length(hmac.length)
done()
})
})
})
})
})