Auto-commit 2026-04-29 16:31

This commit is contained in:
2026-04-29 16:31:27 -04:00
parent e8687bb6b2
commit 0495ee5bd2
19691 changed files with 3272886 additions and 138 deletions

61
node_modules/next-auth/core/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
import type { EventCallbacks, InternalOptions, LoggerInstance } from "..";
/**
* Same as the default `Error`, but it is JSON serializable.
* @source https://iaincollins.medium.com/error-handling-in-javascript-a6172ccdf9af
*/
export declare class UnknownError extends Error {
code: string;
constructor(error: Error | string);
toJSON(): {
name: string;
message: string;
stack: string | undefined;
};
}
export declare class OAuthCallbackError extends UnknownError {
name: string;
}
/**
* Thrown when an Email address is already associated with an account
* but the user is trying an OAuth account that is not linked to it.
*/
export declare class AccountNotLinkedError extends UnknownError {
name: string;
}
export declare class MissingAPIRoute extends UnknownError {
name: string;
code: string;
}
export declare class MissingSecret extends UnknownError {
name: string;
code: string;
}
export declare class MissingAuthorize extends UnknownError {
name: string;
code: string;
}
export declare class MissingAdapter extends UnknownError {
name: string;
code: string;
}
export declare class MissingAdapterMethods extends UnknownError {
name: string;
code: string;
}
export declare class UnsupportedStrategy extends UnknownError {
name: string;
code: string;
}
export declare class InvalidCallbackUrl extends UnknownError {
name: string;
code: string;
}
export declare function upperSnake(s: string): string;
export declare function capitalize(s: string): string;
/**
* Wraps an object of methods and adds error handling.
*/
export declare function eventsErrorHandler(methods: Partial<EventCallbacks>, logger: LoggerInstance): Partial<EventCallbacks>;
/** Handles adapter induced errors. */
export declare function adapterErrorHandler<TAdapter>(adapter: TAdapter | undefined, logger: LoggerInstance): InternalOptions["adapter"] | undefined;
//# sourceMappingURL=errors.d.ts.map

1
node_modules/next-auth/core/errors.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,IAAI,CAAA;AAEzE;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,IAAI,EAAE,MAAM,CAAA;gBACA,KAAK,EAAE,KAAK,GAAG,MAAM;IAUjC,MAAM;;;;;CAOP;AAED,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,IAAI,SAAuB;CAC5B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,IAAI,SAA0B;CAC/B;AAED,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,IAAI,SAAyB;IAC7B,IAAI,SAAqC;CAC1C;AAED,qBAAa,aAAc,SAAQ,YAAY;IAC7C,IAAI,SAAuB;IAC3B,IAAI,SAAc;CACnB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,IAAI,SAA0B;IAC9B,IAAI,SAAuC;CAC5C;AAED,qBAAa,cAAe,SAAQ,YAAY;IAC9C,IAAI,SAAwB;IAC5B,IAAI,SAAiC;CACtC;AAED,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,IAAI,SAA+B;IACnC,IAAI,SAAkC;CACvC;AAED,qBAAa,mBAAoB,SAAQ,YAAY;IACnD,IAAI,SAA6B;IACjC,IAAI,SAAmC;CACxC;AAED,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,IAAI,SAAuB;IAC3B,IAAI,SAA+B;CACpC;AAID,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,UAEnC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,UAEnC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,EAChC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,cAAc,CAAC,CAYzB;AAED,sCAAsC;AACtC,wBAAgB,mBAAmB,CAAC,QAAQ,EAC1C,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,MAAM,EAAE,cAAc,GACrB,eAAe,CAAC,SAAS,CAAC,GAAG,SAAS,CAkBxC"}

254
node_modules/next-auth/core/errors.js generated vendored Normal file
View File

@@ -0,0 +1,254 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.UnsupportedStrategy = exports.UnknownError = exports.OAuthCallbackError = exports.MissingSecret = exports.MissingAuthorize = exports.MissingAdapterMethods = exports.MissingAdapter = exports.MissingAPIRoute = exports.InvalidCallbackUrl = exports.AccountNotLinkedError = void 0;
exports.adapterErrorHandler = adapterErrorHandler;
exports.capitalize = capitalize;
exports.eventsErrorHandler = eventsErrorHandler;
exports.upperSnake = upperSnake;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
var UnknownError = exports.UnknownError = function (_Error) {
function UnknownError(error) {
var _message;
var _this;
(0, _classCallCheck2.default)(this, UnknownError);
_this = _callSuper(this, UnknownError, [(_message = error === null || error === void 0 ? void 0 : error.message) !== null && _message !== void 0 ? _message : error]);
_this.name = "UnknownError";
_this.code = error.code;
if (error instanceof Error) {
_this.stack = error.stack;
}
return _this;
}
(0, _inherits2.default)(UnknownError, _Error);
return (0, _createClass2.default)(UnknownError, [{
key: "toJSON",
value: function toJSON() {
return {
name: this.name,
message: this.message,
stack: this.stack
};
}
}]);
}((0, _wrapNativeSuper2.default)(Error));
var OAuthCallbackError = exports.OAuthCallbackError = function (_UnknownError) {
function OAuthCallbackError() {
var _this2;
(0, _classCallCheck2.default)(this, OAuthCallbackError);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this2 = _callSuper(this, OAuthCallbackError, [].concat(args));
(0, _defineProperty2.default)(_this2, "name", "OAuthCallbackError");
return _this2;
}
(0, _inherits2.default)(OAuthCallbackError, _UnknownError);
return (0, _createClass2.default)(OAuthCallbackError);
}(UnknownError);
var AccountNotLinkedError = exports.AccountNotLinkedError = function (_UnknownError2) {
function AccountNotLinkedError() {
var _this3;
(0, _classCallCheck2.default)(this, AccountNotLinkedError);
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_this3 = _callSuper(this, AccountNotLinkedError, [].concat(args));
(0, _defineProperty2.default)(_this3, "name", "AccountNotLinkedError");
return _this3;
}
(0, _inherits2.default)(AccountNotLinkedError, _UnknownError2);
return (0, _createClass2.default)(AccountNotLinkedError);
}(UnknownError);
var MissingAPIRoute = exports.MissingAPIRoute = function (_UnknownError3) {
function MissingAPIRoute() {
var _this4;
(0, _classCallCheck2.default)(this, MissingAPIRoute);
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_this4 = _callSuper(this, MissingAPIRoute, [].concat(args));
(0, _defineProperty2.default)(_this4, "name", "MissingAPIRouteError");
(0, _defineProperty2.default)(_this4, "code", "MISSING_NEXTAUTH_API_ROUTE_ERROR");
return _this4;
}
(0, _inherits2.default)(MissingAPIRoute, _UnknownError3);
return (0, _createClass2.default)(MissingAPIRoute);
}(UnknownError);
var MissingSecret = exports.MissingSecret = function (_UnknownError4) {
function MissingSecret() {
var _this5;
(0, _classCallCheck2.default)(this, MissingSecret);
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
_this5 = _callSuper(this, MissingSecret, [].concat(args));
(0, _defineProperty2.default)(_this5, "name", "MissingSecretError");
(0, _defineProperty2.default)(_this5, "code", "NO_SECRET");
return _this5;
}
(0, _inherits2.default)(MissingSecret, _UnknownError4);
return (0, _createClass2.default)(MissingSecret);
}(UnknownError);
var MissingAuthorize = exports.MissingAuthorize = function (_UnknownError5) {
function MissingAuthorize() {
var _this6;
(0, _classCallCheck2.default)(this, MissingAuthorize);
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_this6 = _callSuper(this, MissingAuthorize, [].concat(args));
(0, _defineProperty2.default)(_this6, "name", "MissingAuthorizeError");
(0, _defineProperty2.default)(_this6, "code", "CALLBACK_CREDENTIALS_HANDLER_ERROR");
return _this6;
}
(0, _inherits2.default)(MissingAuthorize, _UnknownError5);
return (0, _createClass2.default)(MissingAuthorize);
}(UnknownError);
var MissingAdapter = exports.MissingAdapter = function (_UnknownError6) {
function MissingAdapter() {
var _this7;
(0, _classCallCheck2.default)(this, MissingAdapter);
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
_this7 = _callSuper(this, MissingAdapter, [].concat(args));
(0, _defineProperty2.default)(_this7, "name", "MissingAdapterError");
(0, _defineProperty2.default)(_this7, "code", "EMAIL_REQUIRES_ADAPTER_ERROR");
return _this7;
}
(0, _inherits2.default)(MissingAdapter, _UnknownError6);
return (0, _createClass2.default)(MissingAdapter);
}(UnknownError);
var MissingAdapterMethods = exports.MissingAdapterMethods = function (_UnknownError7) {
function MissingAdapterMethods() {
var _this8;
(0, _classCallCheck2.default)(this, MissingAdapterMethods);
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
args[_key7] = arguments[_key7];
}
_this8 = _callSuper(this, MissingAdapterMethods, [].concat(args));
(0, _defineProperty2.default)(_this8, "name", "MissingAdapterMethodsError");
(0, _defineProperty2.default)(_this8, "code", "MISSING_ADAPTER_METHODS_ERROR");
return _this8;
}
(0, _inherits2.default)(MissingAdapterMethods, _UnknownError7);
return (0, _createClass2.default)(MissingAdapterMethods);
}(UnknownError);
var UnsupportedStrategy = exports.UnsupportedStrategy = function (_UnknownError8) {
function UnsupportedStrategy() {
var _this9;
(0, _classCallCheck2.default)(this, UnsupportedStrategy);
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
args[_key8] = arguments[_key8];
}
_this9 = _callSuper(this, UnsupportedStrategy, [].concat(args));
(0, _defineProperty2.default)(_this9, "name", "UnsupportedStrategyError");
(0, _defineProperty2.default)(_this9, "code", "CALLBACK_CREDENTIALS_JWT_ERROR");
return _this9;
}
(0, _inherits2.default)(UnsupportedStrategy, _UnknownError8);
return (0, _createClass2.default)(UnsupportedStrategy);
}(UnknownError);
var InvalidCallbackUrl = exports.InvalidCallbackUrl = function (_UnknownError9) {
function InvalidCallbackUrl() {
var _this10;
(0, _classCallCheck2.default)(this, InvalidCallbackUrl);
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
args[_key9] = arguments[_key9];
}
_this10 = _callSuper(this, InvalidCallbackUrl, [].concat(args));
(0, _defineProperty2.default)(_this10, "name", "InvalidCallbackUrl");
(0, _defineProperty2.default)(_this10, "code", "INVALID_CALLBACK_URL_ERROR");
return _this10;
}
(0, _inherits2.default)(InvalidCallbackUrl, _UnknownError9);
return (0, _createClass2.default)(InvalidCallbackUrl);
}(UnknownError);
function upperSnake(s) {
return s.replace(/([A-Z])/g, "_$1").toUpperCase();
}
function capitalize(s) {
return "".concat(s[0].toUpperCase()).concat(s.slice(1));
}
function eventsErrorHandler(methods, logger) {
return Object.keys(methods).reduce(function (acc, name) {
acc[name] = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
var method,
_args = arguments;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
method = methods[name];
_context.next = 4;
return method.apply(void 0, _args);
case 4:
return _context.abrupt("return", _context.sent);
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](0);
logger.error("".concat(upperSnake(name), "_EVENT_ERROR"), _context.t0);
case 10:
case "end":
return _context.stop();
}
}, _callee, null, [[0, 7]]);
}));
return acc;
}, {});
}
function adapterErrorHandler(adapter, logger) {
if (!adapter) return;
return Object.keys(adapter).reduce(function (acc, name) {
acc[name] = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2() {
var _len10,
args,
_key10,
method,
e,
_args2 = arguments;
return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.prev = 0;
for (_len10 = _args2.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
args[_key10] = _args2[_key10];
}
logger.debug("adapter_".concat(name), {
args: args
});
method = adapter[name];
_context2.next = 6;
return method.apply(void 0, args);
case 6:
return _context2.abrupt("return", _context2.sent);
case 9:
_context2.prev = 9;
_context2.t0 = _context2["catch"](0);
logger.error("adapter_error_".concat(name), _context2.t0);
e = new UnknownError(_context2.t0);
e.name = "".concat(capitalize(name), "Error");
throw e;
case 15:
case "end":
return _context2.stop();
}
}, _callee2, null, [[0, 9]]);
}));
return acc;
}, {});
}

31
node_modules/next-auth/core/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import type { AuthAction, AuthOptions } from "./types";
import type { Cookie } from "./lib/cookie";
export interface RequestInternal {
/** @default "http://localhost:3000" */
origin?: string;
method?: string;
cookies?: Partial<Record<string, string>>;
headers?: Record<string, any>;
query?: Record<string, any>;
body?: Record<string, any>;
action: AuthAction;
providerId?: string;
error?: string;
}
export interface NextAuthHeader {
key: string;
value: string;
}
export interface ResponseInternal<Body extends string | Record<string, any> | any[] = any> {
status?: number;
headers?: NextAuthHeader[];
body?: Body;
redirect?: string;
cookies?: Cookie[];
}
export interface NextAuthHandlerParams {
req: Request | RequestInternal;
options: AuthOptions;
}
export declare function AuthHandler<Body extends string | Record<string, any> | any[]>(params: NextAuthHandlerParams): Promise<ResponseInternal<Body>>;
//# sourceMappingURL=index.d.ts.map

1
node_modules/next-auth/core/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/core/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,MAAM,EAAE,UAAU,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,gBAAgB,CAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG;IAEvD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,OAAO,GAAG,eAAe,CAAA;IAC9B,OAAO,EAAE,WAAW,CAAA;CACrB;AA2CD,wBAAsB,WAAW,CAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,EACjD,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAsPhE"}

331
node_modules/next-auth/core/index.js generated vendored Normal file
View File

