diff --git a/packages/backend/src/tokens/jwt/index.ts b/packages/backend/src/tokens/jwt/index.ts new file mode 100644 index 0000000000..63c06ad218 --- /dev/null +++ b/packages/backend/src/tokens/jwt/index.ts @@ -0,0 +1,3 @@ +export { hasValidSignature, decodeJwt, verifyJwt } from './verifyJwt'; + +export type { VerifyJwtOptions } from './verifyJwt'; diff --git a/packages/backend/src/tokens/jwt.test.ts b/packages/backend/src/tokens/jwt/verifyJwt.test.ts similarity index 98% rename from packages/backend/src/tokens/jwt.test.ts rename to packages/backend/src/tokens/jwt/verifyJwt.test.ts index 30b8ae9418..5ab6e0dc97 100644 --- a/packages/backend/src/tokens/jwt.test.ts +++ b/packages/backend/src/tokens/jwt/verifyJwt.test.ts @@ -1,8 +1,8 @@ import type QUnit from 'qunit'; import sinon from 'sinon'; -import { mockJwks, mockJwt, mockJwtHeader, mockJwtPayload } from './fixtures'; -import { decodeJwt, verifyJwt } from './jwt'; +import { mockJwks, mockJwt, mockJwtHeader, mockJwtPayload } from '../fixtures'; +import { decodeJwt, verifyJwt } from './verifyJwt'; export default (QUnit: QUnit) => { const { module, test } = QUnit; diff --git a/packages/backend/src/tokens/jwt.ts b/packages/backend/src/tokens/jwt/verifyJwt.ts similarity index 98% rename from packages/backend/src/tokens/jwt.ts rename to packages/backend/src/tokens/jwt/verifyJwt.ts index 079a7d8016..1ebb2d0a7c 100644 --- a/packages/backend/src/tokens/jwt.ts +++ b/packages/backend/src/tokens/jwt/verifyJwt.ts @@ -2,9 +2,9 @@ import type { Jwt, JwtPayload } from '@clerk/types'; // DO NOT CHANGE: Runtime needs to be imported as a default export so that we can stub its dependencies with Sinon.js // For more information refer to https://sinonjs.org/how-to/stub-dependency/ -import runtime from '../runtime'; -import { base64url } from '../util/rfc4648'; -import { TokenVerificationError, TokenVerificationErrorAction, TokenVerificationErrorReason } from './errors'; +import runtime from '../../runtime'; +import { base64url } from '../../util/rfc4648'; +import { TokenVerificationError, TokenVerificationErrorAction, TokenVerificationErrorReason } from '../errors'; type IssuerResolver = string | ((iss: string) => boolean); diff --git a/packages/backend/tests/suites.ts b/packages/backend/tests/suites.ts index 244f01cb7c..f875fafce7 100644 --- a/packages/backend/tests/suites.ts +++ b/packages/backend/tests/suites.ts @@ -5,7 +5,7 @@ import requestTest from './dist/tokens/request.test.js'; import keysTest from './dist/tokens/keys.test.js'; import pathTest from './dist/util/path.test.js'; import verifyTest from './dist/tokens/verify.test.js'; -import jwtTest from './dist/tokens/jwt.test.js'; +import verifyJwtTest from './dist/tokens/jwt/verifyJwt.test.js'; import utilRequestTest from './dist/util/request.test.js'; import factoryTest from './dist/api/factory.test.js'; @@ -23,7 +23,7 @@ const suites = [ keysTest, verifyTest, pathTest, - jwtTest, + verifyJwtTest, factoryTest, redirectTest, ];