Skip to content

Commit

Permalink
Fix missing crypto global
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Hinek <frankhinek@users.noreply.github.com>
  • Loading branch information
frankhinek committed Dec 31, 2023
1 parent bee65ff commit ec3082e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/crypto/src/primitives/xchacha20-poly1305.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Convert } from '@web5/common';
import { crypto } from '@noble/hashes/crypto';
import { xchacha20poly1305 } from '@noble/ciphers/chacha';

import type { Jwk } from '../jose/jwk.js';
Expand Down
1 change: 1 addition & 0 deletions packages/crypto/src/primitives/xchacha20.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Convert } from '@web5/common';
import { crypto } from '@noble/hashes/crypto';
import { xchacha20 } from '@noble/ciphers/chacha';

import type { Jwk } from '../jose/jwk.js';
Expand Down
5 changes: 5 additions & 0 deletions packages/crypto/tests/primitives/pbkdf2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { Pbkdf2 } from '../../src/primitives/pbkdf2.js';

chai.use(chaiAsPromised);

// Remove this polyfill once Node.js v18 is no longer supported by @web5/crypto.
import { webcrypto } from 'node:crypto';
// @ts-ignore
if (!globalThis.crypto) globalThis.crypto = webcrypto;

describe('Pbkdf2', () => {
const password = Convert.string('password').toUint8Array();
const salt = Convert.string('salt').toUint8Array();
Expand Down

0 comments on commit ec3082e

Please sign in to comment.