@@ -0,0 +1,331 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AuthHandler = AuthHandler;
var _logger = _interopRequireWildcard(require("../utils/logger"));
var _detectOrigin = require("../utils/detect-origin");
var routes = _interopRequireWildcard(require("./routes"));
var _pages = _interopRequireDefault(require("./pages"));
var _init = require("./init");
var _assert = require("./lib/assert");
var _cookie = require("./lib/cookie");
var _cookie2 = require("cookie");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
async function getBody(req) {
try {
return await req.json();
} catch (_unused) {}
}
async function toInternalRequest(req) {
var _headers$xForwarded2;
if (req instanceof Request) {
var _req$headers$get, _url$searchParams$get, _headers$xForwarded;
const url = new URL(req.url);
const nextauth = url.pathname.split("/").slice(3);
const headers = Object.fromEntries(req.headers);
const query = Object.fromEntries(url.searchParams);
query.nextauth = nextauth;
return {
action: nextauth[0],
method: req.method,
headers,
body: await getBody(req),
cookies: (0, _cookie2.parse)((_req$headers$get = req.headers.get("cookie")) !== null && _req$headers$get !== void 0 ? _req$headers$get : ""),
providerId: nextauth[1],
error: (_url$searchParams$get = url.searchParams.get("error")) !== null && _url$searchParams$get !== void 0 ? _url$searchParams$get : nextauth[1],
origin: (0, _detectOrigin.detectOrigin)((_headers$xForwarded = headers["x-forwarded-host"]) !== null && _headers$xForwarded !== void 0 ? _headers$xForwarded : headers.host, headers["x-forwarded-proto"]),
query
};
}
const {
headers
} = req;
const host = (_headers$xForwarded2 = headers === null || headers === void 0 ? void 0 : headers["x-forwarded-host"]) !== null && _headers$xForwarded2 !== void 0 ? _headers$xForwarded2 : headers === null || headers === void 0 ? void 0 : headers.host;
req.origin = (0, _detectOrigin.detectOrigin)(host, headers === null || headers === void 0 ? void 0 : headers["x-forwarded-proto"]);
return req;
}
async function AuthHandler(params) {
var _req$body$callbackUrl, _req$body, _req$query2, _req$body2;
const {
options: authOptions,
req: incomingRequest
} = params;
const req = await toInternalRequest(incomingRequest);
(0, _logger.setLogger)(authOptions.logger, authOptions.debug);
const assertionResult = (0, _assert.assertConfig)({
options: authOptions,
req
});
if (Array.isArray(assertionResult)) {
assertionResult.forEach(_logger.default.warn);
} else if (assertionResult instanceof Error) {
var _req$query;
_logger.default.error(assertionResult.code, assertionResult);
const htmlPages = ["signin", "signout", "error", "verify-request"];
if (!htmlPages.includes(req.action) || req.method !== "GET") {
const message = `There is a problem with the server configuration. Check the server logs for more information.`;
return {
status: 500,
headers: [{
key: "Content-Type",
value: "application/json"
}],
body: {
message
}
};
}
const {
pages,
theme
} = authOptions;
const authOnErrorPage = (pages === null || pages === void 0 ? void 0 : pages.error) && ((_req$query = req.query) === null || _req$query === void 0 || (_req$query = _req$query.callbackUrl) === null || _req$query === void 0 ? void 0 : _req$query.startsWith(pages.error));
if (!(pages !== null && pages !== void 0 && pages.error) || authOnErrorPage) {
if (authOnErrorPage) {
_logger.default.error("AUTH_ON_ERROR_PAGE_ERROR", new Error(`The error page ${pages === null || pages === void 0 ? void 0 : pages.error} should not require authentication`));
}
const render = (0, _pages.default)({
theme
});
return render.error({
error: "configuration"
});
}
return {
redirect: `${pages.error}?error=Configuration`
};
}
const {
action,
providerId,
error,
method = "GET"
} = req;
const {
options,
cookies
} = await (0, _init.init)({
authOptions,
action,
providerId,
origin: req.origin,
callbackUrl: (_req$body$callbackUrl = (_req$body = req.body) === null || _req$body === void 0 ? void 0 : _req$body.callbackUrl) !== null && _req$body$callbackUrl !== void 0 ? _req$body$callbackUrl : (_req$query2 = req.query) === null || _req$query2 === void 0 ? void 0 : _req$query2.callbackUrl,
csrfToken: (_req$body2 = req.body) === null || _req$body2 === void 0 ? void 0 : _req$body2.csrfToken,
cookies: req.cookies,
isPost: method === "POST"
});
const sessionStore = new _cookie.SessionStore(options.cookies.sessionToken, req, options.logger);
if (method === "GET") {
const render = (0, _pages.default)({
...options,
query: req.query,
cookies
});
const {
pages
} = options;
switch (action) {
case "providers":
return await routes.providers(options.providers);
case "session":
{
const session = await routes.session({
options,
sessionStore
});
if (session.cookies) cookies.push(...session.cookies);
return {
...session,
cookies
};
}
case "csrf":
return {
headers: [{
key: "Content-Type",
value: "application/json"
}, {
key: "Cache-Control",
value: "private, no-cache, no-store"
}, {
key: "Pragma",
value: "no-cache"
}, {
key: "Expires",
value: "0"
}],
body: {
csrfToken: options.csrfToken
},
cookies
};
case "signin":
if (pages.signIn) {
let signinUrl = `${pages.signIn}${pages.signIn.includes("?") ? "&" : "?"}callbackUrl=${encodeURIComponent(options.callbackUrl)}`;
if (error) signinUrl = `${signinUrl}&error=${encodeURIComponent(error)}`;
return {
redirect: signinUrl,
cookies
};
}
return render.signin();
case "signout":
if (pages.signOut) return {
redirect: pages.signOut,
cookies
};
return render.signout();
case "callback":
if (options.provider) {
const callback = await routes.callback({
body: req.body,
query: req.query,
headers: req.headers,
cookies: req.cookies,
method,
options,
sessionStore
});
if (callback.cookies) cookies.push(...callback.cookies);
return {
...callback,
cookies
};
}
break;
case "verify-request":
if (pages.verifyRequest) {
return {
redirect: pages.verifyRequest,
cookies
};
}
return render.verifyRequest();
case "error":
if (["Signin", "OAuthSignin", "OAuthCallback", "OAuthCreateAccount", "EmailCreateAccount", "Callback", "OAuthAccountNotLinked", "EmailSignin", "CredentialsSignin", "SessionRequired"].includes(error)) {
return {
redirect: `${options.url}/signin?error=${error}`,
cookies
};
}
if (pages.error) {
return {
redirect: `${pages.error}${pages.error.includes("?") ? "&" : "?"}error=${error}`,
cookies
};
}
return render.error({
error: error
});
default:
}
} else if (method === "POST") {
switch (action) {
case "signin":
if (options.csrfTokenVerified && options.provider) {
const signin = await routes.signin({
query: req.query,
body: req.body,
options
});
if (signin.cookies) cookies.push(...signin.cookies);
return {
...signin,
cookies
};
}
return {
redirect: `${options.url}/signin?csrf=true`,
cookies
};
case "signout":
if (options.csrfTokenVerified) {
const signout = await routes.signout({
options,
sessionStore
});
if (signout.cookies) cookies.push(...signout.cookies);
return {
...signout,
cookies
};
}
return {
redirect: `${options.url}/signout?csrf=true`,
cookies
};
case "callback":
if (options.provider) {
if (options.provider.type === "credentials" && !options.csrfTokenVerified) {
return {
redirect: `${options.url}/signin?csrf=true`,
cookies
};
}
const callback = await routes.callback({
body: req.body,
query: req.query,
headers: req.headers,
cookies: req.cookies,
method,
options,
sessionStore
});
if (callback.cookies) cookies.push(...callback.cookies);
return {
...callback,
cookies
};
}
break;
case "_log":
{
if (authOptions.logger) {
try {
var _req$body3;
const {
code,
level,
...metadata
} = (_req$body3 = req.body) !== null && _req$body3 !== void 0 ? _req$body3 : {};
_logger.default[level](code, metadata);
} catch (error) {
_logger.default.error("LOGGER_ERROR", error);
}
}
return {};
}
case "session":
{
if (options.csrfTokenVerified) {
var _req$body4;
const session = await routes.session({
options,
sessionStore,
newSession: (_req$body4 = req.body) === null || _req$body4 === void 0 ? void 0 : _req$body4.data,
isUpdate: true
});
if (session.cookies) cookies.push(...session.cookies);
return {
...session,
cookies
};
}
return {
status: 400,
body: {},
cookies
};
}
default:
}
}
return {
status: 400,
body: `Error: This action with HTTP ${method} is not supported by NextAuth.js`
};
}

24
node_modules/next-auth/core/init.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import { AuthOptions } from "..";
import * as cookie from "./lib/cookie";
import { RequestInternal } from ".";
import type { InternalOptions } from "./types";
interface InitParams {
origin?: string;
authOptions: AuthOptions;
providerId?: string;
action: InternalOptions["action"];
/** Callback URL value extracted from the incoming request. */
callbackUrl?: string;
/** CSRF token value extracted from the incoming request. From body if POST, from query if GET */
csrfToken?: string;
/** Is the incoming request a POST request? */
isPost: boolean;
cookies: RequestInternal["cookies"];
}
/** Initialize all internal options and cookies. */
export declare function init({ authOptions, providerId, action, origin, cookies: reqCookies, callbackUrl: reqCallbackUrl, csrfToken: reqCsrfToken, isPost, }: InitParams): Promise<{
options: InternalOptions;
cookies: cookie.Cookie[];
}>;
export {};
//# sourceMappingURL=init.d.ts.map

1
node_modules/next-auth/core/init.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/core/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AAKhC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAKtC,OAAO,EAAE,eAAe,EAAE,MAAM,GAAG,CAAA;AAEnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;IACjC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACpC;AAED,mDAAmD;AACnD,wBAAsB,IAAI,CAAC,EACzB,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EAAE,UAAU,EACnB,WAAW,EAAE,cAAc,EAC3B,SAAS,EAAE,YAAY,EACvB,MAAM,GACP,EAAE,UAAU,GAAG,OAAO,CAAC;IACtB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;CACzB,CAAC,CA+GD"}

131
node_modules/next-auth/core/init.js generated vendored Normal file
View File

