@envelop/auth0 3.5.0 → 3.5.1-alpha-20220824152235-afd061e6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +3 -7
- package/esm/index.js +3 -7
- package/package.json +2 -3
- package/typings/index.d.cts +1 -2
- package/typings/index.d.ts +1 -2
package/cjs/index.js
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAuth0 = exports.UnauthenticatedError = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
/* eslint-disable no-console */
|
|
6
|
-
/* eslint-disable dot-notation */
|
|
7
|
-
const core_1 = require("@envelop/core");
|
|
8
5
|
const JwksRsa = tslib_1.__importStar(require("jwks-rsa"));
|
|
9
6
|
const jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
|
|
10
|
-
const graphql_1 = require("graphql");
|
|
11
7
|
const { decode, verify } = jsonwebtoken_1.default;
|
|
12
|
-
class UnauthenticatedError extends
|
|
8
|
+
class UnauthenticatedError extends Error {
|
|
13
9
|
}
|
|
14
10
|
exports.UnauthenticatedError = UnauthenticatedError;
|
|
15
11
|
const useAuth0 = (options) => {
|
|
@@ -43,12 +39,12 @@ const useAuth0 = (options) => {
|
|
|
43
39
|
}
|
|
44
40
|
const split = authHeader.split(' ');
|
|
45
41
|
if (split.length !== 2) {
|
|
46
|
-
throw new
|
|
42
|
+
throw new Error(`Invalid value provided for header "${headerName}"!`);
|
|
47
43
|
}
|
|
48
44
|
else {
|
|
49
45
|
const [type, value] = split;
|
|
50
46
|
if (type !== tokenType) {
|
|
51
|
-
throw new
|
|
47
|
+
throw new Error(`Unsupported token type provided: "${type}"!`);
|
|
52
48
|
}
|
|
53
49
|
else {
|
|
54
50
|
return value;
|
package/esm/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
/* eslint-disable dot-notation */
|
|
3
|
-
import { EnvelopError } from '@envelop/core';
|
|
4
1
|
import * as JwksRsa from 'jwks-rsa';
|
|
5
2
|
import jwtPkg from 'jsonwebtoken';
|
|
6
|
-
import { GraphQLError } from 'graphql';
|
|
7
3
|
const { decode, verify } = jwtPkg;
|
|
8
|
-
export class UnauthenticatedError extends
|
|
4
|
+
export class UnauthenticatedError extends Error {
|
|
9
5
|
}
|
|
10
6
|
export const useAuth0 = (options) => {
|
|
11
7
|
const jkwsClient = new JwksRsa.JwksClient({
|
|
@@ -38,12 +34,12 @@ export const useAuth0 = (options) => {
|
|
|
38
34
|
}
|
|
39
35
|
const split = authHeader.split(' ');
|
|
40
36
|
if (split.length !== 2) {
|
|
41
|
-
throw new
|
|
37
|
+
throw new Error(`Invalid value provided for header "${headerName}"!`);
|
|
42
38
|
}
|
|
43
39
|
else {
|
|
44
40
|
const [type, value] = split;
|
|
45
41
|
if (type !== tokenType) {
|
|
46
|
-
throw new
|
|
42
|
+
throw new Error(`Unsupported token type provided: "${type}"!`);
|
|
47
43
|
}
|
|
48
44
|
else {
|
|
49
45
|
return value;
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/auth0",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1-alpha-20220824152235-afd061e6",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
7
|
-
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
|
+
"@envelop/core": "2.5.1-alpha-20220824152235-afd061e6"
|
|
8
7
|
},
|
|
9
8
|
"dependencies": {
|
|
10
9
|
"jsonwebtoken": "^8.5.1",
|
package/typings/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Plugin } from '@envelop/core';
|
|
2
2
|
import * as JwksRsa from 'jwks-rsa';
|
|
3
3
|
import { VerifyOptions, DecodeOptions } from 'jsonwebtoken';
|
|
4
|
-
import { GraphQLError } from 'graphql';
|
|
5
4
|
export declare type Auth0PluginOptions = {
|
|
6
5
|
domain: string;
|
|
7
6
|
audience: string;
|
|
@@ -15,7 +14,7 @@ export declare type Auth0PluginOptions = {
|
|
|
15
14
|
tokenType?: string;
|
|
16
15
|
headerName?: string;
|
|
17
16
|
};
|
|
18
|
-
export declare class UnauthenticatedError extends
|
|
17
|
+
export declare class UnauthenticatedError extends Error {
|
|
19
18
|
}
|
|
20
19
|
export declare type UserPayload = {
|
|
21
20
|
sub: string;
|
package/typings/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Plugin } from '@envelop/core';
|
|
2
2
|
import * as JwksRsa from 'jwks-rsa';
|
|
3
3
|
import { VerifyOptions, DecodeOptions } from 'jsonwebtoken';
|
|
4
|
-
import { GraphQLError } from 'graphql';
|
|
5
4
|
export declare type Auth0PluginOptions = {
|
|
6
5
|
domain: string;
|
|
7
6
|
audience: string;
|
|
@@ -15,7 +14,7 @@ export declare type Auth0PluginOptions = {
|
|
|
15
14
|
tokenType?: string;
|
|
16
15
|
headerName?: string;
|
|
17
16
|
};
|
|
18
|
-
export declare class UnauthenticatedError extends
|
|
17
|
+
export declare class UnauthenticatedError extends Error {
|
|
19
18
|
}
|
|
20
19
|
export declare type UserPayload = {
|
|
21
20
|
sub: string;
|