Skip to content

Commit

Permalink
Increasing test timeouts for key generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Jul 2, 2024
1 parent be6c093 commit d6c5eff
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions test/keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,35 @@ describeCryptoTests(({ provider, supportedSuites }) => {
expect(ret).toBe(false)
})

it('generateKeyPair', async () => {
for (let i = 0; i < 64; i++) {
const keys = await generateKeyPair(id, provider)
const sk = validatePrivateKey(id, keys.privateKey, provider)
const pk = validatePublicKey(id, keys.publicKey, provider)
expect(sk).toBe(true)
expect(pk).toBe(true)
}
})
it(
'generateKeyPair',
async () => {
for (let i = 0; i < 64; i++) {
const keys = await generateKeyPair(id, provider)
const sk = validatePrivateKey(id, keys.privateKey, provider)
const pk = validatePublicKey(id, keys.publicKey, provider)
expect(sk).toBe(true)
expect(pk).toBe(true)
}
},
10 * 1e3
)

it('deriveKeyPair', async () => {
const info = new TextEncoder().encode('info used for derivation')
for (let i = 0; i < 64; i++) {
const seed = crypto.getRandomValues(new Uint8Array(Nsk))
const keys = await deriveKeyPair(Oprf.Mode.OPRF, id, seed, info, provider)
const sk = validatePrivateKey(id, keys.privateKey, provider)
const pk = validatePublicKey(id, keys.publicKey, provider)
expect(sk).toBe(true)
expect(pk).toBe(true)
}
})
it(
'deriveKeyPair',
async () => {
const info = new TextEncoder().encode('info used for derivation')
for (let i = 0; i < 64; i++) {
const seed = crypto.getRandomValues(new Uint8Array(Nsk))
const keys = await deriveKeyPair(Oprf.Mode.OPRF, id, seed, info, provider)
const sk = validatePrivateKey(id, keys.privateKey, provider)
const pk = validatePublicKey(id, keys.publicKey, provider)
expect(sk).toBe(true)
expect(pk).toBe(true)
}
},
10 * 1e3
)
})
})
})

0 comments on commit d6c5eff

Please sign in to comment.