@@ -0,0 +1,131 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.init = init;
var _crypto = require("crypto");
var _logger = _interopRequireDefault(require("../utils/logger"));
var _errors = require("./errors");
var _providers = _interopRequireDefault(require("./lib/providers"));
var _utils = require("./lib/utils");
var cookie = _interopRequireWildcard(require("./lib/cookie"));
var jwt = _interopRequireWildcard(require("../jwt"));
var _defaultCallbacks = require("./lib/default-callbacks");
var _csrfToken = require("./lib/csrf-token");
var _callbackUrl = require("./lib/callback-url");
var _parseUrl = _interopRequireDefault(require("../utils/parse-url"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
async function init({
authOptions,
providerId,
action,
origin,
cookies: reqCookies,
callbackUrl: reqCallbackUrl,
csrfToken: reqCsrfToken,
isPost
}) {
var _authOptions$useSecur, _authOptions$events;
const url = (0, _parseUrl.default)(origin);
const secret = (0, _utils.createSecret)({
authOptions,
url
});
const {
providers,
provider
} = (0, _providers.default)({
providers: authOptions.providers,
url,
providerId
});
const maxAge = 30 * 24 * 60 * 60;
const options = {
debug: false,
pages: {},
theme: {
colorScheme: "auto",
logo: "",
brandColor: "",
buttonText: ""
},
...authOptions,
url,
action,
provider,
cookies: {
...cookie.defaultCookies((_authOptions$useSecur = authOptions.useSecureCookies) !== null && _authOptions$useSecur !== void 0 ? _authOptions$useSecur : url.base.startsWith("https://")),
...authOptions.cookies
},
secret,
providers,
session: {
strategy: authOptions.adapter ? "database" : "jwt",
maxAge,
updateAge: 24 * 60 * 60,
generateSessionToken: () => {
var _randomUUID;
return (_randomUUID = _crypto.randomUUID === null || _crypto.randomUUID === void 0 ? void 0 : (0, _crypto.randomUUID)()) !== null && _randomUUID !== void 0 ? _randomUUID : (0, _crypto.randomBytes)(32).toString("hex");
},
...authOptions.session
},
jwt: {
secret,
maxAge,
encode: jwt.encode,
decode: jwt.decode,
...authOptions.jwt
},
events: (0, _errors.eventsErrorHandler)((_authOptions$events = authOptions.events) !== null && _authOptions$events !== void 0 ? _authOptions$events : {}, _logger.default),
adapter: (0, _errors.adapterErrorHandler)(authOptions.adapter, _logger.default),
callbacks: {
..._defaultCallbacks.defaultCallbacks,
...authOptions.callbacks
},
logger: _logger.default,
callbackUrl: url.origin
};
const cookies = [];
const {
csrfToken,
cookie: csrfCookie,
csrfTokenVerified
} = (0, _csrfToken.createCSRFToken)({
options,
cookieValue: reqCookies === null || reqCookies === void 0 ? void 0 : reqCookies[options.cookies.csrfToken.name],
isPost,
bodyValue: reqCsrfToken
});
options.csrfToken = csrfToken;
options.csrfTokenVerified = csrfTokenVerified;
if (csrfCookie) {
cookies.push({
name: options.cookies.csrfToken.name,
value: csrfCookie,
options: options.cookies.csrfToken.options
});
}
const {
callbackUrl,
callbackUrlCookie
} = await (0, _callbackUrl.createCallbackUrl)({
options,
cookieValue: reqCookies === null || reqCookies === void 0 ? void 0 : reqCookies[options.cookies.callbackUrl.name],
paramValue: reqCallbackUrl
});
options.callbackUrl = callbackUrl;
if (callbackUrlCookie) {
cookies.push({
name: options.cookies.callbackUrl.name,
value: callbackUrlCookie,
options: options.cookies.callbackUrl.options
});
}
return {
options,
cookies
};
}

17
node_modules/next-auth/core/lib/assert.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { MissingAdapter, MissingAPIRoute, MissingAuthorize, MissingSecret, UnsupportedStrategy } from "../errors";
import type { RequestInternal } from "..";
import type { WarningCode } from "../../utils/logger";
import type { AuthOptions } from "../types";
declare type ConfigError = MissingAPIRoute | MissingSecret | UnsupportedStrategy | MissingAuthorize | MissingAdapter;
/**
* Verify that the user configured `next-auth` correctly.
* Good place to mention deprecations as well.
*
* REVIEW: Make some of these and corresponding docs less Next.js specific?
*/
export declare function assertConfig(params: {
options: AuthOptions;
req: RequestInternal;
}): ConfigError | WarningCode[];
export {};
//# sourceMappingURL=assert.d.ts.map

1
node_modules/next-auth/core/lib/assert.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/core/lib/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EAGpB,MAAM,WAAW,CAAA;AAIlB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,aAAK,WAAW,GACZ,eAAe,GACf,aAAa,GACb,mBAAmB,GACnB,gBAAgB,GAChB,cAAc,CAAA;AAclB;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,eAAe,CAAA;CACrB,GAAG,WAAW,GAAG,WAAW,EAAE,CAwG9B"}

83
node_modules/next-auth/core/lib/assert.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.assertConfig = assertConfig;
var _errors = require("../errors");
var _parseUrl = _interopRequireDefault(require("../../utils/parse-url"));
var _cookie = require("./cookie");
let warned = false;
function isValidHttpUrl(url, baseUrl) {
try {
return /^https?:/.test(new URL(url, url.startsWith("/") ? baseUrl : undefined).protocol);
} catch (_unused) {
return false;
}
}
function assertConfig(params) {
var _req$query, _req$query2, _options$useSecureCoo, _req$cookies, _options$cookies$call, _options$cookies;
const {
options,
req
} = params;
const warnings = [];
if (!warned) {
if (!req.origin) warnings.push("NEXTAUTH_URL");
if (!options.secret && process.env.NODE_ENV !== "production") warnings.push("NO_SECRET");
if (options.debug) warnings.push("DEBUG_ENABLED");
}
if (!options.secret && process.env.NODE_ENV === "production") {
return new _errors.MissingSecret("Please define a `secret` in production.");
}
if (!((_req$query = req.query) !== null && _req$query !== void 0 && _req$query.nextauth) && !req.action) {
return new _errors.MissingAPIRoute("Cannot find [...nextauth].{js,ts} in `/pages/api/auth`. Make sure the filename is written correctly.");
}
const callbackUrlParam = (_req$query2 = req.query) === null || _req$query2 === void 0 ? void 0 : _req$query2.callbackUrl;
const url = (0, _parseUrl.default)(req.origin);
if (callbackUrlParam && !isValidHttpUrl(callbackUrlParam, url.base)) {
return new _errors.InvalidCallbackUrl(`Invalid callback URL. Received: ${callbackUrlParam}`);
}
const {
callbackUrl: defaultCallbackUrl
} = (0, _cookie.defaultCookies)((_options$useSecureCoo = options.useSecureCookies) !== null && _options$useSecureCoo !== void 0 ? _options$useSecureCoo : url.base.startsWith("https://"));
const callbackUrlCookie = (_req$cookies = req.cookies) === null || _req$cookies === void 0 ? void 0 : _req$cookies[(_options$cookies$call = (_options$cookies = options.cookies) === null || _options$cookies === void 0 || (_options$cookies = _options$cookies.callbackUrl) === null || _options$cookies === void 0 ? void 0 : _options$cookies.name) !== null && _options$cookies$call !== void 0 ? _options$cookies$call : defaultCallbackUrl.name];
if (callbackUrlCookie && !isValidHttpUrl(callbackUrlCookie, url.base)) {
return new _errors.InvalidCallbackUrl(`Invalid callback URL. Received: ${callbackUrlCookie}`);
}
let hasCredentials, hasEmail;
let hasTwitterOAuth2;
for (const provider of options.providers) {
if (provider.type === "credentials") hasCredentials = true;else if (provider.type === "email") hasEmail = true;else if (provider.id === "twitter" && provider.version === "2.0") hasTwitterOAuth2 = true;
}
if (hasCredentials) {
var _options$session;
const dbStrategy = ((_options$session = options.session) === null || _options$session === void 0 ? void 0 : _options$session.strategy) === "database";
const onlyCredentials = !options.providers.some(p => p.type !== "credentials");
if (dbStrategy && onlyCredentials) {
return new _errors.UnsupportedStrategy("Signin in with credentials only supported if JWT strategy is enabled");
}
const credentialsNoAuthorize = options.providers.some(p => p.type === "credentials" && !p.authorize);
if (credentialsNoAuthorize) {
return new _errors.MissingAuthorize("Must define an authorize() handler to use credentials authentication provider");
}
}
if (hasEmail) {
const {
adapter
} = options;
if (!adapter) {
return new _errors.MissingAdapter("E-mail login requires an adapter.");
}
const missingMethods = ["createVerificationToken", "useVerificationToken", "getUserByEmail"].filter(method => !adapter[method]);
if (missingMethods.length) {
return new _errors.MissingAdapterMethods(`Required adapter methods were missing: ${missingMethods.join(", ")}`);
}
}
if (!warned) {
if (hasTwitterOAuth2) warnings.push("TWITTER_OAUTH_2_BETA");
warned = true;
}
return warnings;
}

36
node_modules/next-auth/core/lib/callback-handler.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import type { InternalOptions } from "../types";
import type { AdapterSession, AdapterUser } from "../../adapters";
import type { JWT } from "../../jwt";
import type { Account, User } from "../..";
import type { SessionToken } from "./cookie";
/**
* This function handles the complex flow of signing users in, and either creating,
* linking (or not linking) accounts depending on if the user is currently logged
* in, if they have account already and the authentication mechanism they are using.
*
* It prevents insecure behaviour, such as linking OAuth accounts unless a user is
* signed in and authenticated with an existing valid account.
*
* All verification (e.g. OAuth flows or email address verificaiton flows) are
* done prior to this handler being called to avoid additonal complexity in this
* handler.
*/
export default function callbackHandler(params: {
sessionToken?: SessionToken;
profile: User | AdapterUser | {
email: string;
};
account: Account | null;
options: InternalOptions;
}): Promise<{
user: User;
account: Account;
session?: undefined;
isNewUser?: undefined;
} | {
session: JWT | AdapterSession | null;
user: AdapterUser;
isNewUser: boolean;
account?: undefined;
}>;
//# sourceMappingURL=callback-handler.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"callback-handler.d.ts","sourceRoot":"","sources":["../../src/core/lib/callback-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG5C;;;;;;;;;;;GAWG;AACH,wBAA8B,eAAe,CAAC,MAAM,EAAE;IACpD,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,OAAO,EAAE,IAAI,GAAG,WAAW,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/C,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB;;;;;;;;;;GA6MA"}

195
node_modules/next-auth/core/lib/callback-handler.js generated vendored Normal file
View File

@@ -0,0 +1,195 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = callbackHandler;
var _errors = require("../errors");
var _utils = require("./utils");
async function callbackHandler(params) {
const {
sessionToken,
profile: _profile,
account,
options
} = params;
if (!(account !== null && account !== void 0 && account.providerAccountId) || !account.type) throw new Error("Missing or invalid provider account");
if (!["email", "oauth"].includes(account.type)) throw new Error("Provider not supported");
const {
adapter,
jwt,
events,
session: {
strategy: sessionStrategy,
generateSessionToken
}
} = options;
if (!adapter) {
return {
user: _profile,
account
};
}
const profile = _profile;
const {
createUser,
updateUser,
getUser,
getUserByAccount,
getUserByEmail,
linkAccount,
createSession,
getSessionAndUser,
deleteSession
} = adapter;
let session = null;
let user = null;
let isNewUser = false;
const useJwtSession = sessionStrategy === "jwt";
if (sessionToken) {
if (useJwtSession) {
try {
session = await jwt.decode({
...jwt,
token: sessionToken
});
if (session && "sub" in session && session.sub) {
user = await getUser(session.sub);
}
} catch (_unused) {}
} else {
const userAndSession = await getSessionAndUser(sessionToken);
if (userAndSession) {
session = userAndSession.session;
user = userAndSession.user;
}
}
}
if (account.type === "email") {
const userByEmail = await getUserByEmail(profile.email);
if (userByEmail) {
var _user, _events$updateUser;
if (((_user = user) === null || _user === void 0 ? void 0 : _user.id) !== userByEmail.id && !useJwtSession && sessionToken) {
await deleteSession(sessionToken);
}
user = await updateUser({
id: userByEmail.id,
emailVerified: new Date()
});
await ((_events$updateUser = events.updateUser) === null || _events$updateUser === void 0 ? void 0 : _events$updateUser.call(events, {
user
}));
} else {
var _events$createUser;
const {
id: _,
...newUser
} = {
...profile,
emailVerified: new Date()
};
user = await createUser(newUser);
await ((_events$createUser = events.createUser) === null || _events$createUser === void 0 ? void 0 : _events$createUser.call(events, {
user
}));
isNewUser = true;
}
session = useJwtSession ? {} : await createSession({
sessionToken: await generateSessionToken(),
userId: user.id,
expires: (0, _utils.fromDate)(options.session.maxAge)
});
return {
session,
user,
isNewUser
};
} else if (account.type === "oauth") {
const userByAccount = await getUserByAccount({
providerAccountId: account.providerAccountId,
provider: account.provider
});
if (userByAccount) {
if (user) {
if (userByAccount.id === user.id) {
return {
session,
user,
isNewUser
};
}
throw new _errors.AccountNotLinkedError("The account is already associated with another user");
}
session = useJwtSession ? {} : await createSession({
sessionToken: await generateSessionToken(),
userId: userByAccount.id,
expires: (0, _utils.fromDate)(options.session.maxAge)
});
return {
session,
user: userByAccount,
isNewUser
};
} else {
var _events$createUser2, _events$linkAccount2;
if (user) {
var _events$linkAccount;
await linkAccount({
...account,
userId: user.id
});
await ((_events$linkAccount = events.linkAccount) === null || _events$linkAccount === void 0 ? void 0 : _events$linkAccount.call(events, {
user,
account,
profile
}));
return {
session,
user,
isNewUser
};
}
const userByEmail = profile.email ? await getUserByEmail(profile.email) : null;
if (userByEmail) {
const provider = options.provider;
if (provider !== null && provider !== void 0 && provider.allowDangerousEmailAccountLinking) {
user = userByEmail;
} else {
throw new _errors.AccountNotLinkedError("Another account already exists with the same e-mail address");
}
} else {
const {
id: _,
...newUser
} = {
...profile,
emailVerified: null
};
user = await createUser(newUser);
}
await ((_events$createUser2 = events.createUser) === null || _events$createUser2 === void 0 ? void 0 : _events$createUser2.call(events, {
user
}));
await linkAccount({
...account,
userId: user.id
});
await ((_events$linkAccount2 = events.linkAccount) === null || _events$linkAccount2 === void 0 ? void 0 : _events$linkAccount2.call(events, {
user,
account,
profile
}));
session = useJwtSession ? {} : await createSession({
sessionToken: await generateSessionToken(),
userId: user.id,
expires: (0, _utils.fromDate)(options.session.maxAge)
});
return {
session,
user,
isNewUser: true
};
}
}
throw new Error("Unsupported account type");
}

17
node_modules/next-auth/core/lib/callback-url.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { InternalOptions } from "../types";
interface CreateCallbackUrlParams {
options: InternalOptions;
/** Try reading value from request body (POST) then from query param (GET) */
paramValue?: string;
cookieValue?: string;
}
/**
* Get callback URL based on query param / cookie + validation,
* and add it to `req.options.callbackUrl`.
*/
export declare function createCallbackUrl({ options, paramValue, cookieValue, }: CreateCallbackUrlParams): Promise<{
callbackUrl: string;
callbackUrlCookie: string | undefined;
}>;
export {};
//# sourceMappingURL=callback-url.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"callback-url.d.ts","sourceRoot":"","sources":["../../src/core/lib/callback-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,UAAU,uBAAuB;IAC/B,OAAO,EAAE,eAAe,CAAA;IACxB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,UAAU,EACV,WAAW,GACZ,EAAE,uBAAuB;;;GAwBzB"}

32
node_modules/next-auth/core/lib/callback-url.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCallbackUrl = createCallbackUrl;
async function createCallbackUrl({
options,
paramValue,
cookieValue
}) {
const {
url,
callbacks
} = options;
let callbackUrl = url.origin;
if (paramValue) {
callbackUrl = await callbacks.redirect({
url: paramValue,
baseUrl: url.origin
});
} else if (cookieValue) {
callbackUrl = await callbacks.redirect({
url: cookieValue,
baseUrl: url.origin
});
}
return {
callbackUrl,
callbackUrlCookie: callbackUrl !== cookieValue ? callbackUrl : undefined
};
}

50
node_modules/next-auth/core/lib/cookie.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import type { CookiesOptions } from "../..";
import type { CookieOption, LoggerInstance, SessionStrategy } from "../types";
import type { NextRequest } from "next/server";
import type { NextApiRequest } from "next";
/** Stringified form of `JWT`. Extract the content with `jwt.decode` */
export declare type JWTString = string;
export declare type SetCookieOptions = Partial<CookieOption["options"]> & {
expires?: Date | string;
encode?: (val: unknown) => string;
};
/**
* If `options.session.strategy` is set to `jwt`, this is a stringified `JWT`.
* In case of `strategy: "database"`, this is the `sessionToken` of the session in the database.
*/
export declare type SessionToken<T extends SessionStrategy = "jwt"> = T extends "jwt" ? JWTString : string;
/**
* Use secure cookies if the site uses HTTPS
* This being conditional allows cookies to work non-HTTPS development URLs
* Honour secure cookie option, which sets 'secure' and also adds '__Secure-'
* prefix, but enable them by default if the site URL is HTTPS; but not for
* non-HTTPS URLs like http://localhost which are used in development).
* For more on prefixes see https://googlechrome.github.io/samples/cookie-prefixes/
*
* @TODO Review cookie settings (names, options)
*/
export declare function defaultCookies(useSecureCookies: boolean): CookiesOptions;
export interface Cookie extends CookieOption {
value: string;
}
export declare class SessionStore {
#private;
constructor(option: CookieOption, req: Partial<{
cookies: NextRequest["cookies"] | NextApiRequest["cookies"];
headers: NextRequest["headers"] | NextApiRequest["headers"];
}>, logger: LoggerInstance | Console);
/**
* The JWT Session or database Session ID
* constructed from the cookie chunks.
*/
get value(): string;
/**
* Given a cookie value, return new cookies, chunked, to fit the allowed cookie size.
* If the cookie has changed from chunked to unchunked or vice versa,
* it deletes the old cookies as well.
*/
chunk(value: string, options: Partial<Cookie["options"]>): Cookie[];
/** Returns a list of cookies that should be cleaned. */
clean(): Cookie[];
}
//# sourceMappingURL=cookie.d.ts.map

1
node_modules/next-auth/core/lib/cookie.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../src/core/lib/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AA0B1C,uEAAuE;AACvE,oBAAY,SAAS,GAAG,MAAM,CAAA;AAE9B,oBAAY,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,GAAG;IAChE,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAA;CAClC,CAAA;AAED;;;GAGG;AACH,oBAAY,YAAY,CAAC,CAAC,SAAS,eAAe,GAAG,KAAK,IAAI,CAAC,SAAS,KAAK,GACzE,SAAS,GACT,MAAM,CAAA;AAEV;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,OAAO,GAAG,cAAc,CA+DxE;AAED,MAAM,WAAW,MAAO,SAAQ,YAAY;IAC1C,KAAK,EAAE,MAAM,CAAA;CACd;AAID,qBAAa,YAAY;;gBAMrB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,OAAO,CAAC;QACX,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAAA;QAC3D,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAAA;KAC5D,CAAC,EACF,MAAM,EAAE,cAAc,GAAG,OAAO;IA0BlC;;;OAGG;IACH,IAAI,KAAK,WAWR;IA2CD;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE;IAmBnE,wDAAwD;IACxD,KAAK,IAAI,MAAM,EAAE;CAGlB"}

184
node_modules/next-auth/core/lib/cookie.js generated vendored Normal file
View File

@@ -0,0 +1,184 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SessionStore = void 0;
exports.defaultCookies = defaultCookies;
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
const ALLOWED_COOKIE_SIZE = 4096;
const ESTIMATED_EMPTY_COOKIE_SIZE = 163;
const CHUNK_SIZE = ALLOWED_COOKIE_SIZE - ESTIMATED_EMPTY_COOKIE_SIZE;
function defaultCookies(useSecureCookies) {
const cookiePrefix = useSecureCookies ? "__Secure-" : "";
return {
sessionToken: {
name: `${cookiePrefix}next-auth.session-token`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: useSecureCookies
}
},
callbackUrl: {
name: `${cookiePrefix}next-auth.callback-url`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: useSecureCookies
}
},
csrfToken: {
name: `${useSecureCookies ? "__Host-" : ""}next-auth.csrf-token`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: useSecureCookies
}
},
pkceCodeVerifier: {
name: `${cookiePrefix}next-auth.pkce.code_verifier`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: useSecureCookies,
maxAge: 60 * 15
}
},
state: {
name: `${cookiePrefix}next-auth.state`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: useSecureCookies,
maxAge: 60 * 15
}
},
nonce: {
name: `${cookiePrefix}next-auth.nonce`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
secure: useSecureCookies
}
}
};
}
var _chunks = new WeakMap();
var _option = new WeakMap();
var _logger = new WeakMap();
var _SessionStore_brand = new WeakSet();
class SessionStore {
constructor(option, req, logger) {
_classPrivateMethodInitSpec(this, _SessionStore_brand);
_classPrivateFieldInitSpec(this, _chunks, {});
_classPrivateFieldInitSpec(this, _option, void 0);
_classPrivateFieldInitSpec(this, _logger, void 0);
_classPrivateFieldSet(_logger, this, logger);
_classPrivateFieldSet(_option, this, option);
const {
cookies: _cookies
} = req;
const {
name: cookieName
} = option;
if (typeof (_cookies === null || _cookies === void 0 ? void 0 : _cookies.getAll) === "function") {
for (const {
name,
value
} of _cookies.getAll()) {
if (name.startsWith(cookieName)) {
_classPrivateFieldGet(_chunks, this)[name] = value;
}
}
} else if (_cookies instanceof Map) {
for (const name of _cookies.keys()) {
if (name.startsWith(cookieName)) _classPrivateFieldGet(_chunks, this)[name] = _cookies.get(name);
}
} else {
for (const name in _cookies) {
if (name.startsWith(cookieName)) _classPrivateFieldGet(_chunks, this)[name] = _cookies[name];
}
}
}
get value() {
const sortedKeys = Object.keys(_classPrivateFieldGet(_chunks, this)).sort((a, b) => {
var _a$split$pop, _b$split$pop;
const aSuffix = parseInt((_a$split$pop = a.split(".").pop()) !== null && _a$split$pop !== void 0 ? _a$split$pop : "0");
const bSuffix = parseInt((_b$split$pop = b.split(".").pop()) !== null && _b$split$pop !== void 0 ? _b$split$pop : "0");
return aSuffix - bSuffix;
});
return sortedKeys.map(key => _classPrivateFieldGet(_chunks, this)[key]).join("");
}
chunk(value, options) {
const cookies = _assertClassBrand(_SessionStore_brand, this, _clean).call(this);
const chunked = _assertClassBrand(_SessionStore_brand, this, _chunk).call(this, {
name: _classPrivateFieldGet(_option, this).name,
value,
options: {
..._classPrivateFieldGet(_option, this).options,
...options
}
});
for (const chunk of chunked) {
cookies[chunk.name] = chunk;
}
return Object.values(cookies);
}
clean() {
return Object.values(_assertClassBrand(_SessionStore_brand, this, _clean).call(this));
}
}
exports.SessionStore = SessionStore;
function _chunk(cookie) {
const chunkCount = Math.ceil(cookie.value.length / CHUNK_SIZE);
if (chunkCount === 1) {
_classPrivateFieldGet(_chunks, this)[cookie.name] = cookie.value;
return [cookie];
}
const cookies = [];
for (let i = 0; i < chunkCount; i++) {
const name = `${cookie.name}.${i}`;
const value = cookie.value.substr(i * CHUNK_SIZE, CHUNK_SIZE);
cookies.push({
...cookie,
name,
value
});
_classPrivateFieldGet(_chunks, this)[name] = value;
}
_classPrivateFieldGet(_logger, this).debug("CHUNKING_SESSION_COOKIE", {
message: `Session cookie exceeds allowed ${ALLOWED_COOKIE_SIZE} bytes.`,
emptyCookieSize: ESTIMATED_EMPTY_COOKIE_SIZE,
valueSize: cookie.value.length,
chunks: cookies.map(c => c.value.length + ESTIMATED_EMPTY_COOKIE_SIZE)
});
return cookies;
}
function _clean() {
const cleanedChunks = {};
for (const name in _classPrivateFieldGet(_chunks, this)) {
var _classPrivateFieldGet2;
(_classPrivateFieldGet2 = _classPrivateFieldGet(_chunks, this)) === null || _classPrivateFieldGet2 === void 0 || delete _classPrivateFieldGet2[name];
cleanedChunks[name] = {
name,
value: "",
options: {
..._classPrivateFieldGet(_option, this).options,
maxAge: 0
}
};
}
return cleanedChunks;
}

32
node_modules/next-auth/core/lib/csrf-token.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import type { InternalOptions } from "../types";
interface CreateCSRFTokenParams {
options: InternalOptions;
cookieValue?: string;
isPost: boolean;
bodyValue?: string;
}
/**
* Ensure CSRF Token cookie is set for any subsequent requests.
* Used as part of the strategy for mitigation for CSRF tokens.
*
* Creates a cookie like 'next-auth.csrf-token' with the value 'token|hash',
* where 'token' is the CSRF token and 'hash' is a hash made of the token and
* the secret, and the two values are joined by a pipe '|'. By storing the
* value and the hash of the value (with the secret used as a salt) we can
* verify the cookie was set by the server and not by a malicous attacker.
*
* For more details, see the following OWASP links:
* https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie
* https://owasp.org/www-chapter-london/assets/slides/David_Johansson-Double_Defeat_of_Double-Submit_Cookie.pdf
*/
export declare function createCSRFToken({ options, cookieValue, isPost, bodyValue, }: CreateCSRFTokenParams): {
csrfTokenVerified: boolean;
csrfToken: string;
cookie?: undefined;
} | {
cookie: string;
csrfToken: string;
csrfTokenVerified?: undefined;
};
export {};
//# sourceMappingURL=csrf-token.d.ts.map

1
node_modules/next-auth/core/lib/csrf-token.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"csrf-token.d.ts","sourceRoot":"","sources":["../../src/core/lib/csrf-token.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,UAAU,qBAAqB;IAC7B,OAAO,EAAE,eAAe,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,WAAW,EACX,MAAM,EACN,SAAS,GACV,EAAE,qBAAqB;;;;;;;;EAwBvB"}

32
node_modules/next-auth/core/lib/csrf-token.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCSRFToken = createCSRFToken;
var _crypto = require("crypto");
function createCSRFToken({
options,
cookieValue,
isPost,
bodyValue
}) {
if (cookieValue) {
const [csrfToken, csrfTokenHash] = cookieValue.split("|");
const expectedCsrfTokenHash = (0, _crypto.createHash)("sha256").update(`${csrfToken}${options.secret}`).digest("hex");
if (csrfTokenHash === expectedCsrfTokenHash) {
const csrfTokenVerified = isPost && csrfToken === bodyValue;
return {
csrfTokenVerified,
csrfToken
};
}
}
const csrfToken = (0, _crypto.randomBytes)(32).toString("hex");
const csrfTokenHash = (0, _crypto.createHash)("sha256").update(`${csrfToken}${options.secret}`).digest("hex");
const cookie = `${csrfToken}|${csrfTokenHash}`;
return {
cookie,
csrfToken
};
}

View File

@@ -0,0 +1,3 @@
import { CallbacksOptions } from "../..";
export declare const defaultCallbacks: CallbacksOptions;
//# sourceMappingURL=default-callbacks.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"default-callbacks.d.ts","sourceRoot":"","sources":["../../src/core/lib/default-callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAExC,eAAO,MAAM,gBAAgB,EAAE,gBAe9B,CAAA"}

28
node_modules/next-auth/core/lib/default-callbacks.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.defaultCallbacks = void 0;
const defaultCallbacks = exports.defaultCallbacks = {
signIn() {
return true;
},
redirect({
url,
baseUrl
}) {
if (url.startsWith("/")) return `${baseUrl}${url}`;else if (new URL(url).origin === baseUrl) return url;
return baseUrl;
},
session({
session
}) {
return session;
},
jwt({
token
}) {
return token;
}
};

View File

@@ -0,0 +1,11 @@
import type { AdapterUser } from "../../../adapters";
import type { InternalOptions } from "../../types";
/**
* Query the database for a user by email address.
* If is an existing user return a user object (otherwise use placeholder).
*/
export default function getAdapterUserFromEmail({ email, adapter, }: {
email: string;
adapter: InternalOptions<"email">["adapter"];
}): Promise<AdapterUser>;
//# sourceMappingURL=getUserFromEmail.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getUserFromEmail.d.ts","sourceRoot":"","sources":["../../../src/core/lib/email/getUserFromEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD;;;GAGG;AACH,wBAA8B,uBAAuB,CAAC,EACpD,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAA;CAC7C,GAAG,OAAO,CAAC,WAAW,CAAC,CAOvB"}

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getAdapterUserFromEmail;
async function getAdapterUserFromEmail({
email,
adapter
}) {
const {
getUserByEmail
} = adapter;
const adapterUser = email ? await getUserByEmail(email) : null;
if (adapterUser) return adapterUser;
return {
id: email,
email,
emailVerified: null
};
}

7
node_modules/next-auth/core/lib/email/signin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { InternalOptions } from "../../types";
/**
* Starts an e-mail login flow, by generating a token,
* and sending it to the user's e-mail (with the help of a DB adapter)
*/
export default function email(identifier: string, options: InternalOptions<"email">): Promise<string>;
//# sourceMappingURL=signin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"signin.d.ts","sourceRoot":"","sources":["../../../src/core/lib/email/signin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD;;;GAGG;AACH,wBAA8B,KAAK,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,CAuCjB"}

