Skip to content

Commit

Permalink
await sodium.ready before grabbing constants
Browse files Browse the repository at this point in the history
  • Loading branch information
FiloSottile committed Nov 3, 2023
1 parent 8ca157a commit e880ee0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { strict as assert } from 'assert'
import { describe, it } from 'vitest'
import { decodeBase64, encodeHeader, encodeHeaderNoMAC, parseHeader } from '../lib/format.js'
import sodium from 'libsodium-wrappers-sumo'
const { from_string, to_string } = sodium
await sodium.ready
const { from_string, to_string } = sodium

const exampleHeader = `age-encryption.org/v1
-> X25519 abc
Expand Down
2 changes: 1 addition & 1 deletion tests/hkdf.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, assert } from 'vitest'
import { HKDF } from '../lib/hkdf.js'
import sodium from 'libsodium-wrappers-sumo'
const { from_string, to_hex } = sodium
await sodium.ready
const { from_string, to_hex } = sodium

describe('HKDF', () => {
it('should generate the right value for secret/salt/info', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, assert } from 'vitest'
import age from "../lib/index.js"
import sodium from 'libsodium-wrappers-sumo'
const { base64_variants, from_base64, to_string } = sodium
await sodium.ready
const { base64_variants, from_base64, to_string } = sodium

const fromBase64 = (s: string) => from_base64(s, base64_variants.ORIGINAL_NO_PADDING)

Expand Down
2 changes: 1 addition & 1 deletion tests/testkit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { decryptSTREAM, encryptSTREAM } from '../lib/stream.js'
import { HKDF } from '../lib/hkdf.js'
import age from '../lib/index.js'
import sodium from 'libsodium-wrappers-sumo'
const { crypto_hash_sha256, from_hex, to_hex } = sodium
await sodium.ready
const { crypto_hash_sha256, from_hex, to_hex } = sodium

describe('CCTV testkit', function () {
interface Vector {
Expand Down

0 comments on commit e880ee0

Please sign in to comment.