Skip to content

Commit

Permalink
fix: workaround for invalid use checks on CF Workers and Deno
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Oct 28, 2022
1 parent a8ba3e6 commit e4d04eb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions src/runtime/browser/jwk_to_key.ts
Expand Up @@ -158,6 +158,7 @@ const parse: JWKImportFunction = async (jwk: JWK): Promise<CryptoKey> => {

const keyData: JWK = { ...jwk }
delete keyData.alg
delete keyData.use
return crypto.subtle.importKey('jwk', keyData, ...rest)
}
export default parse
10 changes: 0 additions & 10 deletions tap/cookbook.ts
Expand Up @@ -67,11 +67,6 @@ export default (QUnit: QUnit) => {
sign.setUnprotectedHeader(vector.signing.unprotected)
}

// TODO: https://github.com/denoland/deno/pull/16465
if (env.isDeno && vector.input.alg.startsWith('HS')) {
delete vector.input.key.use
}

const privateKey = await lib.importJWK(vector.input.key, vector.input.alg)

const result = await sign.sign(privateKey)
Expand Down Expand Up @@ -168,11 +163,6 @@ export default (QUnit: QUnit) => {

const reproducible = !!vector.reproducible

// TODO: https://github.com/cloudflare/workerd/issues/138
if (env.isWorkers && vector.input.key?.use) {
delete vector.input.key.use
}

if (reproducible) {
// sign and compare results are the same
for (const [serialization, expectedResult] of [
Expand Down

0 comments on commit e4d04eb

Please sign in to comment.