43
node_modules/next-auth/core/lib/email/signin.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = email;
var _crypto = require("crypto");
var _utils = require("../utils");
async function email(identifier, options) {
var _await$provider$gener, _provider$generateVer, _provider$maxAge, _adapter$createVerifi;
const {
url,
adapter,
provider,
callbackUrl,
theme
} = options;
const token = (_await$provider$gener = await ((_provider$generateVer = provider.generateVerificationToken) === null || _provider$generateVer === void 0 ? void 0 : _provider$generateVer.call(provider))) !== null && _await$provider$gener !== void 0 ? _await$provider$gener : (0, _crypto.randomBytes)(32).toString("hex");
const ONE_DAY_IN_SECONDS = 86400;
const expires = new Date(Date.now() + ((_provider$maxAge = provider.maxAge) !== null && _provider$maxAge !== void 0 ? _provider$maxAge : ONE_DAY_IN_SECONDS) * 1000);
const params = new URLSearchParams({
callbackUrl,
token,
email: identifier
});
const _url = `${url}/callback/${provider.id}?${params}`;
await Promise.all([provider.sendVerificationRequest({
identifier,
token,
expires,
url: _url,
provider,
theme
}), (_adapter$createVerifi = adapter.createVerificationToken) === null || _adapter$createVerifi === void 0 ? void 0 : _adapter$createVerifi.call(adapter, {
identifier,
token: (0, _utils.hashToken)(token, options),
expires
})]);
return `${url}/verify-request?${new URLSearchParams({
provider: provider.id,
type: provider.type
})}`;
}

View File

@@ -0,0 +1,20 @@
import type { InternalOptions } from "../../types";
import type { RequestInternal } from "../..";
import type { Cookie } from "../cookie";
/**
*
* Generates an authorization/request token URL.
*
* [OAuth 2](https://www.oauth.com/oauth2-servers/authorization/the-authorization-request/) | [OAuth 1](https://oauth.net/core/1.0a/#auth_step2)
*/
export default function getAuthorizationUrl({ options, query, }: {
options: InternalOptions<"oauth">;
query: RequestInternal["query"];
}): Promise<{
redirect: string;
cookies?: undefined;
} | {
redirect: string;
cookies: Cookie[];
}>;
//# sourceMappingURL=authorization-url.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"authorization-url.d.ts","sourceRoot":"","sources":["../../../src/core/lib/oauth/authorization-url.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;GAKG;AACH,wBAA8B,mBAAmB,CAAC,EAChD,OAAO,EACP,KAAK,GACN,EAAE;IACD,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IACjC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;CAChC;;;;;;GAyCA"}

