Skip to content

Commit

Permalink
test: use returned JWK in e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <[email protected]>
  • Loading branch information
berendsliedrecht committed Jul 12, 2024
1 parent b7733e2 commit 89c4dd0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/__tests__/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ describe('End To End', async () => {
key_ops: exportedKey.key_ops,
x: exportedKey.x,
y: exportedKey.y,
crv: exportedKey.crv,
}

const signJwtCallback: SignCallback = async ({ toBeSigned }) =>
new Uint8Array(await subtle.sign({ hash: 'SHA-256', name: 'ECDSA' }, key.privateKey, toBeSigned))

const verifyJwtCallback: VerifyCallback = async ({ signature, data }) =>
subtle.verify({ name: 'ECDSA', hash: 'SHA-256' }, key.publicKey, signature, data)
const verifyJwtCallback: VerifyCallback = async ({ signature, data, jwk }) => {
const publicKey = await subtle.importKey('jwk', jwk, { name: 'ECDSA', namedCurve: 'P-256' }, true, ['verify'])

return subtle.verify({ name: 'ECDSA', hash: 'SHA-256' }, publicKey, signature, data)
}

it('should fetch an entity configuration', async () => {
const iss = 'https://example.org'
Expand Down

0 comments on commit 89c4dd0

Please sign in to comment.