Skip to content

Commit a13eb04

Browse files
committedOct 6, 2021
feat: improve key input type errors, remove dependency on @types/node
1 parent 94815a9 commit a13eb04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+388
-229
lines changed
 

‎package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,8 @@
222222
"dist/**/*.js",
223223
"dist/types/**/*.d.ts",
224224
"!dist/node/webcrypto/**/*",
225-
"!dist/types/**/*.i.d.ts",
226225
"!dist/types/runtime/*",
227-
"!dist/types/lib/*",
228-
"dist/types/lib/jwt_producer.d.ts"
226+
"!dist/types/lib/*"
229227
],
230228
"scripts": {
231229
"build": "tsc",
@@ -238,7 +236,7 @@
238236
"build-fast:node-webcrypto-cjs": "npm run-script runtime-node-webcrypto && npm run-script -s esbuild-find | xargs -0 esbuild --log-level=warning --platform=node --target=esnext --outdir=dist/node/webcrypto/cjs --format=cjs",
239237
"build-fast:node-webcrypto-esm": "npm run-script runtime-node-webcrypto && npm run-script -s esbuild-find | xargs -0 esbuild --log-level=warning --platform=node --target=esnext --outdir=dist/node/webcrypto/esm --format=esm && echo '{\"type\": \"module\"}'> dist/node/webcrypto/esm/package.json",
240238
"build:browser": "run-s runtime-browser 'build -- -p ./tsconfig/browser.json' && echo '{\"type\": \"module\"}'> dist/browser/package.json",
241-
"build:deno": "npm run-script runtime-deno && find dist/deno -name '*.ts' -type f -print0 | xargs -0 sed -i '' -e \"s/@deno\\-expect\\-error/@ts-ignore/g\" -e \"s/\\.js'/.ts'/g\" -e \"s/\\.d'/.d.ts'/g\" && echo 'export type KeyObject = CryptoKey' > dist/deno/types.d.ts && tail -n +5 src/types.d.ts >> dist/deno/types.d.ts",
239+
"build:deno": "npm run-script runtime-deno && find dist/deno -name '*.ts' -type f -print0 | xargs -0 sed -i '' -e \"s/@deno\\-expect\\-error/@ts-ignore/g\" -e \"s/\\.js'/.ts'/g\" -e \"s/\\.d'/.d.ts'/g\"",
242240
"build:types": "npm run-script build -- -p ./tsconfig/types.json && cd src && find . -name '*.d.ts' -maxdepth 2 -type f -exec gcp --parents \"{}\" ../dist/types \\; && cd .. && node ./tools/strip-dts-comments && run-s -s types:find | xargs -0 sed -i '' -e \"s/\\.js'/'/g\" -e \"s/\\.d'/'/g\"",
243241
"build:node-cjs": "run-s runtime-node 'build -- -p ./tsconfig/node-cjs.json'",
244242
"build:node-esm": "run-s runtime-node 'build -- -p ./tsconfig/node-esm.json' && echo '{\"type\": \"module\"}'> dist/node/esm/package.json",
@@ -263,7 +261,7 @@
263261
"runtime:refs": "run-s -s runtime:find | xargs -0 sed -i '' -e \"s/'\\.\\.\\//'\\.\\//g\" -e \"s/'\\.\\/\\.\\./'../g\"",
264262
"test": "npm run-script test-cjs && ava",
265263
"test-cloudflare-workers": "ava --timeout=5m --config ./test-cloudflare-workers.config.cjs",
266-
"test-deno": "deno test --jobs --allow-net --allow-read test-deno",
264+
"test-deno": "deno test --reload --jobs --allow-net --allow-read test-deno",
267265
"test-browsers": "find test-browser -type f -name '*.js' -print0 | xargs -0 npx esbuild --log-level=warning --outdir=dist-browser-tests --bundle && karma start",
268266
"test-cjs": "rm -rf test/cjs && find test -type f -name '*.mjs' -print0 | xargs -0 npx esbuild --log-level=warning --target=esnext --outdir=test/cjs --format=cjs",
269267
"test-cryptokey": "CRYPTOKEY=true npm test",

‎src/jwe/compact/decrypt.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export interface CompactDecryptGetKey extends GetKeyFunction<JWEHeaderParameters
5252
*/
5353
async function compactDecrypt(
5454
jwe: string | Uint8Array,
55-
key: KeyLike,
55+
key: KeyLike | Uint8Array,
5656
options?: DecryptOptions,
5757
): Promise<CompactDecryptResult>
5858
/**
@@ -67,7 +67,7 @@ async function compactDecrypt(
6767
): Promise<CompactDecryptResult & ResolvedKey>
6868
async function compactDecrypt(
6969
jwe: string | Uint8Array,
70-
key: KeyLike | CompactDecryptGetKey,
70+
key: KeyLike | Uint8Array | CompactDecryptGetKey,
7171
options?: DecryptOptions,
7272
) {
7373
if (jwe instanceof Uint8Array) {

0 commit comments

Comments
 (0)
Please sign in to comment.