/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
packages/framework/src/utils/crypto.utils.test.ts
18 строк
638 B
Richard Fontein
feat(framework): Support Next.js 15 with Turbopack dev server (#6894)
08 ноя 2024, 14:07
Не верифицирован
08 ноя 2024, 14:07
1e319e2
Код
Авторство
О чём код?
import { createHmac } from 'node:crypto'; import { describe, expect, it } from 'vitest'; import { createHmacSubtle } from './crypto.utils'; describe('crypto utils', () => { describe('createHmacSubtle', () => { const createHmacNode = (secretKey: string, data: string): string => { return createHmac('sha256', secretKey).update(data).digest('hex'); }; it('should create an HMAC equivalent to node crypto createHmac', async () => { const hmacSubtle = await createHmacSubtle('secret', 'data'); const hmacNode = createHmacNode('secret', 'data'); expect(hmacSubtle).toEqual(hmacNode); }); }); });