diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 78feaa29eb..ecf0bf74f3 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -50,5 +50,8 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- - run: git push origin $GITHUB_SHA:main
- run: git push origin $GITHUB_SHA:v3.x
+ - run: git rm -r dist/**/*
+ - run: |
+ git commit -m "chore: cleanup after publish"
+ - run: git push origin HEAD:main
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9d9f3fccc5..2b4728d193 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -103,6 +103,28 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '14') && !startsWith(matrix.node-version, '12') }}
- run: git reset HEAD --hard
+ test-deno:
+ needs:
+ - build
+ continue-on-error: true
+
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - uses: denoland/setup-deno@v1
+ with:
+ deno-version: v1.x
+ - name: Load cached dist
+ uses: actions/cache@v2
+ id: dist
+ with:
+ path: dist
+ key: dist-${{ hashFiles('src/**/*.ts') }}-${{ hashFiles('tsconfig/*.json') }}
+ - name: Test Deno
+ run: npm run test-deno
+ - run: git reset HEAD --hard
+
test-electron:
needs:
- build
@@ -188,6 +210,7 @@ jobs:
- browserstack
- test
- test-electron
+ - test-deno
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository == 'panva/jose' }}
steps:
diff --git a/.versionrc.json b/.versionrc.json
index 54c1860b9b..6cde1ceb27 100644
--- a/.versionrc.json
+++ b/.versionrc.json
@@ -2,7 +2,7 @@
"commit-all": true,
"scripts": {
"prerelease": "npm run-script build-all",
- "postbump": "node ./tools/docs.postbump.js",
+ "postbump": "node ./tools/postbump.js",
"postchangelog": "sed -i '' -e 's/### \\[/## [/g' CHANGELOG.md"
},
"types": [
diff --git a/README.md b/README.md
index df04fe4975..e0e8c10954 100644
--- a/README.md
+++ b/README.md
@@ -133,7 +133,7 @@ Legend:
| -- | -- | -- |
| Node.js | LTS ^12.19.0 || ^14.15.0 | |
| Electron | ^12.0.0 | see [1] |
-| Deno | ✕ | needs to complete its [Web Cryptography API integration](https://github.com/denoland/deno/issues/1891) first |
+| Deno | experimental | see Deno's [Web Cryptography API roadmap](https://github.com/denoland/deno/issues/11690) |
| React Native | ✕ | has no available and usable crypto runtime |
| IE | ✕ | implements old version of the Web Cryptography API specification |
| Browsers | see [caniuse.com][caniuse] | |
diff --git a/package.json b/package.json
index d5a10b73c4..fee3790afb 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
"decode",
"decrypt",
"detached",
+ "deno",
"ec",
"ecdsa",
"eddsa",
@@ -301,6 +302,16 @@
"require": "./dist/node/cjs/util/random.js"
}
},
+ "typesVersions": {
+ "*": {
+ "webcrypto/*": [
+ "./dist/types/*"
+ ],
+ "*": [
+ "./dist/types/*"
+ ]
+ }
+ },
"files": [
"dist/**/package.json",
"dist/**/*.js",
@@ -316,16 +327,18 @@
"build-all": "run-s clear build:*",
"build-fast-all": "run-s clear build-fast:*",
"build-fast:browser": "npm run-script runtime-browser && npm run-script -s esbuild-find | xargs -0 esbuild --log-level=warning --target=es2018 --outdir=dist/browser --format=esm && echo '{\"type\": \"module\"}'> dist/browser/package.json",
+ "build-fast:deno": "npm run-script build:deno",
"build-fast:node-cjs": "npm run-script runtime-node && npm run-script -s esbuild-find | xargs -0 esbuild --log-level=warning --platform=node --target=node12 --outdir=dist/node/cjs --format=cjs",
"build-fast:node-esm": "npm run-script runtime-node && npm run-script -s esbuild-find | xargs -0 esbuild --log-level=warning --platform=node --target=node12 --outdir=dist/node/esm --format=esm && echo '{\"type\": \"module\"}'> dist/node/esm/package.json",
"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",
"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",
- "build:browser": "run-s runtime-browser lint 'build -- -p ./tsconfig/browser.json' && echo '{\"type\": \"module\"}'> dist/browser/package.json",
+ "build:browser": "run-s runtime-browser 'build -- -p ./tsconfig/browser.json' && echo '{\"type\": \"module\"}'> dist/browser/package.json",
+ "build:deno": "npm run-script runtime-deno && find dist/deno -name '*.ts' -type f -print0 | xargs -0 sed -i '' -e \"s/\\.js'/.ts'/g\" -e \"s/\\.d'/.d.ts'/g\" && echo 'export class KeyObject extends CryptoKey {}' > dist/deno/types.d.ts && tail -n +5 src/types.d.ts >> dist/deno/types.d.ts",
"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\"",
- "build:node-cjs": "run-s runtime-node lint 'build -- -p ./tsconfig/node-cjs.json'",
- "build:node-esm": "run-s runtime-node lint 'build -- -p ./tsconfig/node-esm.json' && echo '{\"type\": \"module\"}'> dist/node/esm/package.json",
- "build:node-webcrypto-cjs": "run-s runtime-node-webcrypto lint 'build -- -p ./tsconfig/node-webcrypto-cjs.json'",
- "build:node-webcrypto-esm": "run-s runtime-node-webcrypto lint 'build -- -p ./tsconfig/node-webcrypto-esm.json' && echo '{\"type\": \"module\"}'> dist/node/webcrypto/esm/package.json",
+ "build:node-cjs": "run-s runtime-node 'build -- -p ./tsconfig/node-cjs.json'",
+ "build:node-esm": "run-s runtime-node 'build -- -p ./tsconfig/node-esm.json' && echo '{\"type\": \"module\"}'> dist/node/esm/package.json",
+ "build:node-webcrypto-cjs": "run-s runtime-node-webcrypto 'build -- -p ./tsconfig/node-webcrypto-cjs.json'",
+ "build:node-webcrypto-esm": "run-s runtime-node-webcrypto 'build -- -p ./tsconfig/node-webcrypto-esm.json' && echo '{\"type\": \"module\"}'> dist/node/webcrypto/esm/package.json",
"clear": "rm -rf dist",
"coverage": "npm run-script runtime-node && c8 npm run-script test",
"coverage-cryptokey": "npm run-script runtime-node && c8 npm run-script test-cryptokey",
@@ -333,8 +346,8 @@
"docs": "run-s docs:*",
"docs:generate": "typedoc --allReflectionsHaveOwnDocument --excludePrivate --excludeProtected --gitRevision main --readme none --plugin typedoc-plugin-markdown --out docs --excludeExternals --tsconfig ./tsconfig/browser.json --hideGenerator --hideBreadcrumbs src/types.d.ts src/jwt/*.ts src/jwe/**/*.ts src/jws/**/*.ts src/jwk/*.ts src/jwks/*.ts src/util/*.ts",
"esbuild-find": "find src -type f -name '*.ts' -not -path '*/runtime/*/*' -not -name '*.d.ts' -print0",
- "lint": "eslint --config ./src/.eslintrc.json ./src",
"runtime-browser": "run-s runtime:clear runtime:browser:* runtime:refs",
+ "runtime-deno": "npm run-script runtime-browser && mkdir -p dist/deno && cp -r src/. dist/deno && rm -r dist/deno/runtime/browser dist/deno/runtime/node && rm dist/deno/.prettierrc.json",
"runtime-node": "run-s runtime:clear runtime:node:* runtime:refs",
"runtime-node-webcrypto": "run-s runtime:clear runtime:browser:* && cp ./src/runtime/node/webcrypto.ts ./src/runtime/ && cp ./src/runtime/node/fetch_jwks.ts ./src/runtime/ && cp ./src/runtime/node/base64url.ts ./src/runtime/ && cp ./src/runtime/node/zlib.ts ./src/runtime/ && run-s runtime:refs",
"runtime:browser:copy": "cp ./src/runtime/browser/*.ts ./src/runtime",
@@ -344,24 +357,19 @@
"runtime:node:copy": "cp ./src/runtime/node/*.ts ./src/runtime",
"runtime:refs": "run-s -s runtime:find | xargs -0 sed -i '' -e \"s/'\\.\\.\\//'\\.\\//g\" -e \"s/'\\.\\/\\.\\./'../g\"",
"test": "npm run-script test-cjs && ava",
+ "test-deno": "deno test --jobs --no-check --allow-net test-deno",
"test-browser": "find test-browser -type f -name '*.js' -print0 | xargs -0 npx esbuild --log-level=warning --outdir=dist-browser-tests --bundle && karma start",
"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",
"test-cryptokey": "CRYPTOKEY=true npm test",
- "test-webcrypto": "WEBCRYPTO=true npm test"
+ "test-webcrypto": "WEBCRYPTO=true npm test",
+ "prettier": "npx prettier --write ./test ./src ./tools ./test-browser ./test-deno"
},
"devDependencies": {
"@types/node": "^16.6.2",
- "@typescript-eslint/eslint-plugin": "^4.29.1",
"ava": "^3.15.0",
"bowser": "^2.11.0",
"c8": "^7.8.0",
"esbuild": "^0.12.21",
- "eslint": "^7.32.0",
- "eslint-config-airbnb-base": "14.2.1",
- "eslint-config-airbnb-typescript": "^12.3.1",
- "eslint-config-prettier": "^8.3.0",
- "eslint-plugin-import": "^2.24.0",
- "eslint-plugin-jsdoc": "^36.0.7",
"glob": "^7.1.7",
"karma": "^6.3.4",
"karma-browserstack-launcher": "1.6.0",
@@ -371,19 +379,10 @@
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"qunit": "^2.16.0",
+ "tar": "^6.1.10",
"timekeeper": "^2.2.0",
"typedoc": "^0.21.6",
"typedoc-plugin-markdown": "^3.10.4",
"typescript": "^4.3.5"
- },
- "typesVersions": {
- "*": {
- "webcrypto/*": [
- "./dist/types/*"
- ],
- "*": [
- "./dist/types/*"
- ]
- }
}
}
diff --git a/src/.eslintrc.json b/src/.eslintrc.json
deleted file mode 100644
index f5443fb92f..0000000000
--- a/src/.eslintrc.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "plugins": ["jsdoc"],
- "extends": ["airbnb-typescript/base", "prettier"],
- "parserOptions": {
- "project": "./tsconfig/browser.json"
- },
- "rules": {
- "no-underscore-dangle": "off",
- "no-bitwise": "off",
- "no-plusplus": "off",
- "@typescript-eslint/indent": "off",
- "@typescript-eslint/semi": "off",
- "@typescript-eslint/no-extra-semi": "off",
- "import/prefer-default-export": "off",
- "jsdoc/check-access": 2,
- "jsdoc/check-alignment": 2,
- "jsdoc/check-indentation": 2,
- "jsdoc/check-param-names": 2,
- "jsdoc/check-property-names": 2,
- "jsdoc/check-tag-names": 2,
- "jsdoc/check-types": 2,
- "jsdoc/empty-tags": 2,
- "jsdoc/newline-after-description": 2,
- "jsdoc/no-bad-blocks": 2,
- "jsdoc/no-types": 2,
- "jsdoc/require-description-complete-sentence": [1, { "abbreviations": ["e.g.", "i.e."] }],
- "jsdoc/require-description": [2, { "checkConstructors": false }],
- "jsdoc/require-hyphen-before-param-description": [2, "never"],
- "jsdoc/require-param-description": 2,
- "jsdoc/require-param-name": 2,
- "jsdoc/require-param": 2,
- "jsdoc/valid-types": 2
- },
- "ignorePatterns": [
- "src/runtime/*/*.ts",
- "src/runtime/webcrypto.ts",
- "src/runtime/global.ts",
- "dist",
- "src/runtime/*.d.ts"
- ]
-}
diff --git a/src/jwe/compact/decrypt.ts b/src/jwe/compact/decrypt.ts
index 7b54b37dd9..add51353c9 100644
--- a/src/jwe/compact/decrypt.ts
+++ b/src/jwe/compact/decrypt.ts
@@ -8,7 +8,7 @@ import type {
GetKeyFunction,
FlattenedJWE,
CompactDecryptResult,
-} from '../../types'
+} from '../../types.d'
/**
* Interface for Compact JWE Decryption dynamic key resolution.
@@ -33,6 +33,11 @@ export interface CompactDecryptGetKey extends GetKeyFunction {
if (jwe instanceof Uint8Array) {
- // eslint-disable-next-line no-param-reassign
jwe = decoder.decode(jwe)
}
diff --git a/src/jwe/compact/encrypt.ts b/src/jwe/compact/encrypt.ts
index cda4a6570b..6c37e035af 100644
--- a/src/jwe/compact/encrypt.ts
+++ b/src/jwe/compact/encrypt.ts
@@ -4,7 +4,7 @@ import type {
JWEKeyManagementHeaderParameters,
JWEHeaderParameters,
EncryptOptions,
-} from '../../types'
+} from '../../types.d'
/**
* The CompactEncrypt class is a utility for creating Compact JWE strings.
@@ -19,6 +19,11 @@ import type {
* const { CompactEncrypt } = require('jose/jwe/compact/encrypt')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { CompactEncrypt } from 'https://deno.land/x/jose@VERSION/jwe/compact/encrypt.ts'
+ * ```
+ *
* @example Usage
* ```js
* const encoder = new TextEncoder()
diff --git a/src/jwe/flattened/decrypt.ts b/src/jwe/flattened/decrypt.ts
index 1f4111dc2a..9f4a72ad92 100644
--- a/src/jwe/flattened/decrypt.ts
+++ b/src/jwe/flattened/decrypt.ts
@@ -14,7 +14,7 @@ import type {
JWEHeaderParameters,
DecryptOptions,
GetKeyFunction,
-} from '../../types'
+} from '../../types.d'
import { encoder, decoder, concat } from '../../lib/buffer_utils.js'
import cekFactory from '../../lib/cek.js'
import random from '../../runtime/random.js'
@@ -50,6 +50,11 @@ export interface FlattenedDecryptGetKey
* const { flattenedDecrypt } = require('jose/jwe/flattened/decrypt')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { flattenedDecrypt } from 'https://deno.land/x/jose@VERSION/jwe/flattened/decrypt.ts'
+ * ```
+ *
* @example Usage
* ```js
* const decoder = new TextDecoder()
@@ -180,7 +185,6 @@ async function flattenedDecrypt(
}
if (typeof key === 'function') {
- // eslint-disable-next-line no-param-reassign
key = await key(parsedProt, jwe)
}
diff --git a/src/jwe/flattened/encrypt.ts b/src/jwe/flattened/encrypt.ts
index 32c7e41c83..dabcfd6892 100644
--- a/src/jwe/flattened/encrypt.ts
+++ b/src/jwe/flattened/encrypt.ts
@@ -4,8 +4,8 @@ import type {
JWEHeaderParameters,
JWEKeyManagementHeaderParameters,
EncryptOptions,
-} from '../../types'
-import type { JWEKeyManagementHeaderResults } from '../../types.i'
+} from '../../types.d'
+import type { JWEKeyManagementHeaderResults } from '../../types.i.d'
import ivFactory from '../../lib/iv.js'
import { encode as base64url } from '../../runtime/base64url.js'
import random from '../../runtime/random.js'
@@ -35,6 +35,11 @@ const checkExtensions = validateCrit.bind(undefined, JWEInvalid, new Map())
* const { FlattenedEncrypt } = require('jose/jwe/flattened/encrypt')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { FlattenedEncrypt } from 'https://deno.land/x/jose@VERSION/jwe/flattened/encrypt.ts'
+ * ```
+ *
* @example Usage
* ```js
* const encoder = new TextEncoder()
diff --git a/src/jwe/general/decrypt.ts b/src/jwe/general/decrypt.ts
index 2b636d38d9..95cc31f81d 100644
--- a/src/jwe/general/decrypt.ts
+++ b/src/jwe/general/decrypt.ts
@@ -8,7 +8,7 @@ import type {
FlattenedJWE,
GeneralJWE,
GeneralDecryptResult,
-} from '../../types'
+} from '../../types.d'
import isObject from '../../lib/is_object.js'
/**
@@ -34,6 +34,11 @@ export interface GeneralDecryptGetKey extends GetKeyFunctionawait parseJwk(joseHeader.jwk!, joseHeader.alg!, true)
if (key.type !== 'public') {
diff --git a/src/jwk/from_key_like.ts b/src/jwk/from_key_like.ts
index e2fd867820..d773843806 100644
--- a/src/jwk/from_key_like.ts
+++ b/src/jwk/from_key_like.ts
@@ -1,4 +1,4 @@
-import type { JWK, KeyLike } from '../types'
+import type { JWK, KeyLike } from '../types.d'
import asJWK from '../runtime/key_to_jwk.js'
/**
@@ -16,6 +16,11 @@ import asJWK from '../runtime/key_to_jwk.js'
* const { fromKeyLike } = require('jose/jwk/from_key_like')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { fromKeyLike } from 'https://deno.land/x/jose@VERSION/jwk/from_key_like.ts'
+ * ```
+ *
* @example Usage
* ```js
* const privateJwk = await fromKeyLike(privateKey)
diff --git a/src/jwk/parse.ts b/src/jwk/parse.ts
index e6e103791e..dece991592 100644
--- a/src/jwk/parse.ts
+++ b/src/jwk/parse.ts
@@ -2,7 +2,7 @@ import { decode as base64url } from '../runtime/base64url.js'
import asKeyObject from '../runtime/jwk_to_key.js'
import { JOSENotSupported } from '../util/errors.js'
import isObject from '../lib/is_object.js'
-import type { JWK, KeyLike } from '../types'
+import type { JWK, KeyLike } from '../types.d'
/**
* Converts a JWK to a runtime-specific key representation (KeyLike). Either
@@ -26,6 +26,11 @@ import type { JWK, KeyLike } from '../types'
* const { parseJwk } = require('jose/jwk/parse')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { parseJwk } from 'https://deno.land/x/jose@VERSION/jwk/parse.ts'
+ * ```
+ *
* @example Usage
* ```js
* const ecPublicKey = await parseJwk({
@@ -47,7 +52,6 @@ async function parseJwk(jwk: JWK, alg?: string, octAsKeyObject?: boolean): Promi
throw new TypeError('JWK must be an object')
}
- // eslint-disable-next-line no-param-reassign
alg ||= jwk.alg
if (typeof alg !== 'string' || !alg) {
@@ -60,7 +64,6 @@ async function parseJwk(jwk: JWK, alg?: string, octAsKeyObject?: boolean): Promi
throw new TypeError('missing "k" (Key Value) Parameter value')
}
- // eslint-disable-next-line no-param-reassign, eqeqeq
octAsKeyObject ??= jwk.ext !== true
if (octAsKeyObject) {
@@ -74,7 +77,6 @@ async function parseJwk(jwk: JWK, alg?: string, octAsKeyObject?: boolean): Promi
'RSA JWK "oth" (Other Primes Info) Parameter value is not supported',
)
}
- // eslint-disable-next-line no-fallthrough
case 'EC':
case 'OKP':
return asKeyObject({ ...jwk, alg })
diff --git a/src/jwk/thumbprint.ts b/src/jwk/thumbprint.ts
index 8bc94700c9..5cd28219f9 100644
--- a/src/jwk/thumbprint.ts
+++ b/src/jwk/thumbprint.ts
@@ -3,7 +3,7 @@ import { JOSENotSupported, JWKInvalid } from '../util/errors.js'
import digest from '../runtime/digest.js'
import { encode as base64url } from '../runtime/base64url.js'
import { encoder } from '../lib/buffer_utils.js'
-import type { JWK } from '../types'
+import type { JWK } from '../types.d'
import isObject from '../lib/is_object.js'
const check = (value: unknown, description: string) => {
@@ -30,6 +30,11 @@ const check = (value: unknown, description: string) => {
* const { calculateThumbprint } = require('jose/jwk/thumbprint')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { calculateThumbprint } from 'https://deno.land/x/jose@VERSION/jwk/thumbprint.ts'
+ * ```
+ *
* @example Usage
* ```js
* const thumbprint = await calculateThumbprint({
diff --git a/src/jwks/remote.ts b/src/jwks/remote.ts
index 69a4b8a5f7..c2a3d3561c 100644
--- a/src/jwks/remote.ts
+++ b/src/jwks/remote.ts
@@ -1,8 +1,10 @@
-import type { KeyObject } from 'crypto'
-import type * as http from 'http'
-import type * as https from 'https'
-
-import type { JWSHeaderParameters, JWK, FlattenedJWSInput, GetKeyFunction } from '../types'
+import type {
+ KeyObject,
+ JWSHeaderParameters,
+ JWK,
+ FlattenedJWSInput,
+ GetKeyFunction,
+} from '../types.d'
import parseJWK from '../jwk/parse.js'
import {
JWKSInvalid,
@@ -48,12 +50,15 @@ export interface RemoteJWKSetOptions {
cooldownDuration?: number
/**
- * An instance of http.Agent or https.Agent to pass to the http.get or
- * https.get method options. Use when behind an http(s) proxy.
+ * An instance of [http.Agent](https://nodejs.org/api/http.html#http_class_http_agent)
+ * or [https.Agent](https://nodejs.org/api/https.html#https_class_https_agent) to pass
+ * to the [http.get](https://nodejs.org/api/http.html#http_http_get_options_callback)
+ * or [https.get](https://nodejs.org/api/https.html#https_https_get_options_callback)
+ * method's options. Use when behind an http(s) proxy.
* This is a Node.js runtime specific option, it is ignored
* when used outside of Node.js runtime.
*/
- agent?: https.Agent | http.Agent
+ agent?: any
}
function isJWKLike(key: unknown): key is JWK {
@@ -202,7 +207,7 @@ class RemoteJWKSet {
this._cooldownStarted = Date.now()
this._pendingFetch = undefined
})
- .catch((err) => {
+ .catch((err: Error) => {
this._pendingFetch = undefined
throw err
})
@@ -228,6 +233,11 @@ class RemoteJWKSet {
* const { createRemoteJWKSet } = require('jose/jwks/remote')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { createRemoteJWKSet } from 'https://deno.land/x/jose@VERSION/jwks/remote.ts'
+ * ```
+ *
* @example Usage
* ```js
* import { jwtVerify } from 'jose/jwt/verify'
diff --git a/src/jws/compact/sign.ts b/src/jws/compact/sign.ts
index fa55f0efbe..e2221eb59d 100644
--- a/src/jws/compact/sign.ts
+++ b/src/jws/compact/sign.ts
@@ -1,7 +1,5 @@
-/* eslint-disable no-underscore-dangle */
-
import FlattenedSign from '../flattened/sign.js'
-import type { JWSHeaderParameters, KeyLike, SignOptions } from '../../types'
+import type { JWSHeaderParameters, KeyLike, SignOptions } from '../../types.d'
/**
* The CompactSign class is a utility for creating Compact JWS strings.
@@ -16,6 +14,11 @@ import type { JWSHeaderParameters, KeyLike, SignOptions } from '../../types'
* const { CompactSign } = require('jose/jws/compact/sign')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { CompactSign } from 'https://deno.land/x/jose@VERSION/jws/compact/sign.ts'
+ * ```
+ *
* @example Usage
* ```js
* const encoder = new TextEncoder()
diff --git a/src/jws/compact/verify.ts b/src/jws/compact/verify.ts
index 37089f4312..16d7dd1a81 100644
--- a/src/jws/compact/verify.ts
+++ b/src/jws/compact/verify.ts
@@ -8,7 +8,7 @@ import type {
JWSHeaderParameters,
KeyLike,
VerifyOptions,
-} from '../../types'
+} from '../../types.d'
/**
* Interface for Compact JWS Verification dynamic key resolution.
@@ -37,6 +37,11 @@ export interface CompactVerifyGetKey
* const { compactVerify } = require('jose/jws/compact/verify')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { compactVerify } from 'https://deno.land/x/jose@VERSION/jws/compact/verify.ts'
+ * ```
+ *
* @example Usage
* ```js
* const decoder = new TextDecoder()
@@ -54,7 +59,6 @@ async function compactVerify(
options?: VerifyOptions,
): Promise {
if (jws instanceof Uint8Array) {
- // eslint-disable-next-line no-param-reassign
jws = decoder.decode(jws)
}
diff --git a/src/jws/flattened/sign.ts b/src/jws/flattened/sign.ts
index 661b43a252..107795a1c4 100644
--- a/src/jws/flattened/sign.ts
+++ b/src/jws/flattened/sign.ts
@@ -1,12 +1,10 @@
-/* eslint-disable no-underscore-dangle */
-
import isDisjoint from '../../lib/is_disjoint.js'
import { JWSInvalid } from '../../util/errors.js'
import { encoder, decoder, concat } from '../../lib/buffer_utils.js'
import { encode as base64url } from '../../runtime/base64url.js'
import sign from '../../runtime/sign.js'
-import type { KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '../../types'
+import type { KeyLike, FlattenedJWS, JWSHeaderParameters, SignOptions } from '../../types.d'
import checkKeyType from '../../lib/check_key_type.js'
import validateCrit from '../../lib/validate_crit.js'
@@ -25,6 +23,11 @@ const checkExtensions = validateCrit.bind(undefined, JWSInvalid, new Map([['b64'
* const { FlattenedSign } = require('jose/jws/flattened/sign')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { FlattenedSign } from 'https://deno.land/x/jose@VERSION/jws/flattened/sign.ts'
+ * ```
+ *
* @example Usage
* ```js
* const encoder = new TextEncoder()
diff --git a/src/jws/flattened/verify.ts b/src/jws/flattened/verify.ts
index e82abd1623..0b0fac5685 100644
--- a/src/jws/flattened/verify.ts
+++ b/src/jws/flattened/verify.ts
@@ -16,7 +16,7 @@ import type {
JWSHeaderParameters,
VerifyOptions,
GetKeyFunction,
-} from '../../types'
+} from '../../types.d'
const checkExtensions = validateCrit.bind(undefined, JWSInvalid, new Map([['b64', true]]))
const checkAlgOption = validateAlgorithms.bind(undefined, 'algorithms')
@@ -48,6 +48,11 @@ export interface FlattenedVerifyGetKey
* const { flattenedVerify } = require('jose/jws/flattened/verify')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { flattenedVerify } from 'https://deno.land/x/jose@VERSION/jws/flattened/verify.ts'
+ * ```
+ *
* @example Usage
* ```js
* const decoder = new TextDecoder()
@@ -145,7 +150,6 @@ async function flattenedVerify(
}
if (typeof key === 'function') {
- // eslint-disable-next-line no-param-reassign
key = await key(parsedProt, jws)
}
diff --git a/src/jws/general/sign.ts b/src/jws/general/sign.ts
index d93f8aa5f3..fdf312f90a 100644
--- a/src/jws/general/sign.ts
+++ b/src/jws/general/sign.ts
@@ -1,8 +1,7 @@
-/* eslint-disable max-classes-per-file */
import FlattenedSign from '../flattened/sign.js'
import { JWSInvalid } from '../../util/errors.js'
-import type { KeyLike, GeneralJWS, JWSHeaderParameters, SignOptions } from '../../types'
+import type { KeyLike, GeneralJWS, JWSHeaderParameters, SignOptions } from '../../types.d'
export interface Signature {
/**
@@ -76,6 +75,11 @@ class IndividualSignature implements Signature {
* const { GeneralSign } = require('jose/jws/general/sign')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { GeneralSign } from 'https://deno.land/x/jose@VERSION/jws/general/sign.ts'
+ * ```
+ *
* @example Usage
* ```js
* const encoder = new TextEncoder()
diff --git a/src/jws/general/verify.ts b/src/jws/general/verify.ts
index 4ee1122d25..900f53157a 100644
--- a/src/jws/general/verify.ts
+++ b/src/jws/general/verify.ts
@@ -7,7 +7,7 @@ import type {
JWSHeaderParameters,
KeyLike,
VerifyOptions,
-} from '../../types'
+} from '../../types.d'
import { JWSInvalid, JWSSignatureVerificationFailed } from '../../util/errors.js'
import isObject from '../../lib/is_object.js'
@@ -38,6 +38,11 @@ export interface GeneralVerifyGetKey
* const { generalVerify } = require('jose/jws/general/verify')
* ```
*
+ * @example Deno import
+ * ```js
+ * import { generalVerify } from 'https://deno.land/x/jose@VERSION/jws/general/verify.ts'
+ * ```
+ *
* @example Usage
* ```js
* const decoder = new TextDecoder()
@@ -70,10 +75,8 @@ async function generalVerify(
throw new JWSInvalid('JWS Signatures missing or incorrect type')
}
- // eslint-disable-next-line no-restricted-syntax
for (const signature of jws.signatures) {
try {
- // eslint-disable-next-line no-await-in-loop
return await verify(
{
header: signature.header,
diff --git a/src/jwt/decrypt.ts b/src/jwt/decrypt.ts
index aa0233262e..d2d4ed0a98 100644
--- a/src/jwt/decrypt.ts
+++ b/src/jwt/decrypt.ts
@@ -8,7 +8,7 @@ import type {
JWEHeaderParameters,
FlattenedJWE,
JWTDecryptResult,
-} from '../types'
+} from '../types.d'
import jwtPayload from '../lib/jwt_claims_set.js'
import { JWTClaimValidationFailed } from '../util/errors.js'
@@ -40,6 +40,11 @@ export interface JWTDecryptGetKey extends GetKeyFunction) => {
const sources =