mirror of
https://github.com/hanzoai/jose.git
synced 2026-09-24 17:00:01 +00:00
13 lines
395 B
JavaScript
13 lines
395 B
JavaScript
const test = require('ava')
|
|
|
|
const timingSafeEqual = require('../../lib/help/timing_safe_equal')
|
|
|
|
test('same length buffers', t => {
|
|
t.is(true, timingSafeEqual(Buffer.from('foo'), Buffer.from('foo')))
|
|
t.is(false, timingSafeEqual(Buffer.from('foo'), Buffer.from('bar')))
|
|
})
|
|
|
|
test('different length buffers', t => {
|
|
t.is(false, timingSafeEqual(Buffer.from('foo'), Buffer.from('barbaz')))
|
|
})
|