mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-03-16 04:21:07 +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
23 lines
586 B
JavaScript
23 lines
586 B
JavaScript
/* eslint max-nested-callbacks: ["error", 8] */
|
|
/* eslint-env mocha */
|
|
'use strict'
|
|
|
|
const chai = require('chai')
|
|
const dirtyChai = require('dirty-chai')
|
|
const expect = chai.expect
|
|
chai.use(dirtyChai)
|
|
|
|
const crypto = require('../../src')
|
|
|
|
const hashes = ['SHA1', 'SHA256', 'SHA512']
|
|
|
|
describe('HMAC', () => {
|
|
hashes.forEach((hash) => {
|
|
it(`${hash} - sign and verify`, async () => {
|
|
const hmac = await crypto.hmac.create(hash, Buffer.from('secret'))
|
|
const sig = await hmac.digest(Buffer.from('hello world'))
|
|
expect(sig).to.have.length(hmac.length)
|
|
})
|
|
})
|
|
})
|