Skip to content

Commit 0e7577f

Browse files
committed
Don't take crypto_hash_sha256 before sodium.ready
Apparently you can't even take the function pointer of crypto functions before sodium.ready. We continue to take the pointer for non-crypto functions since we do it in format.ts.
1 parent 8ca157a commit 0e7577f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/testkit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { decryptSTREAM, encryptSTREAM } from '../lib/stream.js'
55
import { HKDF } from '../lib/hkdf.js'
66
import age from '../lib/index.js'
77
import sodium from 'libsodium-wrappers-sumo'
8-
const { crypto_hash_sha256, from_hex, to_hex } = sodium
8+
const { from_hex, to_hex } = sodium
99
await sodium.ready
1010

1111
describe('CCTV testkit', function () {
@@ -39,7 +39,7 @@ describe('CCTV testkit', function () {
3939
if (vec.meta.identity)
4040
d.addIdentity(vec.meta.identity)
4141
const plaintext = d.decrypt(vec.body)
42-
assert.equal(to_hex(crypto_hash_sha256(plaintext)), vec.meta.payload)
42+
assert.equal(to_hex(sodium.crypto_hash_sha256(plaintext)), vec.meta.payload)
4343
})
4444
it(vec.name + " should round-trip header encoding", function () {
4545
const h = parseHeader(vec.body)

0 commit comments

Comments
 (0)