View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getAuthorizationUrl;
var _client = require("./client");
var _clientLegacy = require("./client-legacy");
var checks = _interopRequireWildcard(require("./checks"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
async function getAuthorizationUrl({
options,
query
}) {
var _provider$version;
const {
logger,
provider
} = options;
let params = {};
if (typeof provider.authorization === "string") {
const parsedUrl = new URL(provider.authorization);
const parsedParams = Object.fromEntries(parsedUrl.searchParams);
params = {
...params,
...parsedParams
};
} else {
var _provider$authorizati;
params = {
...params,
...((_provider$authorizati = provider.authorization) === null || _provider$authorizati === void 0 ? void 0 : _provider$authorizati.params)
};
}
params = {
...params,
...query
};
if ((_provider$version = provider.version) !== null && _provider$version !== void 0 && _provider$version.startsWith("1.")) {
var _provider$authorizati2;
const client = (0, _clientLegacy.oAuth1Client)(options);
const tokens = await client.getOAuthRequestToken(params);
const url = `${(_provider$authorizati2 = provider.authorization) === null || _provider$authorizati2 === void 0 ? void 0 : _provider$authorizati2.url}?${new URLSearchParams({
oauth_token: tokens.oauth_token,
oauth_token_secret: tokens.oauth_token_secret,
...tokens.params
})}`;
_clientLegacy.oAuth1TokenStore.set(tokens.oauth_token, tokens.oauth_token_secret);
logger.debug("GET_AUTHORIZATION_URL", {
url,
provider
});
return {
redirect: url
};
}
const client = await (0, _client.openidClient)(options);
const authorizationParams = params;
const cookies = [];
await checks.state.create(options, cookies, authorizationParams);
await checks.pkce.create(options, cookies, authorizationParams);
await checks.nonce.create(options, cookies, authorizationParams);
const url = client.authorizationUrl(authorizationParams);
logger.debug("GET_AUTHORIZATION_URL", {
url,
cookies,
provider
});
return {
redirect: url,
cookies
};
}

37
node_modules/next-auth/core/lib/oauth/callback.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import { TokenSet } from "openid-client";
import type { LoggerInstance, Profile } from "../../..";
import type { OAuthConfig } from "../../../providers";
import type { InternalOptions } from "../../types";
import type { RequestInternal } from "../..";
import type { Cookie } from "../cookie";
export default function oAuthCallback(params: {
options: InternalOptions<"oauth">;
query: RequestInternal["query"];
body: RequestInternal["body"];
method: Required<RequestInternal>["method"];
cookies: RequestInternal["cookies"];
}): Promise<{
cookies: Cookie[];
profile?: import("../../types").User | undefined;
account?: {
access_token?: string | undefined;
token_type?: string | undefined;
id_token?: string | undefined;
refresh_token?: string | undefined;
expires_in?: number | undefined;
expires_at?: number | undefined;
session_state?: string | undefined;
scope?: string | undefined;
provider: string;
type: "oauth";
providerAccountId: string;
} | undefined;
OAuthProfile?: Profile | undefined;
}>;
export interface GetProfileParams {
profile: Profile;
tokens: TokenSet;
provider: OAuthConfig<any>;
logger: LoggerInstance;
}
//# sourceMappingURL=callback.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../../src/core/lib/oauth/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAOxC,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,wBAA8B,aAAa,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IACjC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC7B,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3C,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACpC;;;;;;;;;;;;;;;;;GAkHA;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,QAAQ,CAAA;IAChB,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;IAC1B,MAAM,EAAE,cAAc,CAAA;CACvB"}

160
node_modules/next-auth/core/lib/oauth/callback.js generated vendored Normal file
View File

@@ -0,0 +1,160 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = oAuthCallback;
var _openidClient = require("openid-client");
var _client = require("./client");
var _clientLegacy = require("./client-legacy");
var _checks = _interopRequireWildcard(require("./checks"));
var _errors = require("../../errors");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
async function oAuthCallback(params) {
var _body$error, _provider$version;
const {
options,
query,
body,
method,
cookies
} = params;
const {
logger,
provider
} = options;
const errorMessage = (_body$error = body === null || body === void 0 ? void 0 : body.error) !== null && _body$error !== void 0 ? _body$error : query === null || query === void 0 ? void 0 : query.error;
if (errorMessage) {
const error = new Error(errorMessage);
logger.error("OAUTH_CALLBACK_HANDLER_ERROR", {
error,
error_description: query === null || query === void 0 ? void 0 : query.error_description,
providerId: provider.id
});
logger.debug("OAUTH_CALLBACK_HANDLER_ERROR", {
body
});
throw error;
}
if ((_provider$version = provider.version) !== null && _provider$version !== void 0 && _provider$version.startsWith("1.")) {
try {
const client = await (0, _clientLegacy.oAuth1Client)(options);
const {
oauth_token,
oauth_verifier
} = query !== null && query !== void 0 ? query : {};
const tokens = await client.getOAuthAccessToken(oauth_token, _clientLegacy.oAuth1TokenStore.get(oauth_token), oauth_verifier);
let profile = await client.get(provider.profileUrl, tokens.oauth_token, tokens.oauth_token_secret);
if (typeof profile === "string") {
profile = JSON.parse(profile);
}
const newProfile = await getProfile({
profile,
tokens,
provider,
logger
});
return {
...newProfile,
cookies: []
};
} catch (error) {
logger.error("OAUTH_V1_GET_ACCESS_TOKEN_ERROR", error);
throw error;
}
}
if (query !== null && query !== void 0 && query.oauth_token) _clientLegacy.oAuth1TokenStore.delete(query.oauth_token);
try {
var _provider$token, _provider$token2, _provider$userinfo;
const client = await (0, _client.openidClient)(options);
let tokens;
const checks = {};
const resCookies = [];
await _checks.state.use(cookies, resCookies, options, checks);
await _checks.pkce.use(cookies, resCookies, options, checks);
await _checks.nonce.use(cookies, resCookies, options, checks);
const params = {
...client.callbackParams({
url: `http://n?${new URLSearchParams(query)}`,
body,
method
}),
...((_provider$token = provider.token) === null || _provider$token === void 0 ? void 0 : _provider$token.params)
};
if ((_provider$token2 = provider.token) !== null && _provider$token2 !== void 0 && _provider$token2.request) {
const response = await provider.token.request({
provider,
params,
checks,
client
});
tokens = new _openidClient.TokenSet(response.tokens);
} else if (provider.idToken) {
tokens = await client.callback(provider.callbackUrl, params, checks);
} else {
tokens = await client.oauthCallback(provider.callbackUrl, params, checks);
}
if (Array.isArray(tokens.scope)) {
tokens.scope = tokens.scope.join(" ");
}
let profile;
if ((_provider$userinfo = provider.userinfo) !== null && _provider$userinfo !== void 0 && _provider$userinfo.request) {
profile = await provider.userinfo.request({
provider,
tokens,
client
});
} else if (provider.idToken) {
profile = tokens.claims();
} else {
var _provider$userinfo2;
profile = await client.userinfo(tokens, {
params: (_provider$userinfo2 = provider.userinfo) === null || _provider$userinfo2 === void 0 ? void 0 : _provider$userinfo2.params
});
}
const profileResult = await getProfile({
profile,
provider,
tokens,
logger
});
return {
...profileResult,
cookies: resCookies
};
} catch (error) {
throw new _errors.OAuthCallbackError(error);
}
}
async function getProfile({
profile: OAuthProfile,
tokens,
provider,
logger
}) {
try {
var _profile$email;
logger.debug("PROFILE_DATA", {
OAuthProfile
});
const profile = await provider.profile(OAuthProfile, tokens);
profile.email = (_profile$email = profile.email) === null || _profile$email === void 0 ? void 0 : _profile$email.toLowerCase();
if (!profile.id) throw new TypeError(`Profile id is missing in ${provider.name} OAuth profile response`);
return {
profile,
account: {
provider: provider.id,
type: provider.type,
providerAccountId: profile.id.toString(),
...tokens
},
OAuthProfile
};
} catch (error) {
logger.error("OAUTH_PARSE_PROFILE_ERROR", {
error: error,
OAuthProfile
});
}
}

42
node_modules/next-auth/core/lib/oauth/checks.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import { AuthorizationParameters, OpenIDCallbackChecks } from "openid-client";
import type { RequestInternal } from "../..";
import type { OAuthChecks } from "../../../providers";
import type { CookiesOptions, InternalOptions } from "../../types";
import type { Cookie } from "../cookie";
/** Returns a signed cookie. */
export declare function signCookie(type: keyof CookiesOptions, value: string, maxAge: number, options: InternalOptions<"oauth">): Promise<Cookie>;
export declare const PKCE_CODE_CHALLENGE_METHOD = "S256";
export declare const pkce: {
create(options: InternalOptions<"oauth">, cookies: Cookie[], resParams: AuthorizationParameters): Promise<void>;
/**
* Returns code_verifier if the provider is configured to use PKCE,
* and clears the container cookie afterwards.
* An error is thrown if the code_verifier is missing or invalid.
* @see https://www.rfc-editor.org/rfc/rfc7636
* @see https://danielfett.de/2020/05/16/pkce-vs-nonce-equivalent-or-not/#pkce
*/
use(cookies: RequestInternal["cookies"], resCookies: Cookie[], options: InternalOptions<"oauth">, checks: OAuthChecks): Promise<string | undefined>;
};
export declare const state: {
create(options: InternalOptions<"oauth">, cookies: Cookie[], resParams: AuthorizationParameters): Promise<void>;
/**
* Returns state if the provider is configured to use state,
* and clears the container cookie afterwards.
* An error is thrown if the state is missing or invalid.
* @see https://www.rfc-editor.org/rfc/rfc6749#section-10.12
* @see https://www.rfc-editor.org/rfc/rfc6749#section-4.1.1
*/
use(cookies: RequestInternal["cookies"], resCookies: Cookie[], options: InternalOptions<"oauth">, checks: OAuthChecks): Promise<void>;
};
export declare const nonce: {
create(options: InternalOptions<"oauth">, cookies: Cookie[], resParams: AuthorizationParameters): Promise<void>;
/**
* Returns nonce if the provider is configured to use nonce,
* and clears the container cookie afterwards.
* An error is thrown if the nonce is missing or invalid.
* @see https://openid.net/specs/openid-connect-core-1_0.html#NonceNotes
* @see https://danielfett.de/2020/05/16/pkce-vs-nonce-equivalent-or-not/#nonce
*/
use(cookies: RequestInternal["cookies"], resCookies: Cookie[], options: InternalOptions<"oauth">, checks: OpenIDCallbackChecks): Promise<string | undefined>;
};
//# sourceMappingURL=checks.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/core/lib/oauth/checks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,+BAA+B;AAC/B,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,cAAc,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAGD,eAAO,MAAM,0BAA0B,SAAS,CAAA;AAChD,eAAO,MAAM,IAAI;oBAEJ,gBAAgB,OAAO,CAAC,WACxB,MAAM,EAAE,aACN,uBAAuB;IAepC;;;;;;OAMG;iBAEQ,eAAe,CAAC,SAAS,CAAC,cACvB,MAAM,EAAE,WACX,gBAAgB,OAAO,CAAC,UACzB,WAAW,GAClB,QAAQ,MAAM,GAAG,SAAS,CAAC;CA0B/B,CAAA;AAGD,eAAO,MAAM,KAAK;oBAEL,gBAAgB,OAAO,CAAC,WACxB,MAAM,EAAE,aACN,uBAAuB;IAQpC;;;;;;OAMG;iBAEQ,eAAe,CAAC,SAAS,CAAC,cACvB,MAAM,EAAE,WACX,gBAAgB,OAAO,CAAC,UACzB,WAAW;CAyBtB,CAAA;AAGD,eAAO,MAAM,KAAK;oBAEL,gBAAgB,OAAO,CAAC,WACxB,MAAM,EAAE,aACN,uBAAuB;IAQpC;;;;;;OAMG;iBAEQ,eAAe,CAAC,SAAS,CAAC,cACvB,MAAM,EAAE,WACX,gBAAgB,OAAO,CAAC,UACzB,oBAAoB,GAC3B,QAAQ,MAAM,GAAG,SAAS,CAAC;CAuB/B,CAAA"}

150
node_modules/next-auth/core/lib/oauth/checks.js generated vendored Normal file
View File

@@ -0,0 +1,150 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.pkce = exports.nonce = exports.PKCE_CODE_CHALLENGE_METHOD = void 0;
exports.signCookie = signCookie;
exports.state = void 0;
var _openidClient = require("openid-client");
var jwt = _interopRequireWildcard(require("../../../jwt"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
async function signCookie(type, value, maxAge, options) {
const {
cookies,
logger
} = options;
logger.debug(`CREATE_${type.toUpperCase()}`, {
value,
maxAge
});
const {
name
} = cookies[type];
const expires = new Date();
expires.setTime(expires.getTime() + maxAge * 1000);
return {
name,
value: await jwt.encode({
...options.jwt,
maxAge,
token: {
value
},
salt: name
}),
options: {
...cookies[type].options,
expires
}
};
}
const PKCE_MAX_AGE = 60 * 15;
const PKCE_CODE_CHALLENGE_METHOD = exports.PKCE_CODE_CHALLENGE_METHOD = "S256";
const pkce = exports.pkce = {
async create(options, cookies, resParams) {
var _options$provider, _options$cookies$pkce;
if (!((_options$provider = options.provider) !== null && _options$provider !== void 0 && (_options$provider = _options$provider.checks) !== null && _options$provider !== void 0 && _options$provider.includes("pkce"))) return;
const code_verifier = _openidClient.generators.codeVerifier();
const value = _openidClient.generators.codeChallenge(code_verifier);
resParams.code_challenge = value;
resParams.code_challenge_method = PKCE_CODE_CHALLENGE_METHOD;
const maxAge = (_options$cookies$pkce = options.cookies.pkceCodeVerifier.options.maxAge) !== null && _options$cookies$pkce !== void 0 ? _options$cookies$pkce : PKCE_MAX_AGE;
cookies.push(await signCookie("pkceCodeVerifier", code_verifier, maxAge, options));
},
async use(cookies, resCookies, options, checks) {
var _options$provider2;
if (!((_options$provider2 = options.provider) !== null && _options$provider2 !== void 0 && (_options$provider2 = _options$provider2.checks) !== null && _options$provider2 !== void 0 && _options$provider2.includes("pkce"))) return;
const codeVerifier = cookies === null || cookies === void 0 ? void 0 : cookies[options.cookies.pkceCodeVerifier.name];
if (!codeVerifier) throw new TypeError("PKCE code_verifier cookie was missing.");
const {
name
} = options.cookies.pkceCodeVerifier;
const value = await jwt.decode({
...options.jwt,
token: codeVerifier,
salt: name
});
if (!(value !== null && value !== void 0 && value.value)) throw new TypeError("PKCE code_verifier value could not be parsed.");
resCookies.push({
name,
value: "",
options: {
...options.cookies.pkceCodeVerifier.options,
maxAge: 0
}
});
checks.code_verifier = value.value;
}
};
const STATE_MAX_AGE = 60 * 15;
const state = exports.state = {
async create(options, cookies, resParams) {
var _options$provider$che, _options$cookies$stat;
if (!((_options$provider$che = options.provider.checks) !== null && _options$provider$che !== void 0 && _options$provider$che.includes("state"))) return;
const value = _openidClient.generators.state();
resParams.state = value;
const maxAge = (_options$cookies$stat = options.cookies.state.options.maxAge) !== null && _options$cookies$stat !== void 0 ? _options$cookies$stat : STATE_MAX_AGE;
cookies.push(await signCookie("state", value, maxAge, options));
},
async use(cookies, resCookies, options, checks) {
var _options$provider$che2;
if (!((_options$provider$che2 = options.provider.checks) !== null && _options$provider$che2 !== void 0 && _options$provider$che2.includes("state"))) return;
const state = cookies === null || cookies === void 0 ? void 0 : cookies[options.cookies.state.name];
if (!state) throw new TypeError("State cookie was missing.");
const {
name
} = options.cookies.state;
const value = await jwt.decode({
...options.jwt,
token: state,
salt: name
});
if (!(value !== null && value !== void 0 && value.value)) throw new TypeError("State value could not be parsed.");
resCookies.push({
name,
value: "",
options: {
...options.cookies.state.options,
maxAge: 0
}
});
checks.state = value.value;
}
};
const NONCE_MAX_AGE = 60 * 15;
const nonce = exports.nonce = {
async create(options, cookies, resParams) {
var _options$provider$che3, _options$cookies$nonc;
if (!((_options$provider$che3 = options.provider.checks) !== null && _options$provider$che3 !== void 0 && _options$provider$che3.includes("nonce"))) return;
const value = _openidClient.generators.nonce();
resParams.nonce = value;
const maxAge = (_options$cookies$nonc = options.cookies.nonce.options.maxAge) !== null && _options$cookies$nonc !== void 0 ? _options$cookies$nonc : NONCE_MAX_AGE;
cookies.push(await signCookie("nonce", value, maxAge, options));
},
async use(cookies, resCookies, options, checks) {
var _options$provider3;
if (!((_options$provider3 = options.provider) !== null && _options$provider3 !== void 0 && (_options$provider3 = _options$provider3.checks) !== null && _options$provider3 !== void 0 && _options$provider3.includes("nonce"))) return;
const nonce = cookies === null || cookies === void 0 ? void 0 : cookies[options.cookies.nonce.name];
if (!nonce) throw new TypeError("Nonce cookie was missing.");
const {
name
} = options.cookies.nonce;
const value = await jwt.decode({
...options.jwt,
token: nonce,
salt: name
});
if (!(value !== null && value !== void 0 && value.value)) throw new TypeError("Nonce value could not be parsed.");
resCookies.push({
name,
value: "",
options: {
...options.cookies.nonce.options,
maxAge: 0
}
});
checks.nonce = value.value;
}
};

View File

@@ -0,0 +1,8 @@
import { OAuth } from "oauth";
import type { InternalOptions } from "../../types";
/**
* Client supporting OAuth 1.x
*/
export declare function oAuth1Client(options: InternalOptions<"oauth">): OAuth;
export declare const oAuth1TokenStore: Map<any, any>;
//# sourceMappingURL=client-legacy.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"client-legacy.d.ts","sourceRoot":"","sources":["../../../src/core/lib/oauth/client-legacy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,SA6D7D;AAED,eAAO,MAAM,gBAAgB,eAAY,CAAA"}

55
node_modules/next-auth/core/lib/oauth/client-legacy.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.oAuth1Client = oAuth1Client;
exports.oAuth1TokenStore = void 0;
var _oauth = require("oauth");
function oAuth1Client(options) {
var _provider$version, _provider$encoding;
const provider = options.provider;
const oauth1Client = new _oauth.OAuth(provider.requestTokenUrl, provider.accessTokenUrl, provider.clientId, provider.clientSecret, (_provider$version = provider.version) !== null && _provider$version !== void 0 ? _provider$version : "1.0", provider.callbackUrl, (_provider$encoding = provider.encoding) !== null && _provider$encoding !== void 0 ? _provider$encoding : "HMAC-SHA1");
const originalGet = oauth1Client.get.bind(oauth1Client);
oauth1Client.get = async (...args) => {
return await new Promise((resolve, reject) => {
originalGet(...args, (error, result) => {
if (error) {
return reject(error);
}
resolve(result);
});
});
};
const originalGetOAuth1AccessToken = oauth1Client.getOAuthAccessToken.bind(oauth1Client);
oauth1Client.getOAuthAccessToken = async (...args) => {
return await new Promise((resolve, reject) => {
originalGetOAuth1AccessToken(...args, (error, oauth_token, oauth_token_secret) => {
if (error) {
return reject(error);
}
resolve({
oauth_token,
oauth_token_secret
});
});
});
};
const originalGetOAuthRequestToken = oauth1Client.getOAuthRequestToken.bind(oauth1Client);
oauth1Client.getOAuthRequestToken = async (params = {}) => {
return await new Promise((resolve, reject) => {
originalGetOAuthRequestToken(params, (error, oauth_token, oauth_token_secret, params) => {
if (error) {
return reject(error);
}
resolve({
oauth_token,
oauth_token_secret,
params
});
});
});
};
return oauth1Client;
}
const oAuth1TokenStore = exports.oAuth1TokenStore = new Map();

11
node_modules/next-auth/core/lib/oauth/client.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import type { Client } from "openid-client";
import type { InternalOptions } from "../../types";
/**
* NOTE: We can add auto discovery of the provider's endpoint
* that requires only one endpoint to be specified by the user.
* Check out `Issuer.discover`
*
* Client supporting OAuth 2.x and OIDC
*/
export declare function openidClient(options: InternalOptions<"oauth">): Promise<Client>;
//# sourceMappingURL=client.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/lib/oauth/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,CAkCjB"}

32
node_modules/next-auth/core/lib/oauth/client.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.openidClient = openidClient;
var _openidClient = require("openid-client");
async function openidClient(options) {
const provider = options.provider;
if (provider.httpOptions) _openidClient.custom.setHttpOptionsDefaults(provider.httpOptions);
let issuer;
if (provider.wellKnown) {
issuer = await _openidClient.Issuer.discover(provider.wellKnown);
} else {
var _provider$authorizati, _provider$token, _provider$userinfo;
issuer = new _openidClient.Issuer({
issuer: provider.issuer,
authorization_endpoint: (_provider$authorizati = provider.authorization) === null || _provider$authorizati === void 0 ? void 0 : _provider$authorizati.url,
token_endpoint: (_provider$token = provider.token) === null || _provider$token === void 0 ? void 0 : _provider$token.url,
userinfo_endpoint: (_provider$userinfo = provider.userinfo) === null || _provider$userinfo === void 0 ? void 0 : _provider$userinfo.url,
jwks_uri: provider.jwks_endpoint
});
}
const client = new issuer.Client({
client_id: provider.clientId,
client_secret: provider.clientSecret,
redirect_uris: [provider.callbackUrl],
...provider.client
}, provider.jwks);
client[_openidClient.custom.clock_tolerance] = 10;
return client;
}

16
node_modules/next-auth/core/lib/providers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import type { InternalProvider } from "../types";
import type { Provider } from "../../providers";
import type { InternalUrl } from "../../utils/parse-url";
/**
* Adds `signinUrl` and `callbackUrl` to each provider
* and deep merge user-defined options.
*/
export default function parseProviders(params: {
providers: Provider[];
url: InternalUrl;
providerId?: string;
}): {
providers: InternalProvider[];
provider?: InternalProvider;
};
//# sourceMappingURL=providers.d.ts.map

1
node_modules/next-auth/core/lib/providers.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/core/lib/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAuB,MAAM,UAAU,CAAA;AACrE,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,MAAM,EAAE;IAC7C,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,GAAG,EAAE,WAAW,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG;IACF,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAC5B,CA4BA"}

65
node_modules/next-auth/core/lib/providers.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = parseProviders;
var _merge = require("../../utils/merge");
function parseProviders(params) {
const {
url,
providerId
} = params;
const providers = params.providers.map(({
options: userOptions,
...rest
}) => {
var _ref;
if (rest.type === "oauth") {
var _normalizedUserOption;
const normalizedOptions = normalizeOAuthOptions(rest);
const normalizedUserOptions = normalizeOAuthOptions(userOptions, true);
const id = (_normalizedUserOption = normalizedUserOptions === null || normalizedUserOptions === void 0 ? void 0 : normalizedUserOptions.id) !== null && _normalizedUserOption !== void 0 ? _normalizedUserOption : rest.id;
return (0, _merge.merge)(normalizedOptions, {
...normalizedUserOptions,
signinUrl: `${url}/signin/${id}`,
callbackUrl: `${url}/callback/${id}`
});
}
const id = (_ref = userOptions === null || userOptions === void 0 ? void 0 : userOptions.id) !== null && _ref !== void 0 ? _ref : rest.id;
return (0, _merge.merge)(rest, {
...userOptions,
signinUrl: `${url}/signin/${id}`,
callbackUrl: `${url}/callback/${id}`
});
});
return {
providers,
provider: providers.find(({
id
}) => id === providerId)
};
}
function normalizeOAuthOptions(oauthOptions, isUserOptions = false) {
var _normalized$version;
if (!oauthOptions) return;
const normalized = Object.entries(oauthOptions).reduce((acc, [key, value]) => {
if (["authorization", "token", "userinfo"].includes(key) && typeof value === "string") {
var _url$searchParams;
const url = new URL(value);
acc[key] = {
url: `${url.origin}${url.pathname}`,
params: Object.fromEntries((_url$searchParams = url.searchParams) !== null && _url$searchParams !== void 0 ? _url$searchParams : [])
};
} else {
acc[key] = value;
}
return acc;
}, {});
if (!isUserOptions && !((_normalized$version = normalized.version) !== null && _normalized$version !== void 0 && _normalized$version.startsWith("1."))) {
var _ref2, _normalized$idToken, _normalized$wellKnown, _normalized$authoriza;
normalized.idToken = Boolean((_ref2 = (_normalized$idToken = normalized.idToken) !== null && _normalized$idToken !== void 0 ? _normalized$idToken : (_normalized$wellKnown = normalized.wellKnown) === null || _normalized$wellKnown === void 0 ? void 0 : _normalized$wellKnown.includes("openid-configuration")) !== null && _ref2 !== void 0 ? _ref2 : (_normalized$authoriza = normalized.authorization) === null || _normalized$authoriza === void 0 || (_normalized$authoriza = _normalized$authoriza.params) === null || _normalized$authoriza === void 0 || (_normalized$authoriza = _normalized$authoriza.scope) === null || _normalized$authoriza === void 0 ? void 0 : _normalized$authoriza.includes("openid"));
if (!normalized.checks) normalized.checks = ["state"];
}
return normalized;
}

20
node_modules/next-auth/core/lib/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import type { AuthOptions } from "../..";
import type { InternalOptions } from "../types";
import type { InternalUrl } from "../../utils/parse-url";
/**
* Takes a number in seconds and returns the date in the future.
* Optionally takes a second date parameter. In that case
* the date in the future will be calculated from that date instead of now.
*/
export declare function fromDate(time: number, date?: number): Date;
export declare function hashToken(token: string, options: InternalOptions<"email">): string;
/**
* Secret used salt cookies and tokens (e.g. for CSRF protection).
* If no secret option is specified then it creates one on the fly
* based on options passed here. If options contains unique data, such as
* OAuth provider secrets and database credentials it should be sufficent. If no secret provided in production, we throw an error. */
export declare function createSecret(params: {
authOptions: AuthOptions;
url: InternalUrl;
}): string;
//# sourceMappingURL=utils.d.ts.map

1
node_modules/next-auth/core/lib/utils.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/core/lib/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAa,QAEvD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,UAQzE;AAED;;;;qIAIqI;AACrI,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,WAAW,EAAE,WAAW,CAAA;IACxB,GAAG,EAAE,WAAW,CAAA;CACjB,UAUA"}

31
node_modules/next-auth/core/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSecret = createSecret;
exports.fromDate = fromDate;
exports.hashToken = hashToken;
var _crypto = require("crypto");
function fromDate(time, date = Date.now()) {
return new Date(date + time * 1000);
}
function hashToken(token, options) {
var _provider$secret;
const {
provider,
secret
} = options;
return (0, _crypto.createHash)("sha256").update(`${token}${(_provider$secret = provider.secret) !== null && _provider$secret !== void 0 ? _provider$secret : secret}`).digest("hex");
}
function createSecret(params) {
var _authOptions$secret;
const {
authOptions,
url
} = params;
return (_authOptions$secret = authOptions.secret) !== null && _authOptions$secret !== void 0 ? _authOptions$secret : (0, _crypto.createHash)("sha256").update(JSON.stringify({
...url,
...authOptions
})).digest("hex");
}

19
node_modules/next-auth/core/pages/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/// <reference types="react" />
import { Theme } from "../..";
import { InternalUrl } from "../../utils/parse-url";
/**
* The following errors are passed as error query parameters to the default or overridden error page.
*
* [Documentation](https://next-auth.js.org/configuration/pages#error-page) */
export declare type ErrorType = "default" | "configuration" | "accessdenied" | "verification";
export interface ErrorProps {
url?: InternalUrl;
theme?: Theme;
error?: ErrorType;
}
/** Renders an error page. */
export default function ErrorPage(props: ErrorProps): {
status: any;
html: JSX.Element;
};
//# sourceMappingURL=error.d.ts.map

1
node_modules/next-auth/core/pages/error.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/core/pages/error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD;;;8EAG8E;AAC9E,oBAAY,SAAS,GACjB,SAAS,GACT,eAAe,GACf,cAAc,GACd,cAAc,CAAA;AAElB,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,WAAW,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AASD,6BAA6B;AAC7B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,UAAU;;;EAoFlD"}

76
node_modules/next-auth/core/pages/error.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ErrorPage;
var _preact = require("preact");
function ErrorPage(props) {
var _errors$error$toLower;
const {
url,
error = "default",
theme
} = props;
const signinPageUrl = `${url}/signin`;
const errors = {
default: {
status: 200,
heading: "Error",
message: (0, _preact.h)("p", null, (0, _preact.h)("a", {
className: "site",
href: url === null || url === void 0 ? void 0 : url.origin
}, url === null || url === void 0 ? void 0 : url.host))
},
configuration: {
status: 500,
heading: "Server error",
message: (0, _preact.h)("div", null, (0, _preact.h)("p", null, "There is a problem with the server configuration."), (0, _preact.h)("p", null, "Check the server logs for more information."))
},
accessdenied: {
status: 403,
heading: "Access Denied",
message: (0, _preact.h)("div", null, (0, _preact.h)("p", null, "You do not have permission to sign in."), (0, _preact.h)("p", null, (0, _preact.h)("a", {
className: "button",
href: signinPageUrl
}, "Sign in")))
},
verification: {
status: 403,
heading: "Unable to sign in",
message: (0, _preact.h)("div", null, (0, _preact.h)("p", null, "The sign in link is no longer valid."), (0, _preact.h)("p", null, "It may have been used already or it may have expired.")),
signin: (0, _preact.h)("a", {
className: "button",
href: signinPageUrl
}, "Sign in")
}
};
const {
status,
heading,
message,
signin
} = (_errors$error$toLower = errors[error.toLowerCase()]) !== null && _errors$error$toLower !== void 0 ? _errors$error$toLower : errors.default;
return {
status,
html: (0, _preact.h)("div", {
className: "error"
}, (theme === null || theme === void 0 ? void 0 : theme.brandColor) && (0, _preact.h)("style", {
dangerouslySetInnerHTML: {
__html: `
:root {
--brand-color: ${theme === null || theme === void 0 ? void 0 : theme.brandColor}
}
`
}
}), (0, _preact.h)("div", {
className: "card"
}, (theme === null || theme === void 0 ? void 0 : theme.logo) && (0, _preact.h)("img", {
src: theme.logo,
alt: "Logo",
className: "logo"
}), (0, _preact.h)("h1", null, heading), (0, _preact.h)("div", {
className: "message"
}, message), signin))
};
}

22
node_modules/next-auth/core/pages/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import type { InternalOptions } from "../types";
import type { RequestInternal, ResponseInternal } from "..";
import type { Cookie } from "../lib/cookie";
import type { ErrorType } from "./error";
declare type RenderPageParams = {
query?: RequestInternal["query"];
cookies?: Cookie[];
} & Partial<Pick<InternalOptions, "url" | "callbackUrl" | "csrfToken" | "providers" | "theme">>;
/**
* Unless the user defines their [own pages](https://next-auth.js.org/configuration/pages),
* we render a set of default ones, using Preact SSR.
*/
export default function renderPage(params: RenderPageParams): {
signin(props?: any): ResponseInternal<any>;
signout(props?: any): ResponseInternal<any>;
verifyRequest(props?: any): ResponseInternal<any>;
error(props?: {
error?: ErrorType;
}): ResponseInternal<any>;
};
export {};
//# sourceMappingURL=index.d.ts.map

1
node_modules/next-auth/core/pages/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/pages/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,aAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,GAAG,OAAO,CACT,IAAI,CACF,eAAe,EACf,KAAK,GAAG,aAAa,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,CAC5D,CACF,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,MAAM,EAAE,gBAAgB;mBAexC,GAAG;oBAaF,GAAG;0BAWG,GAAG;kBAMX;QAAE,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE;EAOtC"}

83
node_modules/next-auth/core/pages/index.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = renderPage;
var _preactRenderToString = _interopRequireDefault(require("preact-render-to-string"));
var _signin = _interopRequireDefault(require("./signin"));
var _signout = _interopRequireDefault(require("./signout"));
var _verifyRequest = _interopRequireDefault(require("./verify-request"));
var _error = _interopRequireDefault(require("./error"));
var _css = _interopRequireDefault(require("../../css"));
function renderPage(params) {
const {
url,
theme,
query,
cookies
} = params;
function send({
html,
title,
status
}) {
var _theme$colorScheme;
return {
cookies,
status,
headers: [{
key: "Content-Type",
value: "text/html"
}],
body: `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>${(0, _css.default)()}</style><title>${title}</title></head><body class="__next-auth-theme-${(_theme$colorScheme = theme === null || theme === void 0 ? void 0 : theme.colorScheme) !== null && _theme$colorScheme !== void 0 ? _theme$colorScheme : "auto"}"><div class="page">${(0, _preactRenderToString.default)(html)}</div></body></html>`
};
}
return {
signin(props) {
return send({
html: (0, _signin.default)({
csrfToken: params.csrfToken,
providers: params.providers,
callbackUrl: params.callbackUrl,
theme,
...query,
...props
}),
title: "Sign In"
});
},
signout(props) {
return send({
html: (0, _signout.default)({
csrfToken: params.csrfToken,
url,
theme,
...props
}),
title: "Sign Out"
});
},
verifyRequest(props) {
return send({
html: (0, _verifyRequest.default)({
url,
theme,
...props
}),
title: "Verify Request"
});
},
error(props) {
return send({
...(0, _error.default)({
url,
theme,
...props
}),
title: "Error"
});
}
};
}

17
node_modules/next-auth/core/pages/signin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/// <reference types="react" />
import type { InternalProvider, Theme } from "../types";
/**
* The following errors are passed as error query parameters to the default or overridden sign-in page.
*
* [Documentation](https://next-auth.js.org/configuration/pages#sign-in-page) */
export declare type SignInErrorTypes = "Signin" | "OAuthSignin" | "OAuthCallback" | "OAuthCreateAccount" | "EmailCreateAccount" | "Callback" | "OAuthAccountNotLinked" | "EmailSignin" | "CredentialsSignin" | "SessionRequired" | "default";
export interface SignInServerPageParams {
csrfToken: string;
providers: InternalProvider[];
callbackUrl: string;
email: string;
error: SignInErrorTypes;
theme: Theme;
}
export default function SigninPage(props: SignInServerPageParams): JSX.Element;
//# sourceMappingURL=signin.d.ts.map

1
node_modules/next-auth/core/pages/signin.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"signin.d.ts","sourceRoot":"","sources":["../../src/core/pages/signin.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAGvD;;;gFAGgF;AAChF,oBAAY,gBAAgB,GACxB,QAAQ,GACR,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,oBAAoB,GACpB,UAAU,GACV,uBAAuB,GACvB,aAAa,GACb,mBAAmB,GACnB,iBAAiB,GACjB,SAAS,CAAA;AAEb,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,gBAAgB,EAAE,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,gBAAgB,CAAA;IACvB,KAAK,EAAE,KAAK,CAAA;CACb;AA6BD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,sBAAsB,eA8N/D"}

190
node_modules/next-auth/core/pages/signin.js generated vendored Normal file
View File

@@ -0,0 +1,190 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = SigninPage;
var _preact = require("preact");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
function hexToRgba(hex, alpha = 1) {
if (!hex) {
return;
}
hex = hex.replace(/^#/, "");
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
const bigint = parseInt(hex, 16);
const r = bigint >> 16 & 255;
const g = bigint >> 8 & 255;
const b = bigint & 255;
alpha = Math.min(Math.max(alpha, 0), 1);
const rgba = `rgba(${r}, ${g}, ${b}, ${alpha})`;
return rgba;
}
function SigninPage(props) {
var _errors$errorType;
const {
csrfToken,
providers,
callbackUrl,
theme,
email,
error: errorType
} = props;
const providersToRender = providers.filter(provider => {
if (provider.type === "oauth" || provider.type === "email") {
return true;
} else if (provider.type === "credentials" && provider.credentials) {
return true;
}
return false;
});
if (typeof document !== "undefined" && theme.buttonText) {
document.documentElement.style.setProperty("--button-text-color", theme.buttonText);
}
if (typeof document !== "undefined" && theme.brandColor) {
document.documentElement.style.setProperty("--brand-color", theme.brandColor);
}
const errors = {
Signin: "Try signing in with a different account.",
OAuthSignin: "Try signing in with a different account.",
OAuthCallback: "Try signing in with a different account.",
OAuthCreateAccount: "Try signing in with a different account.",
EmailCreateAccount: "Try signing in with a different account.",
Callback: "Try signing in with a different account.",
OAuthAccountNotLinked: "To confirm your identity, sign in with the same account you used originally.",
EmailSignin: "The e-mail could not be sent.",
CredentialsSignin: "Sign in failed. Check the details you provided are correct.",
SessionRequired: "Please sign in to access this page.",
default: "Unable to sign in."
};
const error = errorType && ((_errors$errorType = errors[errorType]) !== null && _errors$errorType !== void 0 ? _errors$errorType : errors.default);
const providerLogoPath = "https://authjs.dev/img/providers";
return (0, _preact.h)("div", {
className: "signin"
}, theme.brandColor && (0, _preact.h)("style", {
dangerouslySetInnerHTML: {
__html: `
:root {
--brand-color: ${theme.brandColor}
}
`
}
}), theme.buttonText && (0, _preact.h)("style", {
dangerouslySetInnerHTML: {
__html: `
:root {
--button-text-color: ${theme.buttonText}
}
`
}
}), (0, _preact.h)("div", {
className: "card"
}, theme.logo && (0, _preact.h)("img", {
src: theme.logo,
alt: "Logo",
className: "logo"
}), error && (0, _preact.h)("div", {
className: "error"
}, (0, _preact.h)("p", null, error)), providersToRender.map((provider, i) => {
let bg, text, logo, logoDark, bgDark, textDark;
if (provider.type === "oauth") {
var _provider$style;
;
({
bg = "",
text = "",
logo = "",
bgDark = bg,
textDark = text,
logoDark = ""
} = (_provider$style = provider.style) !== null && _provider$style !== void 0 ? _provider$style : {});
logo = logo.startsWith("/") ? `${providerLogoPath}${logo}` : logo;
logoDark = logoDark.startsWith("/") ? `${providerLogoPath}${logoDark}` : logoDark || logo;
logoDark || (logoDark = logo);
}
return (0, _preact.h)("div", {
key: provider.id,
className: "provider"
}, provider.type === "oauth" && (0, _preact.h)("form", {
action: provider.signinUrl,
method: "POST"
}, (0, _preact.h)("input", {
type: "hidden",
name: "csrfToken",
value: csrfToken
}), callbackUrl && (0, _preact.h)("input", {
type: "hidden",
name: "callbackUrl",
value: callbackUrl
}), (0, _preact.h)("button", {
type: "submit",
className: "button",
style: {
"--provider-bg": bg,
"--provider-dark-bg": bgDark,
"--provider-color": text,
"--provider-dark-color": textDark,
"--provider-bg-hover": hexToRgba(bg, 0.8),
"--provider-dark-bg-hover": hexToRgba(bgDark, 0.8)
}
}, logo && (0, _preact.h)("img", {
loading: "lazy",
height: 24,
width: 24,
id: "provider-logo",
src: `${logo.startsWith("/") ? providerLogoPath : ""}${logo}`
}), logoDark && (0, _preact.h)("img", {
loading: "lazy",
height: 24,
width: 24,
id: "provider-logo-dark",
src: `${logo.startsWith("/") ? providerLogoPath : ""}${logoDark}`
}), (0, _preact.h)("span", null, "Sign in with ", provider.name))), (provider.type === "email" || provider.type === "credentials") && i > 0 && providersToRender[i - 1].type !== "email" && providersToRender[i - 1].type !== "credentials" && (0, _preact.h)("hr", null), provider.type === "email" && (0, _preact.h)("form", {
action: provider.signinUrl,
method: "POST"
}, (0, _preact.h)("input", {
type: "hidden",
name: "csrfToken",
value: csrfToken
}), (0, _preact.h)("label", {
className: "section-header",
htmlFor: `input-email-for-${provider.id}-provider`
}, "Email"), (0, _preact.h)("input", {
id: `input-email-for-${provider.id}-provider`,
autoFocus: true,
type: "email",
name: "email",
value: email,
placeholder: "email@example.com",
required: true
}), (0, _preact.h)("button", {
id: "submitButton",
type: "submit"
}, "Sign in with ", provider.name)), provider.type === "credentials" && (0, _preact.h)("form", {
action: provider.callbackUrl,
method: "POST"
}, (0, _preact.h)("input", {
type: "hidden",
name: "csrfToken",
value: csrfToken
}), Object.keys(provider.credentials).map(credential => {
var _provider$credentials, _provider$credentials2, _provider$credentials3;
return (0, _preact.h)("div", {
key: `input-group-${provider.id}`
}, (0, _preact.h)("label", {
className: "section-header",
htmlFor: `input-${credential}-for-${provider.id}-provider`
}, (_provider$credentials = provider.credentials[credential].label) !== null && _provider$credentials !== void 0 ? _provider$credentials : credential), (0, _preact.h)("input", (0, _extends2.default)({
name: credential,
id: `input-${credential}-for-${provider.id}-provider`,
type: (_provider$credentials2 = provider.credentials[credential].type) !== null && _provider$credentials2 !== void 0 ? _provider$credentials2 : "text",
placeholder: (_provider$credentials3 = provider.credentials[credential].placeholder) !== null && _provider$credentials3 !== void 0 ? _provider$credentials3 : ""
}, provider.credentials[credential])));
}), (0, _preact.h)("button", {
type: "submit"
}, "Sign in with ", provider.name)), (provider.type === "email" || provider.type === "credentials") && i + 1 < providersToRender.length && (0, _preact.h)("hr", null));
})));
}

10
node_modules/next-auth/core/pages/signout.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/// <reference types="react" />
import { Theme } from "../..";
import { InternalUrl } from "../../utils/parse-url";
export interface SignoutProps {
url: InternalUrl;
csrfToken: string;
theme: Theme;
}
export default function SignoutPage(props: SignoutProps): JSX.Element;
//# sourceMappingURL=signout.d.ts.map

1
node_modules/next-auth/core/pages/signout.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"signout.d.ts","sourceRoot":"","sources":["../../src/core/pages/signout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,WAAW,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,KAAK,CAAA;CACb;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,YAAY,eAsCtD"}

49
node_modules/next-auth/core/pages/signout.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = SignoutPage;
var _preact = require("preact");
function SignoutPage(props) {
const {
url,
csrfToken,
theme
} = props;
return (0, _preact.h)("div", {
className: "signout"
}, theme.brandColor && (0, _preact.h)("style", {
dangerouslySetInnerHTML: {
__html: `
:root {
--brand-color: ${theme.brandColor}
}
`
}
}), theme.buttonText && (0, _preact.h)("style", {
dangerouslySetInnerHTML: {
__html: `
:root {
--button-text-color: ${theme.buttonText}
}
`
}
}), (0, _preact.h)("div", {
className: "card"
}, theme.logo && (0, _preact.h)("img", {
src: theme.logo,
alt: "Logo",
className: "logo"
}), (0, _preact.h)("h1", null, "Signout"), (0, _preact.h)("p", null, "Are you sure you want to sign out?"), (0, _preact.h)("form", {
action: `${url}/signout`,
method: "POST"
}, (0, _preact.h)("input", {
type: "hidden",
name: "csrfToken",
value: csrfToken
}), (0, _preact.h)("button", {
id: "submitButton",
type: "submit"
}, "Sign out"))));
}

10
node_modules/next-auth/core/pages/verify-request.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/// <reference types="react" />
import { Theme } from "../..";
import { InternalUrl } from "../../utils/parse-url";
interface VerifyRequestPageProps {
url: InternalUrl;
theme: Theme;
}
export default function VerifyRequestPage(props: VerifyRequestPageProps): JSX.Element;
export {};
//# sourceMappingURL=verify-request.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"verify-request.d.ts","sourceRoot":"","sources":["../../src/core/pages/verify-request.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD,UAAU,sBAAsB;IAC9B,GAAG,EAAE,WAAW,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;CACb;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eA4BtE"}

33
node_modules/next-auth/core/pages/verify-request.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = VerifyRequestPage;
var _preact = require("preact");
function VerifyRequestPage(props) {
const {
url,
theme
} = props;
return (0, _preact.h)("div", {
className: "verify-request"
}, theme.brandColor && (0, _preact.h)("style", {
dangerouslySetInnerHTML: {
__html: `
:root {
--brand-color: ${theme.brandColor}
}
`
}
}), (0, _preact.h)("div", {
className: "card"
}, theme.logo && (0, _preact.h)("img", {
src: theme.logo,
alt: "Logo",
className: "logo"
}), (0, _preact.h)("h1", null, "Check your email"), (0, _preact.h)("p", null, "A sign in link has been sent to your email address."), (0, _preact.h)("p", null, (0, _preact.h)("a", {
className: "site",
href: url.origin
}, url.host))));
}

14
node_modules/next-auth/core/routes/callback.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import type { InternalOptions } from "../types";
import type { RequestInternal, ResponseInternal } from "..";
import type { SessionStore } from "../lib/cookie";
/** Handle callbacks from login services */
export default function callback(params: {
options: InternalOptions;
query: RequestInternal["query"];
method: Required<RequestInternal>["method"];
body: RequestInternal["body"];
headers: RequestInternal["headers"];
cookies: RequestInternal["cookies"];
sessionStore: SessionStore;
}): Promise<ResponseInternal>;
//# sourceMappingURL=callback.d.ts.map

1
node_modules/next-auth/core/routes/callback.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../src/core/routes/callback.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAC3D,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,eAAe,CAAA;AAIzD,2CAA2C;AAC3C,wBAA8B,QAAQ,CAAC,MAAM,EAAE;IAC7C,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IAC/B,MAAM,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3C,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC7B,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACnC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;IACnC,YAAY,EAAE,YAAY,CAAA;CAC3B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwZ5B"}

417
node_modules/next-auth/core/routes/callback.js generated vendored Normal file
View File

@@ -0,0 +1,417 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = callback;
var _callback = _interopRequireDefault(require("../lib/oauth/callback"));
var _callbackHandler = _interopRequireDefault(require("../lib/callback-handler"));
var _utils = require("../lib/utils");
var _getUserFromEmail = _interopRequireDefault(require("../lib/email/getUserFromEmail"));
async function callback(params) {
const {
options,
query,
body,
method,
headers,
sessionStore
} = params;
const {
provider,
adapter,
url,
callbackUrl,
pages,
jwt,
events,
callbacks,
session: {
strategy: sessionStrategy,
maxAge: sessionMaxAge
},
logger
} = options;
const cookies = [];
const useJwtSession = sessionStrategy === "jwt";
if (provider.type === "oauth") {
try {
const {
profile,
account,
OAuthProfile,
cookies: oauthCookies
} = await (0, _callback.default)({
query,
body,
method,
options,
cookies: params.cookies
});
if (oauthCookies.length) cookies.push(...oauthCookies);
try {
var _events$signIn;
logger.debug("OAUTH_CALLBACK_RESPONSE", {
profile,
account,
OAuthProfile
});
if (!profile || !account || !OAuthProfile) {
return {
redirect: `${url}/signin`,
cookies
};
}
let userOrProfile = profile;
if (adapter) {
const {
getUserByAccount
} = adapter;
const userByAccount = await getUserByAccount({
providerAccountId: account.providerAccountId,
provider: provider.id
});
if (userByAccount) userOrProfile = userByAccount;
}
try {
const isAllowed = await callbacks.signIn({
user: userOrProfile,
account,
profile: OAuthProfile
});
if (!isAllowed) {
return {
redirect: `${url}/error?error=AccessDenied`,
cookies
};
} else if (typeof isAllowed === "string") {
return {
redirect: isAllowed,
cookies
};
}
} catch (error) {
return {
redirect: `${url}/error?error=${encodeURIComponent(error.message)}`,
cookies
};
}
const {
user,
session,
isNewUser
} = await (0, _callbackHandler.default)({
sessionToken: sessionStore.value,
profile,
account,
options
});
if (useJwtSession) {
var _user$id;
const defaultToken = {
name: user.name,
email: user.email,
picture: user.image,
sub: (_user$id = user.id) === null || _user$id === void 0 ? void 0 : _user$id.toString()
};
const token = await callbacks.jwt({
token: defaultToken,
user,
account,
profile: OAuthProfile,
isNewUser,
trigger: isNewUser ? "signUp" : "signIn"
});
const newToken = await jwt.encode({
...jwt,
token
});
const cookieExpires = new Date();
cookieExpires.setTime(cookieExpires.getTime() + sessionMaxAge * 1000);
const sessionCookies = sessionStore.chunk(newToken, {
expires: cookieExpires
});
cookies.push(...sessionCookies);
} else {
cookies.push({
name: options.cookies.sessionToken.name,
value: session.sessionToken,
options: {
...options.cookies.sessionToken.options,
expires: session.expires
}
});
}
await ((_events$signIn = events.signIn) === null || _events$signIn === void 0 ? void 0 : _events$signIn.call(events, {
user,
account,
profile,
isNewUser
}));
if (isNewUser && pages.newUser) {
return {
redirect: `${pages.newUser}${pages.newUser.includes("?") ? "&" : "?"}callbackUrl=${encodeURIComponent(callbackUrl)}`,
cookies
};
}
return {
redirect: callbackUrl,
cookies
};
} catch (error) {
if (error.name === "AccountNotLinkedError") {
return {
redirect: `${url}/error?error=OAuthAccountNotLinked`,
cookies
};
} else if (error.name === "CreateUserError") {
return {
redirect: `${url}/error?error=OAuthCreateAccount`,
cookies
};
}
logger.error("OAUTH_CALLBACK_HANDLER_ERROR", error);
return {
redirect: `${url}/error?error=Callback`,
cookies
};
}
} catch (error) {
if (error.name === "OAuthCallbackError") {
logger.error("OAUTH_CALLBACK_ERROR", {
error: error,
providerId: provider.id
});
return {
redirect: `${url}/error?error=OAuthCallback`,
cookies
};
}
logger.error("OAUTH_CALLBACK_ERROR", error);
return {
redirect: `${url}/error?error=Callback`,
cookies
};
}
} else if (provider.type === "email") {
try {
var _events$signIn2;
const paramToken = query === null || query === void 0 ? void 0 : query.token;
const paramIdentifier = query === null || query === void 0 ? void 0 : query.email;
if (!paramToken) {
return {
redirect: `${url}/error?error=configuration`,
cookies
};
}
const invite = await adapter.useVerificationToken({
identifier: paramIdentifier,
token: (0, _utils.hashToken)(paramToken, options)
});
const invalidInvite = !invite || invite.expires.valueOf() < Date.now() || paramIdentifier && invite.identifier !== paramIdentifier;
if (invalidInvite) {
return {
redirect: `${url}/error?error=Verification`,
cookies
};
}
const profile = await (0, _getUserFromEmail.default)({
email: invite.identifier,
adapter
});
const account = {
providerAccountId: profile.email,
type: "email",
provider: provider.id
};
try {
const signInCallbackResponse = await callbacks.signIn({
user: profile,
account
});
if (!signInCallbackResponse) {
return {
redirect: `${url}/error?error=AccessDenied`,
cookies
};
} else if (typeof signInCallbackResponse === "string") {
return {
redirect: signInCallbackResponse,
cookies
};
}
} catch (error) {
return {
redirect: `${url}/error?error=${encodeURIComponent(error.message)}`,
cookies
};
}
const {
user,
session,
isNewUser
} = await (0, _callbackHandler.default)({
sessionToken: sessionStore.value,
profile,
account,
options
});
if (useJwtSession) {
var _user$id2;
const defaultToken = {
name: user.name,
email: user.email,
picture: user.image,
sub: (_user$id2 = user.id) === null || _user$id2 === void 0 ? void 0 : _user$id2.toString()
};
const token = await callbacks.jwt({
token: defaultToken,
user,
account,
isNewUser,
trigger: isNewUser ? "signUp" : "signIn"
});
const newToken = await jwt.encode({
...jwt,
token
});
const cookieExpires = new Date();
cookieExpires.setTime(cookieExpires.getTime() + sessionMaxAge * 1000);
const sessionCookies = sessionStore.chunk(newToken, {
expires: cookieExpires
});
cookies.push(...sessionCookies);
} else {
cookies.push({
name: options.cookies.sessionToken.name,
value: session.sessionToken,
options: {
...options.cookies.sessionToken.options,
expires: session.expires
}
});
}
await ((_events$signIn2 = events.signIn) === null || _events$signIn2 === void 0 ? void 0 : _events$signIn2.call(events, {
user,
account,
isNewUser
}));
if (isNewUser && pages.newUser) {
return {
redirect: `${pages.newUser}${pages.newUser.includes("?") ? "&" : "?"}callbackUrl=${encodeURIComponent(callbackUrl)}`,
cookies
};
}
return {
redirect: callbackUrl,
cookies
};
} catch (error) {
if (error.name === "CreateUserError") {
return {
redirect: `${url}/error?error=EmailCreateAccount`,
cookies
};
}
logger.error("CALLBACK_EMAIL_ERROR", error);
return {
redirect: `${url}/error?error=Callback`,
cookies
};
}
} else if (provider.type === "credentials" && method === "POST") {
var _user$id3, _events$signIn3;
const credentials = body;
let user;
try {
user = await provider.authorize(credentials, {
query,
body,
headers,
method
});
if (!user) {
return {
status: 401,
redirect: `${url}/error?${new URLSearchParams({
error: "CredentialsSignin",
provider: provider.id
})}`,
cookies
};
}
} catch (error) {
return {
status: 401,
redirect: `${url}/error?error=${encodeURIComponent(error.message)}`,
cookies
};
}
const account = {
providerAccountId: user.id,
type: "credentials",
provider: provider.id
};
try {
const isAllowed = await callbacks.signIn({
user,
account,
credentials
});
if (!isAllowed) {
return {
status: 403,
redirect: `${url}/error?error=AccessDenied`,
cookies
};
} else if (typeof isAllowed === "string") {
return {
redirect: isAllowed,
cookies
};
}
} catch (error) {
return {
redirect: `${url}/error?error=${encodeURIComponent(error.message)}`,
cookies
};
}
const defaultToken = {
name: user.name,
email: user.email,
picture: user.image,
sub: (_user$id3 = user.id) === null || _user$id3 === void 0 ? void 0 : _user$id3.toString()
};
const token = await callbacks.jwt({
token: defaultToken,
user,
account,
isNewUser: false,
trigger: "signIn"
});
const newToken = await jwt.encode({
...jwt,
token
});
const cookieExpires = new Date();
cookieExpires.setTime(cookieExpires.getTime() + sessionMaxAge * 1000);
const sessionCookies = sessionStore.chunk(newToken, {
expires: cookieExpires
});
cookies.push(...sessionCookies);
await ((_events$signIn3 = events.signIn) === null || _events$signIn3 === void 0 ? void 0 : _events$signIn3.call(events, {
user,
account
}));
return {
redirect: callbackUrl,
cookies
};
}
return {
status: 500,
body: `Error: Callback for provider type ${provider.type} not supported`,
cookies
};
}

6
node_modules/next-auth/core/routes/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export { default as callback } from './callback';
export { default as signin } from './signin';
export { default as signout } from './signout';
export { default as session } from './session';
export { default as providers } from './providers';
//# sourceMappingURL=index.d.ts.map

1
node_modules/next-auth/core/routes/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA"}

41
node_modules/next-auth/core/routes/index.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "callback", {
enumerable: true,
get: function () {
return _callback.default;
}
});
Object.defineProperty(exports, "providers", {
enumerable: true,
get: function () {
return _providers.default;
}
});
Object.defineProperty(exports, "session", {
enumerable: true,
get: function () {
return _session.default;
}
});
Object.defineProperty(exports, "signin", {
enumerable: true,
get: function () {
return _signin.default;
}
});
Object.defineProperty(exports, "signout", {
enumerable: true,
get: function () {
return _signout.default;
}
});
var _callback = _interopRequireDefault(require("./callback"));
var _signin = _interopRequireDefault(require("./signin"));
var _signout = _interopRequireDefault(require("./signout"));
var _session = _interopRequireDefault(require("./session"));
var _providers = _interopRequireDefault(require("./providers"));

16
node_modules/next-auth/core/routes/providers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import type { ResponseInternal } from "..";
import type { InternalProvider } from "../types";
export interface PublicProvider {
id: string;
name: string;
type: string;
signinUrl: string;
callbackUrl: string;
}
/**
* Return a JSON object with a list of all OAuth providers currently configured
* and their signin and callback URLs. This makes it possible to automatically
* generate buttons for all providers when rendering client side.
*/
export default function providers(providers: InternalProvider[]): ResponseInternal<Record<string, PublicProvider>>;
//# sourceMappingURL=providers.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/core/routes/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,SAAS,EAAE,gBAAgB,EAAE,GAC5B,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAWlD"}

30
node_modules/next-auth/core/routes/providers.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = providers;
function providers(providers) {
return {
headers: [{
key: "Content-Type",
value: "application/json"
}],
body: providers.reduce((acc, {
id,
name,
type,
signinUrl,
callbackUrl
}) => {
acc[id] = {
id,
name,
type,
signinUrl,
callbackUrl
};
return acc;
}, {})
};
}

17
node_modules/next-auth/core/routes/session.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { InternalOptions } from "../types";
import type { ResponseInternal } from "..";
import type { Session } from "../..";
import type { SessionStore } from "../lib/cookie";
interface SessionParams {
options: InternalOptions;
sessionStore: SessionStore;
isUpdate?: boolean;
newSession?: any;
}
/**
* Return a session object (without any private fields)
* for Single Page App clients
*/
export default function session(params: SessionParams): Promise<ResponseInternal<Session | {}>>;
export {};
//# sourceMappingURL=session.d.ts.map

1
node_modules/next-auth/core/routes/session.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/core/routes/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,UAAU,aAAa;IACrB,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB;AAED;;;GAGG;AAEH,wBAA8B,OAAO,CACnC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,gBAAgB,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC,CAyKzC"}

154
node_modules/next-auth/core/routes/session.js generated vendored Normal file
View File

@@ -0,0 +1,154 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = session;
var _utils = require("../lib/utils");
async function session(params) {
const {
options,
sessionStore,
newSession,
isUpdate
} = params;
const {
adapter,
jwt,
events,
callbacks,
logger,
session: {
strategy: sessionStrategy,
maxAge: sessionMaxAge
}
} = options;
const response = {
body: {},
headers: [{
key: "Content-Type",
value: "application/json"
}, ...(isUpdate ? [] : [{
key: "Cache-Control",
value: "private, no-cache, no-store"
}, {
key: "Pragma",
value: "no-cache"
}, {
key: "Expires",
value: "0"
}])].filter(Boolean),
cookies: []
};
const sessionToken = sessionStore.value;
if (!sessionToken) return response;
if (sessionStrategy === "jwt") {
try {
var _response$cookies, _events$session;
const decodedToken = await jwt.decode({
...jwt,
token: sessionToken
});
if (!decodedToken) throw new Error("JWT invalid");
const token = await callbacks.jwt({
token: decodedToken,
...(isUpdate && {
trigger: "update"
}),
session: newSession
});
const newExpires = (0, _utils.fromDate)(sessionMaxAge);
const updatedSession = await callbacks.session({
session: {
user: {
name: decodedToken === null || decodedToken === void 0 ? void 0 : decodedToken.name,
email: decodedToken === null || decodedToken === void 0 ? void 0 : decodedToken.email,
image: decodedToken === null || decodedToken === void 0 ? void 0 : decodedToken.picture
},
expires: newExpires.toISOString()
},
token
});
response.body = updatedSession;
const newToken = await jwt.encode({
...jwt,
token,
maxAge: options.session.maxAge
});
const sessionCookies = sessionStore.chunk(newToken, {
expires: newExpires
});
(_response$cookies = response.cookies) === null || _response$cookies === void 0 || _response$cookies.push(...sessionCookies);
await ((_events$session = events.session) === null || _events$session === void 0 ? void 0 : _events$session.call(events, {
session: updatedSession,
token
}));
} catch (error) {
var _response$cookies2;
logger.error("JWT_SESSION_ERROR", error);
(_response$cookies2 = response.cookies) === null || _response$cookies2 === void 0 || _response$cookies2.push(...sessionStore.clean());
}
} else {
try {
const {
getSessionAndUser,
deleteSession,
updateSession
} = adapter;
let userAndSession = await getSessionAndUser(sessionToken);
if (userAndSession && userAndSession.session.expires.valueOf() < Date.now()) {
await deleteSession(sessionToken);
userAndSession = null;
}
if (userAndSession) {
var _response$cookies3, _events$session2;
const {
user,
session
} = userAndSession;
const sessionUpdateAge = options.session.updateAge;
const sessionIsDueToBeUpdatedDate = session.expires.valueOf() - sessionMaxAge * 1000 + sessionUpdateAge * 1000;
const newExpires = (0, _utils.fromDate)(sessionMaxAge);
if (sessionIsDueToBeUpdatedDate <= Date.now()) {
await updateSession({
sessionToken,
expires: newExpires
});
}
const sessionPayload = await callbacks.session({
session: {
user: {
name: user.name,
email: user.email,
image: user.image
},
expires: session.expires.toISOString()
},
user,
newSession,
...(isUpdate ? {
trigger: "update"
} : {})
});
response.body = sessionPayload;
(_response$cookies3 = response.cookies) === null || _response$cookies3 === void 0 || _response$cookies3.push({
name: options.cookies.sessionToken.name,
value: sessionToken,
options: {
...options.cookies.sessionToken.options,
expires: newExpires
}
});
await ((_events$session2 = events.session) === null || _events$session2 === void 0 ? void 0 : _events$session2.call(events, {
session: sessionPayload
}));
} else if (sessionToken) {
var _response$cookies4;
(_response$cookies4 = response.cookies) === null || _response$cookies4 === void 0 || _response$cookies4.push(...sessionStore.clean());
}
} catch (error) {
logger.error("SESSION_ERROR", error);
}
}
return response;
}

9
node_modules/next-auth/core/routes/signin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { RequestInternal, ResponseInternal } from "..";
import type { InternalOptions } from "../types";
/** Handle requests to /api/auth/signin */
export default function signin(params: {
options: InternalOptions<"oauth" | "email">;
query: RequestInternal["query"];
body: RequestInternal["body"];
}): Promise<ResponseInternal>;
//# sourceMappingURL=signin.d.ts.map

1
node_modules/next-auth/core/routes/signin.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"signin.d.ts","sourceRoot":"","sources":["../../src/core/routes/signin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,0CAA0C;AAC1C,wBAA8B,MAAM,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC,CAAA;IAC3C,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;CAC9B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiH5B"}

134
node_modules/next-auth/core/routes/signin.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = signin;
var _authorizationUrl = _interopRequireDefault(require("../lib/oauth/authorization-url"));
var _signin = _interopRequireDefault(require("../lib/email/signin"));
var _getUserFromEmail = _interopRequireDefault(require("../lib/email/getUserFromEmail"));
async function signin(params) {
const {
options,
query,
body
} = params;
const {
url,
callbacks,
logger,
provider
} = options;
if (!provider.type) {
return {
status: 500,
text: `Error: Type not specified for ${provider.name}`
};
}
if (provider.type === "oauth") {
try {
const response = await (0, _authorizationUrl.default)({
options,
query
});
return response;
} catch (error) {
logger.error("SIGNIN_OAUTH_ERROR", {
error: error,
providerId: provider.id
});
return {
redirect: `${url}/error?error=OAuthSignin`
};
}
} else if (provider.type === "email") {
var _provider$normalizeId;
let email = body === null || body === void 0 ? void 0 : body.email;
if (!email) return {
redirect: `${url}/error?error=EmailSignin`
};
const normalizer = (_provider$normalizeId = provider.normalizeIdentifier) !== null && _provider$normalizeId !== void 0 ? _provider$normalizeId : identifier => {
var _trimmedEmail$match;
const trimmedEmail = identifier.trim();
const atCount = ((_trimmedEmail$match = trimmedEmail.match(/@/g)) !== null && _trimmedEmail$match !== void 0 ? _trimmedEmail$match : []).length;
if (atCount !== 1) {
throw new Error("Invalid email address format.");
}
if (trimmedEmail.includes('"')) {
throw new Error("Invalid email address format.");
}
let [local, domain] = trimmedEmail.toLowerCase().split("@");
if (!local || !domain) {
throw new Error("Invalid email address format.");
}
domain = domain.split(",")[0];
if (!domain.includes(".")) {
throw new Error("Invalid email address format.");
}
return `${local}@${domain}`;
};
try {
email = normalizer(body === null || body === void 0 ? void 0 : body.email);
} catch (error) {
logger.error("SIGNIN_EMAIL_ERROR", {
error,
providerId: provider.id
});
return {
redirect: `${url}/error?error=EmailSignin`
};
}
const user = await (0, _getUserFromEmail.default)({
email,
adapter: options.adapter
});
const account = {
providerAccountId: email,
userId: email,
type: "email",
provider: provider.id
};
try {
const signInCallbackResponse = await callbacks.signIn({
user,
account,
email: {
verificationRequest: true
}
});
if (!signInCallbackResponse) {
return {
redirect: `${url}/error?error=AccessDenied`
};
} else if (typeof signInCallbackResponse === "string") {
return {
redirect: signInCallbackResponse
};
}
} catch (error) {
return {
redirect: `${url}/error?${new URLSearchParams({
error: error
})}`
};
}
try {
const redirect = await (0, _signin.default)(email, options);
return {
redirect
};
} catch (error) {
logger.error("SIGNIN_EMAIL_ERROR", {
error,
providerId: provider.id
});
return {
redirect: `${url}/error?error=EmailSignin`
};
}
}
return {
redirect: `${url}/signin`
};
}

9
node_modules/next-auth/core/routes/signout.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { InternalOptions } from "../types";
import type { ResponseInternal } from "..";
import type { SessionStore } from "../lib/cookie";
/** Handle requests to /api/auth/signout */
export default function signout(params: {
options: InternalOptions;
sessionStore: SessionStore;
}): Promise<ResponseInternal>;
//# sourceMappingURL=signout.d.ts.map

1
node_modules/next-auth/core/routes/signout.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"signout.d.ts","sourceRoot":"","sources":["../../src/core/routes/signout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,2CAA2C;AAC3C,wBAA8B,OAAO,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;CAC3B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoC5B"}

55
node_modules/next-auth/core/routes/signout.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = signout;
async function signout(params) {
const {
options,
sessionStore
} = params;
const {
adapter,
events,
jwt,
callbackUrl,
logger,
session
} = options;
const sessionToken = sessionStore === null || sessionStore === void 0 ? void 0 : sessionStore.value;
if (!sessionToken) {
return {
redirect: callbackUrl
};
}
if (session.strategy === "jwt") {
try {
var _events$signOut;
const decodedJwt = await jwt.decode({
...jwt,
token: sessionToken
});
await ((_events$signOut = events.signOut) === null || _events$signOut === void 0 ? void 0 : _events$signOut.call(events, {
token: decodedJwt
}));
} catch (error) {
logger.error("SIGNOUT_ERROR", error);
}
} else {
try {
var _events$signOut2;
const session = await adapter.deleteSession(sessionToken);
await ((_events$signOut2 = events.signOut) === null || _events$signOut2 === void 0 ? void 0 : _events$signOut2.call(events, {
session
}));
} catch (error) {
logger.error("SIGNOUT_ERROR", error);
}
}
const sessionCookies = sessionStore.clean();
return {
redirect: callbackUrl,
cookies: sessionCookies
};
}

522
node_modules/next-auth/core/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,522 @@
import type { Adapter, AdapterUser } from "../adapters";
import type { Provider, CredentialInput, ProviderType } from "../providers";
import type { TokenSetParameters } from "openid-client";
import type { JWT, JWTOptions } from "../jwt";
import type { LoggerInstance } from "../utils/logger";
import type { CookieSerializeOptions } from "cookie";
export declare type Awaitable<T> = T | PromiseLike<T>;
export type { LoggerInstance };
/**
* Configure your NextAuth instance
*
* [Documentation](https://next-auth.js.org/configuration/options#options)
*/
export interface AuthOptions {
/**
* An array of authentication providers for signing in
* (e.g. Google, Facebook, Twitter, GitHub, Email, etc) in any order.
* This can be one of the built-in providers or an object with a custom provider.
* * **Default value**: `[]`
* * **Required**: *Yes*
*
* [Documentation](https://next-auth.js.org/configuration/options#providers) | [Providers documentation](https://providers.authjs.dev)
*/
providers: Provider[];
/**
* A random string used to hash tokens, sign cookies and generate cryptographic keys.
* If not specified, it falls back to `jwt.secret` or `NEXTAUTH_SECRET` from environment variables.
* Otherwise, it will use a hash of all configuration options, including Client ID / Secrets for entropy.
*
* NOTE: The last behavior is extremely volatile, and will throw an error in production.
* * **Default value**: `string` (SHA hash of the "options" object)
* * **Required**: No - **but strongly recommended**!
*
* [Documentation](https://next-auth.js.org/configuration/options#secret)
*/
secret?: string;
/**
* Configure your session settings, such as determining whether to use JWT or a database,
* setting the idle session expiration duration, or implementing write operation throttling for database usage.
* * **Default value**: See the documentation page
* * **Required**: No
*
* [Documentation](https://next-auth.js.org/configuration/options#session)
*/
session?: Partial<SessionOptions>;
/**
* JSON Web Tokens are enabled by default if you have not specified an adapter.
* JSON Web Tokens are encrypted (JWE) by default. We recommend you keep this behaviour.
* * **Default value**: See the documentation page
* * **Required**: *No*
*
* [Documentation](https://next-auth.js.org/configuration/options#jwt)
*/
jwt?: Partial<JWTOptions>;
/**
* Specify URLs to be used if you want to create custom sign in, sign out and error pages.
* Pages specified will override the corresponding built-in page.
* * **Default value**: `{}`
* * **Required**: *No*
* @example
*
* ```js
* pages: {
* signIn: '/auth/signin',
* signOut: '/auth/signout',
* error: '/auth/error',
* verifyRequest: '/auth/verify-request',
* newUser: '/auth/new-user'
* }
* ```
*
* [Documentation](https://next-auth.js.org/configuration/options#pages) | [Pages documentation](https://next-auth.js.org/configuration/pages)
*/
pages?: Partial<PagesOptions>;
/**
* Callbacks are asynchronous functions you can use to control what happens when an action is performed.
* Callbacks are *extremely powerful*, especially in scenarios involving JSON Web Tokens
* as they **allow you to implement access controls without a database** and to **integrate with external databases or APIs**.
* * **Default value**: See the Callbacks documentation
* * **Required**: *No*
*
* [Documentation](https://next-auth.js.org/configuration/options#callbacks) | [Callbacks documentation](https://next-auth.js.org/configuration/callbacks)
*/
callbacks?: Partial<CallbacksOptions>;
/**
* Events are asynchronous functions that do not return a response, they are useful for audit logging.
* You can specify a handler for any of these events below - e.g. for debugging or to create an audit log.
* The content of the message object varies depending on the flow
* (e.g. OAuth or Email authentication flow, JWT or database sessions, etc),
* but typically contains a user object and/or contents of the JSON Web Token
* and other information relevant to the event.
* * **Default value**: `{}`
* * **Required**: *No*
*
* [Documentation](https://next-auth.js.org/configuration/options#events) | [Events documentation](https://next-auth.js.org/configuration/events)
*/
events?: Partial<EventCallbacks>;
/**
* You can use the adapter option to pass in your database adapter.
*
* * **Required**: *No*
*
* [Documentation](https://next-auth.js.org/configuration/options#adapter) |
* [Adapters Overview](https://next-auth.js.org/adapters/overview)
*/
adapter?: Adapter;
/**
* Set debug to true to enable debug messages for authentication and database operations.
* * **Default value**: `false`
* * **Required**: *No*
*
* - ⚠ If you added a custom `logger`, this setting is ignored.
*
* [Documentation](https://next-auth.js.org/configuration/options#debug) | [Logger documentation](https://next-auth.js.org/configuration/options#logger)
*/
debug?: boolean;
/**
* Override any of the logger levels (`undefined` levels will use the built-in logger),
* and intercept logs in NextAuth. You can use this option to send NextAuth logs to a third-party logging service.
* * **Default value**: `console`
* * **Required**: *No*
*
* @example
*
* ```js
* // /pages/api/auth/[...nextauth].js
* import log from "logging-service"
* export default NextAuth({
* logger: {
* error(code, ...message) {
* log.error(code, message)
* },
* warn(code, ...message) {
* log.warn(code, message)
* },
* debug(code, ...message) {
* log.debug(code, message)
* }
* }
* })
* ```
*
* - ⚠ When set, the `debug` option is ignored
*
* [Documentation](https://next-auth.js.org/configuration/options#logger) |
* [Debug documentation](https://next-auth.js.org/configuration/options#debug)
*/
logger?: Partial<LoggerInstance>;
/**
* Changes the theme of pages.
* Set to `"light"` if you want to force pages to always be light.
* Set to `"dark"` if you want to force pages to always be dark.
* Set to `"auto"`, (or leave this option out)if you want the pages to follow the preferred system theme.
* * **Default value**: `"auto"`
* * **Required**: *No*
*
* [Documentation](https://next-auth.js.org/configuration/options#theme) | [Pages documentation]("https://next-auth.js.org/configuration/pages")
*/
theme?: Theme;
/**
* When set to `true` then all cookies set by NextAuth.js will only be accessible from HTTPS URLs.
* This option defaults to `false` on URLs that start with `http://` (e.g. http://localhost:3000) for developer convenience.
* You can manually set this option to `false` to disable this security feature and allow cookies
* to be accessible from non-secured URLs (this is not recommended).
* * **Default value**: `true` for HTTPS and `false` for HTTP sites
* * **Required**: No
*
* [Documentation](https://next-auth.js.org/configuration/options#usesecurecookies)
*
* - ⚠ **This is an advanced option.** Advanced options are passed the same way as basic options,
* but **may have complex implications** or side effects.
* You should **try to avoid using advanced options** unless you are very comfortable using them.
*/
useSecureCookies?: boolean;
/**
* You can override the default cookie names and options for any of the cookies used by NextAuth.js.
* You can specify one or more cookies with custom properties,
* but if you specify custom options for a cookie you must provide all the options for that cookie.
* If you use this feature, you will likely want to create conditional behavior
* to support setting different cookies policies in development and production builds,
* as you will be opting out of the built-in dynamic policy.
* * **Default value**: `{}`
* * **Required**: No
*
* - ⚠ **This is an advanced option.** Advanced options are passed the same way as basic options,
* but **may have complex implications** or side effects.
* You should **try to avoid using advanced options** unless you are very comfortable using them.
*
* [Documentation](https://next-auth.js.org/configuration/options#cookies) | [Usage example](https://next-auth.js.org/configuration/options#example)
*/
cookies?: Partial<CookiesOptions>;
}
/**
* Change the theme of the built-in pages.
*
* [Documentation](https://next-auth.js.org/configuration/options#theme) |
* [Pages](https://next-auth.js.org/configuration/pages)
*/
export interface Theme {
colorScheme?: "auto" | "dark" | "light";
logo?: string;
brandColor?: string;
buttonText?: string;
}
/**
* Different tokens returned by OAuth Providers.
* Some of them are available with different casing,
* but they refer to the same value.
*/
export declare type TokenSet = TokenSetParameters;
/**
* Usually contains information about the provider being used
* and also extends `TokenSet`, which is different tokens returned by OAuth Providers.
*/
export interface Account extends Partial<TokenSet> {
/**
* This value depends on the type of the provider being used to create the account.
* - oauth: The OAuth account's id, returned from the `profile()` callback.
* - email: The user's email address.
* - credentials: `id` returned from the `authorize()` callback
*/
providerAccountId: string;
/** id of the user this account belongs to. */
userId?: string;
/** id of the provider used for this account */
provider: string;
/** Provider's type for this account */
type: ProviderType;
}
/** The OAuth profile returned from your provider */
export interface Profile {
sub?: string;
name?: string;
email?: string;
image?: string;
}
/** [Documentation](https://next-auth.js.org/configuration/callbacks) */
export interface CallbacksOptions<P = Profile, A = Account> {
/**
* Use this callback to control if a user is allowed to sign in.
* Returning true will continue the sign-in flow.
* Throwing an error or returning a string will stop the flow, and redirect the user.
*
* [Documentation](https://next-auth.js.org/configuration/callbacks#sign-in-callback)
*/
signIn: (params: {
user: User | AdapterUser;
account: A | null;
/**
* If OAuth provider is used, it contains the full
* OAuth profile returned by your provider.
*/
profile?: P;
/**
* If Email provider is used, on the first call, it contains a
* `verificationRequest: true` property to indicate it is being triggered in the verification request flow.
* When the callback is invoked after a user has clicked on a sign in link,
* this property will not be present. You can check for the `verificationRequest` property
* to avoid sending emails to addresses or domains on a blocklist or to only explicitly generate them
* for email address in an allow list.
*/
email?: {
verificationRequest?: boolean;
};
/** If Credentials provider is used, it contains the user credentials */
credentials?: Record<string, CredentialInput>;
}) => Awaitable<string | boolean>;
/**
* This callback is called anytime the user is redirected to a callback URL (e.g. on signin or signout).
* By default only URLs on the same URL as the site are allowed,
* you can use this callback to customise that behaviour.
*
* [Documentation](https://next-auth.js.org/configuration/callbacks#redirect-callback)
*/
redirect: (params: {
/** URL provided as callback URL by the client */
url: string;
/** Default base URL of site (can be used as fallback) */
baseUrl: string;
}) => Awaitable<string>;
/**
* This callback is called whenever a session is checked.
* (Eg.: invoking the `/api/session` endpoint, using `useSession` or `getSession`)
*
* ⚠ By default, only a subset (email, name, image)
* of the token is returned for increased security.
*
* If you want to make something available you added to the token through the `jwt` callback,
* you have to explicitly forward it here to make it available to the client.
*
* [Documentation](https://next-auth.js.org/configuration/callbacks#session-callback) |
* [`jwt` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) |
* [`useSession`](https://next-auth.js.org/getting-started/client#usesession) |
* [`getSession`](https://next-auth.js.org/getting-started/client#getsession) |
*
*/
session: (params: {
session: Session;
/** Available when {@link SessionOptions.strategy} is set to `"jwt"` */
token: JWT;
/** Available when {@link SessionOptions.strategy} is set to `"database"`. */
user: AdapterUser;
} & {
/**
* Available when using {@link SessionOptions.strategy} `"database"`, this is the data
* sent from the client via the [`useSession().update`](https://next-auth.js.org/getting-started/client#update-session) method.
*
* ⚠ Note, you should validate this data before using it.
*/
newSession: any;
trigger: "update";
}) => Awaitable<Session | DefaultSession>;
/**
* This callback is called whenever a JSON Web Token is created (i.e. at sign in)
* or updated (i.e whenever a session is accessed in the client).
* Its content is forwarded to the `session` callback,
* where you can control what should be returned to the client.
* Anything else will be kept from your front-end.
*
* The JWT is encrypted by default.
*
* [Documentation](https://next-auth.js.org/configuration/callbacks#jwt-callback) |
* [`session` callback](https://next-auth.js.org/configuration/callbacks#session-callback)
*/
jwt: (params: {
/**
* When `trigger` is `"signIn"` or `"signUp"`, it will be a subset of {@link JWT},
* `name`, `email` and `picture` will be included.
*
* Otherwise, it will be the full {@link JWT} for subsequent calls.
*/
token: JWT;
/**
* Either the result of the {@link OAuthConfig.profile} or the {@link CredentialsConfig.authorize} callback.
* @note available when `trigger` is `"signIn"` or `"signUp"`.
*
* Resources:
* - [Credentials Provider](https://next-auth.js.org/providers/credentials)
* - [User database model](https://authjs.dev/reference/adapters#user)
*/
user: User | AdapterUser;
/**
* Contains information about the provider that was used to sign in.
* Also includes {@link TokenSet}
* @note available when `trigger` is `"signIn"` or `"signUp"`
*/
account: A | null;
/**
* The OAuth profile returned from your provider.
* (In case of OIDC it will be the decoded ID Token or /userinfo response)
* @note available when `trigger` is `"signIn"`.
*/
profile?: P;
/**
* Check why was the jwt callback invoked. Possible reasons are:
* - user sign-in: First time the callback is invoked, `user`, `profile` and `account` will be present.
* - user sign-up: a user is created for the first time in the database (when {@link SessionOptions.strategy} is set to `"database"`})
* - update event: Triggered by the [`useSession().update`](https://next-auth.js.org/getting-started/client#update-session) method.
* In case of the latter, `trigger` will be `undefined`.
*/
trigger?: "signIn" | "signUp" | "update";
/** @deprecated use `trigger === "signUp"` instead */
isNewUser?: boolean;
/**
* When using {@link SessionOptions.strategy} `"jwt"`, this is the data
* sent from the client via the [`useSession().update`](https://next-auth.js.org/getting-started/client#update-session) method.
*
* ⚠ Note, you should validate this data before using it.
*/
session?: any;
}) => Awaitable<JWT>;
}
/** [Documentation](https://next-auth.js.org/configuration/options#cookies) */
export interface CookieOption {
name: string;
options: CookieSerializeOptions;
}
/** [Documentation](https://next-auth.js.org/configuration/options#cookies) */
export interface CookiesOptions {
sessionToken: CookieOption;
callbackUrl: CookieOption;
csrfToken: CookieOption;
pkceCodeVerifier: CookieOption;
state: CookieOption;
nonce: CookieOption;
}
/**
* The various event callbacks you can register for from next-auth
*
* [Documentation](https://next-auth.js.org/configuration/events)
*/
export interface EventCallbacks {
/**
* If using a `credentials` type auth, the user is the raw response from your
* credential provider.
* For other providers, you'll get the User object from your adapter, the account,
* and an indicator if the user was new to your Adapter.
*/
signIn: (message: {
user: User;
account: Account | null;
profile?: Profile;
isNewUser?: boolean;
}) => Awaitable<void>;
/**
* The message object will contain one of these depending on
* if you use JWT or database persisted sessions:
* - `token`: The JWT token for this session.
* - `session`: The session object from your adapter that is being ended.
*/
signOut: (message: {
session: Session;
token: JWT;
}) => Awaitable<void>;
createUser: (message: {
user: User;
}) => Awaitable<void>;
updateUser: (message: {
user: User;
}) => Awaitable<void>;
linkAccount: (message: {
user: User | AdapterUser;
account: Account;
profile: User | AdapterUser;
}) => Awaitable<void>;
/**
* The message object will contain one of these depending on
* if you use JWT or database persisted sessions:
* - `token`: The JWT token for this session.
* - `session`: The session object from your adapter.
*/
session: (message: {
session: Session;
token: JWT;
}) => Awaitable<void>;
}
export declare type EventType = keyof EventCallbacks;
/** [Documentation](https://next-auth.js.org/configuration/pages) */
export interface PagesOptions {
signIn: string;
signOut: string;
/** Error code passed in query string as ?error= */
error: string;
verifyRequest: string;
/** If set, new users will be directed here on first sign in */
newUser: string;
}
export declare type ISODateString = string;
export interface DefaultSession {
user?: {
name?: string | null;
email?: string | null;
image?: string | null;
};
expires: ISODateString;
}
/**
* Returned by `useSession`, `getSession`, returned by the `session` callback
* and also the shape received as a prop on the `SessionProvider` React Context
*
* [`useSession`](https://next-auth.js.org/getting-started/client#usesession) |
* [`getSession`](https://next-auth.js.org/getting-started/client#getsession) |
* [`SessionProvider`](https://next-auth.js.org/getting-started/client#sessionprovider) |
* [`session` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback)
*/
export interface Session extends DefaultSession {
}
export declare type SessionStrategy = "jwt" | "database";
/** [Documentation](https://next-auth.js.org/configuration/options#session) */
export interface SessionOptions {
/**
* Choose how you want to save the user session.
* The default is `"jwt"`, an encrypted JWT (JWE) in the session cookie.
*
* If you use an `adapter` however, we default it to `"database"` instead.
* You can still force a JWT session by explicitly defining `"jwt"`.
*
* When using `"database"`, the session cookie will only contain a `sessionToken` value,
* which is used to look up the session in the database.
*
* [Documentation](https://next-auth.js.org/configuration/options#session) | [Adapter](https://next-auth.js.org/configuration/options#adapter) | [About JSON Web Tokens](https://next-auth.js.org/faq#json-web-tokens)
*/
strategy: SessionStrategy;
/**
* Relative time from now in seconds when to expire the session
* @default 2592000 // 30 days
*/
maxAge: number;
/**
* How often the session should be updated in seconds.
* If set to `0`, session is updated every time.
* @default 86400 // 1 day
*/
updateAge: number;
/**
* Generate a custom session token for database-based sessions.
* By default, a random UUID or string is generated depending on the Node.js version.
* However, you can specify your own custom string (such as CUID) to be used.
* @default `randomUUID` or `randomBytes.toHex` depending on the Node.js version
*/
generateSessionToken: () => Awaitable<string>;
}
export interface DefaultUser {
id: string;
name?: string | null;
email?: string | null;
image?: string | null;
}
/**
* The shape of the returned object in the OAuth providers' `profile` callback,
* available in the `jwt` and `session` callbacks,
* or the second parameter of the `session` callback, when using a database.
*
* [`signIn` callback](https://next-auth.js.org/configuration/callbacks#sign-in-callback) |
* [`session` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) |
* [`jwt` callback](https://next-auth.js.org/configuration/callbacks#jwt-callback) |
* [`profile` OAuth provider callback](https://next-auth.js.org/configuration/providers/oauth#using-a-custom-provider)
*/
export interface User extends DefaultUser {
}
export declare type AuthAction = "providers" | "session" | "csrf" | "signin" | "signout" | "callback" | "verify-request" | "error" | "_log";
//# sourceMappingURL=types.d.ts.map

1
node_modules/next-auth/core/types.d.ts.map generated vendored Normal file

File diff suppressed because one or more lines are too long

5
node_modules/next-auth/core/types.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});