Auto-commit 2026-04-29 16:31
This commit is contained in:
39
node_modules/next-auth/jwt/index.d.ts
generated
vendored
Normal file
39
node_modules/next-auth/jwt/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { GetServerSidePropsContext, NextApiRequest } from "next";
|
||||
import type { NextRequest } from "next/server";
|
||||
import type { JWT, JWTDecodeParams, JWTEncodeParams, JWTOptions } from "./types";
|
||||
import type { LoggerInstance } from "..";
|
||||
export * from "./types";
|
||||
/** Issues a JWT. By default, the JWT is encrypted using "A256GCM". */
|
||||
export declare function encode(params: JWTEncodeParams): Promise<string>;
|
||||
/** Decodes a NextAuth.js issued JWT. */
|
||||
export declare function decode(params: JWTDecodeParams): Promise<JWT | null>;
|
||||
export interface GetTokenParams<R extends boolean = false> {
|
||||
/** The request containing the JWT either in the cookies or in the `Authorization` header. */
|
||||
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest;
|
||||
/**
|
||||
* Use secure prefix for cookie name, unless URL in `NEXTAUTH_URL` is http://
|
||||
* or not set (e.g. development or test instance) case use unprefixed name
|
||||
*/
|
||||
secureCookie?: boolean;
|
||||
/** If the JWT is in the cookie, what name `getToken()` should look for. */
|
||||
cookieName?: string;
|
||||
/**
|
||||
* `getToken()` will return the raw JWT if this is set to `true`
|
||||
* @default false
|
||||
*/
|
||||
raw?: R;
|
||||
/**
|
||||
* The same `secret` used in the `NextAuth` configuration.
|
||||
* Defaults to the `NEXTAUTH_SECRET` environment variable.
|
||||
*/
|
||||
secret?: string;
|
||||
decode?: JWTOptions["decode"];
|
||||
logger?: LoggerInstance | Console;
|
||||
}
|
||||
/**
|
||||
* Takes a NextAuth.js request (`req`) and returns either the NextAuth.js issued JWT's payload,
|
||||
* or the raw JWT string. We look for the JWT in the either the cookies, or the `Authorization` header.
|
||||
* [Documentation](https://next-auth.js.org/tutorials/securing-pages-and-api-routes#using-gettoken)
|
||||
*/
|
||||
export declare function getToken<R extends boolean = false>(params: GetTokenParams<R>): Promise<R extends true ? string : JWT | null>;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/next-auth/jwt/index.d.ts.map
generated
vendored
Normal file
1
node_modules/next-auth/jwt/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/jwt/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAA;AAExC,cAAc,SAAS,CAAA;AAMvB,sEAAsE;AACtE,wBAAsB,MAAM,CAAC,MAAM,EAAE,eAAe,mBAUnD;AAED,wCAAwC;AACxC,wBAAsB,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CASzE;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK;IACvD,6FAA6F;IAC7F,GAAG,EAAE,yBAAyB,CAAC,KAAK,CAAC,GAAG,WAAW,GAAG,cAAc,CAAA;IACpE;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,CAAA;IACP;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC7B,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAA;CAClC;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EACtD,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,CA+C/C"}
|
||||
101
node_modules/next-auth/jwt/index.js
generated
vendored
Normal file
101
node_modules/next-auth/jwt/index.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
encode: true,
|
||||
decode: true,
|
||||
getToken: true
|
||||
};
|
||||
exports.decode = decode;
|
||||
exports.encode = encode;
|
||||
exports.getToken = getToken;
|
||||
var _jose = require("jose");
|
||||
var _hkdf = _interopRequireDefault(require("@panva/hkdf"));
|
||||
var _uuid = require("uuid");
|
||||
var _cookie = require("../core/lib/cookie");
|
||||
var _types = require("./types");
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _types[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60;
|
||||
const now = () => Date.now() / 1000 | 0;
|
||||
async function encode(params) {
|
||||
const {
|
||||
token = {},
|
||||
secret,
|
||||
maxAge = DEFAULT_MAX_AGE,
|
||||
salt = ""
|
||||
} = params;
|
||||
const encryptionSecret = await getDerivedEncryptionKey(secret, salt);
|
||||
return await new _jose.EncryptJWT(token).setProtectedHeader({
|
||||
alg: "dir",
|
||||
enc: "A256GCM"
|
||||
}).setIssuedAt().setExpirationTime(now() + maxAge).setJti((0, _uuid.v4)()).encrypt(encryptionSecret);
|
||||
}
|
||||
async function decode(params) {
|
||||
const {
|
||||
token,
|
||||
secret,
|
||||
salt = ""
|
||||
} = params;
|
||||
if (!token) return null;
|
||||
const encryptionSecret = await getDerivedEncryptionKey(secret, salt);
|
||||
const {
|
||||
payload
|
||||
} = await (0, _jose.jwtDecrypt)(token, encryptionSecret, {
|
||||
clockTolerance: 15
|
||||
});
|
||||
return payload;
|
||||
}
|
||||
async function getToken(params) {
|
||||
var _process$env$NEXTAUTH, _process$env$NEXTAUTH2, _process$env$NEXTAUTH3, _req$headers;
|
||||
const {
|
||||
req,
|
||||
secureCookie = (_process$env$NEXTAUTH = (_process$env$NEXTAUTH2 = process.env.NEXTAUTH_URL) === null || _process$env$NEXTAUTH2 === void 0 ? void 0 : _process$env$NEXTAUTH2.startsWith("https://")) !== null && _process$env$NEXTAUTH !== void 0 ? _process$env$NEXTAUTH : !!process.env.VERCEL,
|
||||
cookieName = secureCookie ? "__Secure-next-auth.session-token" : "next-auth.session-token",
|
||||
raw,
|
||||
decode: _decode = decode,
|
||||
logger = console,
|
||||
secret = (_process$env$NEXTAUTH3 = process.env.NEXTAUTH_SECRET) !== null && _process$env$NEXTAUTH3 !== void 0 ? _process$env$NEXTAUTH3 : process.env.AUTH_SECRET
|
||||
} = params;
|
||||
if (!req) throw new Error("Must pass `req` to JWT getToken()");
|
||||
const sessionStore = new _cookie.SessionStore({
|
||||
name: cookieName,
|
||||
options: {
|
||||
secure: secureCookie
|
||||
}
|
||||
}, {
|
||||
cookies: req.cookies,
|
||||
headers: req.headers
|
||||
}, logger);
|
||||
let token = sessionStore.value;
|
||||
const authorizationHeader = req.headers instanceof Headers ? req.headers.get("authorization") : (_req$headers = req.headers) === null || _req$headers === void 0 ? void 0 : _req$headers.authorization;
|
||||
if (!token && (authorizationHeader === null || authorizationHeader === void 0 ? void 0 : authorizationHeader.split(" ")[0]) === "Bearer") {
|
||||
const urlEncodedToken = authorizationHeader.split(" ")[1];
|
||||
token = decodeURIComponent(urlEncodedToken);
|
||||
}
|
||||
if (!token) return null;
|
||||
if (raw) return token;
|
||||
try {
|
||||
return await _decode({
|
||||
token,
|
||||
secret
|
||||
});
|
||||
} catch (_unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
async function getDerivedEncryptionKey(keyMaterial, salt) {
|
||||
return await (0, _hkdf.default)("sha256", keyMaterial, salt, `NextAuth.js Generated Encryption Key${salt ? ` (${salt})` : ""}`, 32);
|
||||
}
|
||||
63
node_modules/next-auth/jwt/types.d.ts
generated
vendored
Normal file
63
node_modules/next-auth/jwt/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/// <reference types="node" />
|
||||
import type { Awaitable } from "..";
|
||||
export interface DefaultJWT extends Record<string, unknown> {
|
||||
name?: string | null;
|
||||
email?: string | null;
|
||||
picture?: string | null;
|
||||
sub?: string;
|
||||
}
|
||||
/**
|
||||
* Returned by the `jwt` callback and `getToken`, when using JWT sessions
|
||||
*
|
||||
* [`jwt` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) | [`getToken`](https://next-auth.js.org/tutorials/securing-pages-and-api-routes#using-gettoken)
|
||||
*/
|
||||
export interface JWT extends Record<string, unknown>, DefaultJWT {
|
||||
}
|
||||
export interface JWTEncodeParams {
|
||||
/** The JWT payload. */
|
||||
token?: JWT;
|
||||
/**
|
||||
* Used in combination with `secret` when deriving the encryption secret for the various NextAuth.js-issued JWTs.
|
||||
* @note When no `salt` is passed, we assume this is a session token.
|
||||
* This is for backwards-compatibility with currently active sessions, so they won't be invalidated when upgrading the package.
|
||||
*/
|
||||
salt?: string;
|
||||
/** The key material used to encode the NextAuth.js issued JWTs. Defaults to `NEXTAUTH_SECRET`. */
|
||||
secret: string | Buffer;
|
||||
/**
|
||||
* The maximum age of the NextAuth.js issued JWT in seconds.
|
||||
* @default 30 * 24 * 60 * 60 // 30 days
|
||||
*/
|
||||
maxAge?: number;
|
||||
}
|
||||
export interface JWTDecodeParams {
|
||||
/** The NextAuth.js issued JWT to be decoded */
|
||||
token?: string;
|
||||
/**
|
||||
* Used in combination with `secret` when deriving the encryption secret for the various NextAuth.js-issued JWTs.
|
||||
* @note When no `salt` is passed, we assume this is a session token.
|
||||
* This is for backwards-compatibility with currently active sessions, so they won't be invalidated when upgrading the package.
|
||||
*/
|
||||
salt?: string;
|
||||
/** The key material used to decode the NextAuth.js issued JWTs. Defaults to `NEXTAUTH_SECRET`. */
|
||||
secret: string | Buffer;
|
||||
}
|
||||
export interface JWTOptions {
|
||||
/**
|
||||
* The secret used to encode/decode the NextAuth.js issued JWT.
|
||||
* @deprecated Set the `NEXTAUTH_SECRET` environment variable or
|
||||
* use the top-level `secret` option instead
|
||||
*/
|
||||
secret: string;
|
||||
/**
|
||||
* The maximum age of the NextAuth.js issued JWT in seconds.
|
||||
* @default 30 * 24 * 60 * 60 // 30 days
|
||||
*/
|
||||
maxAge: number;
|
||||
/** Override this method to control the NextAuth.js issued JWT encoding. */
|
||||
encode: (params: JWTEncodeParams) => Awaitable<string>;
|
||||
/** Override this method to control the NextAuth.js issued JWT decoding. */
|
||||
decode: (params: JWTDecodeParams) => Awaitable<JWT | null>;
|
||||
}
|
||||
export declare type Secret = string | Buffer;
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/next-auth/jwt/types.d.ts.map
generated
vendored
Normal file
1
node_modules/next-auth/jwt/types.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/jwt/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAEnC,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,GAAI,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;CAAG;AAEnE,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,KAAK,CAAC,EAAE,GAAG,CAAA;IACX;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,MAAM,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,SAAS,CAAC,MAAM,CAAC,CAAA;IACtD,2EAA2E;IAC3E,MAAM,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;CAC3D;AAED,oBAAY,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA"}
|
||||
5
node_modules/next-auth/jwt/types.js
generated
vendored
Normal file
5
node_modules/next-auth/jwt/types.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Reference in New Issue
Block a user