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

16
node_modules/next-auth/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,16 @@
ISC License
Copyright (c) 2018-2021, Iain Collins
Copyright (c) 2021-2025, Better Auth Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

188
node_modules/next-auth/README.md generated vendored Normal file
View File

@@ -0,0 +1,188 @@
<p align="center">
<br/>
<a href="https://next-auth.js.org" target="_blank"><img width="150px" src="https://next-auth.js.org/img/logo/logo-sm.png" /></a>
<h3 align="center">NextAuth.js</h3>
<p align="center">Authentication for Next.js</p>
<p align="center">
Open Source. Full Stack. Own Your Data.
</p>
<p align="center" style="align: center;">
<a href="https://github.com/nextauthjs/next-auth/actions/workflows/release.yml?query=workflow%3ARelease">
<img src="https://github.com/nextauthjs/next-auth/actions/workflows/release.yml/badge.svg" alt="Release" />
</a>
<a href="https://packagephobia.com/result?p=next-auth">
<img src="https://packagephobia.com/badge?p=next-auth" alt="Bundle Size"/>
</a>
<a href="https://www.npmtrends.com/next-auth">
<img src="https://img.shields.io/npm/dm/next-auth" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth" alt="Github Stars" />
</a>
<a href="https://www.npmjs.com/package/next-auth">
<img src="https://img.shields.io/github/v/release/nextauthjs/next-auth?label=latest" alt="Github Stable Release" />
</a>
</p>
</p>
## Overview
NextAuth.js is a complete open source authentication solution for [Next.js](http://nextjs.org/) applications.
It is designed from the ground up to support Next.js and Serverless.
This is a monorepo containing the following packages / projects:
1. The primary `next-auth` package
2. A development test application
3. All `@next-auth/*-adapter` packages
4. The documentation site
## Getting Started
```
npm install next-auth
```
The easiest way to continue getting started, is to follow the [getting started](https://next-auth.js.org/getting-started/example) section in our docs.
We also have a section of [tutorials](https://next-auth.js.org/tutorials) for those looking for more specific examples.
See [next-auth.js.org](https://next-auth.js.org) for more information and documentation.
## Features
### Flexible and easy to use
- Designed to work with any OAuth service, it supports OAuth 1.0, 1.0A and 2.0
- Built-in support for [many popular sign-in services](https://next-auth.js.org/providers)
- Supports email / passwordless authentication
- Supports stateless authentication with any backend (Active Directory, LDAP, etc)
- Supports both JSON Web Tokens and database sessions
- Designed for Serverless but runs anywhere (AWS Lambda, Docker, Heroku, etc…)
### Own your own data
NextAuth.js can be used with or without a database.
- An open source solution that allows you to keep control of your data
- Supports Bring Your Own Database (BYOD) and can be used with any database
- Built-in support for [MySQL, MariaDB, Postgres, Microsoft SQL Server, MongoDB and SQLite](https://next-auth.js.org/configuration/databases)
- Works great with databases from popular hosting providers
- Can also be used _without a database_ (e.g. OAuth + JWT)
### Secure by default
- Promotes the use of passwordless sign-in mechanisms
- Designed to be secure by default and encourage best practices for safeguarding user data
- Uses Cross-Site Request Forgery (CSRF) Tokens on POST routes (sign in, sign out)
- Default cookie policy aims for the most restrictive policy appropriate for each cookie
- When JSON Web Tokens are enabled, they are encrypted by default (JWE) with A256GCM
- Auto-generates symmetric signing and encryption keys for developer convenience
- Features tab/window syncing and session polling to support short lived sessions
- Attempts to implement the latest guidance published by [Open Web Application Security Project](https://owasp.org)
Advanced options allow you to define your own routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who is able to sign in and how often sessions have to be re-validated.
### TypeScript
NextAuth.js comes with built-in types. For more information and usage, check out
the [TypeScript section](https://next-auth.js.org/getting-started/typescript) in the documentation.
## Example
### Add API Route
```javascript
// pages/api/auth/[...nextauth].js
import NextAuth from "next-auth"
import AppleProvider from "next-auth/providers/apple"
import GoogleProvider from "next-auth/providers/google"
import EmailProvider from "next-auth/providers/email"
export default NextAuth({
secret: process.env.SECRET,
providers: [
// OAuth authentication providers
AppleProvider({
clientId: process.env.APPLE_ID,
clientSecret: process.env.APPLE_SECRET,
}),
GoogleProvider({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
// Sign in with passwordless email link
EmailProvider({
server: process.env.MAIL_SERVER,
from: "<no-reply@example.com>",
}),
],
})
```
### Add React Hook
The `useSession()` React Hook in the NextAuth.js client is the easiest way to check if someone is signed in.
```javascript
import { useSession, signIn, signOut } from "next-auth/react"
export default function Component() {
const { data: session } = useSession()
if (session) {
return (
<>
Signed in as {session.user.email} <br />
<button onClick={() => signOut()}>Sign out</button>
</>
)
}
return (
<>
Not signed in <br />
<button onClick={() => signIn()}>Sign in</button>
</>
)
}
```
### Share/configure session state
Use the `<SessionProvider>` to allow instances of `useSession()` to share the session object across components. It also takes care of keeping the session updated and synced between tabs/windows.
```jsx title="pages/_app.js"
import { SessionProvider } from "next-auth/react"
export default function App({
Component,
pageProps: { session, ...pageProps },
}) {
return (
<SessionProvider session={session}>
<Component {...pageProps} />
</SessionProvider>
)
}
```
## Security
If you think you have found a vulnerability (or not sure) in NextAuth.js or any of the related packages (i.e. Adapters), we ask you to have a read of our [Security Policy](https://github.com/nextauthjs/next-auth/security/policy) to reach out responsibly. Please do not open Pull Requests/Issues/Discussions before consulting with us.
## Acknowledgments
[NextAuth.js is made possible thanks to all of its contributors.](https://next-auth.js.org/contributors)
<a href="https://github.com/nextauthjs/next-auth/graphs/contributors">
<img width="500px" src="https://contrib.rocks/image?repo=nextauthjs/next-auth" />
</a>
## Contributing
We're open to all community contributions! If you'd like to contribute in any way, please first read
our [Contributing Guide](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md).
## License
ISC

97
node_modules/next-auth/adapters.d.ts generated vendored Normal file
View File

@@ -0,0 +1,97 @@
import { Account, User, Awaitable } from ".";
import type { Adapter as FutureAdapter } from "@auth/core/adapters";
export interface AdapterUser extends User {
id: string;
email: string;
emailVerified: Date | null;
}
export interface AdapterAccount extends Account {
userId: string;
}
export interface AdapterSession {
/** A randomly generated value that is used to get hold of the session. */
sessionToken: string;
/** Used to connect the session to a particular user */
userId: string;
expires: Date;
}
export interface VerificationToken {
identifier: string;
expires: Date;
token: string;
}
/**
* Using a custom adapter you can connect to any database backend or even several different databases.
* Custom adapters created and maintained by our community can be found in the adapters repository.
* Feel free to add a custom adapter from your project to the repository,
* or even become a maintainer of a certain adapter.
* Custom adapters can still be created and used in a project without being added to the repository.
*
* **Required methods**
*
* _(These methods are required for all sign in flows)_
* - `createUser`
* - `getUser`
* - `getUserByEmail`
* - `getUserByAccount`
* - `linkAccount`
* - `createSession`
* - `getSessionAndUser`
* - `updateSession`
* - `deleteSession`
* - `updateUser`
*
* _(Required to support email / passwordless sign in)_
*
* - `createVerificationToken`
* - `useVerificationToken`
*
* **Unimplemented methods**
*
* _(These methods will be required in a future release, but are not yet invoked)_
* - `deleteUser`
* - `unlinkAccount`
*
* [Adapters Overview](https://next-auth.js.org/adapters/overview) |
* [Create a custom adapter](https://next-auth.js.org/tutorials/creating-a-database-adapter)
*/
export interface Adapter {
createUser?: FutureAdapter["createUser"] | ((user: Omit<AdapterUser, "id">) => Awaitable<AdapterUser>);
getUser?: (id: string) => Awaitable<AdapterUser | null>;
getUserByEmail?: (email: string) => Awaitable<AdapterUser | null>;
/** Using the provider id and the id of the user for a specific account, get the user. */
getUserByAccount?: (providerAccountId: Pick<AdapterAccount, "provider" | "providerAccountId">) => Awaitable<AdapterUser | null>;
updateUser?: (user: Partial<AdapterUser> & Pick<AdapterUser, "id">) => Awaitable<AdapterUser>;
/** @todo Implement */
deleteUser?: (userId: string) => Promise<void> | Awaitable<AdapterUser | null | undefined>;
linkAccount?: FutureAdapter["linkAccount"] | ((account: AdapterAccount) => Promise<void> | Awaitable<AdapterAccount | null | undefined>);
/** @todo Implement */
unlinkAccount?: FutureAdapter["unlinkAccount"] | ((providerAccountId: Pick<AdapterAccount, "provider" | "providerAccountId">) => Promise<void> | Awaitable<AdapterAccount | undefined>);
/** Creates a session for the user and returns it. */
createSession?: (session: {
sessionToken: string;
userId: string;
expires: Date;
}) => Awaitable<AdapterSession>;
getSessionAndUser?: (sessionToken: string) => Awaitable<{
session: AdapterSession;
user: AdapterUser;
} | null>;
updateSession?: (session: Partial<AdapterSession> & Pick<AdapterSession, "sessionToken">) => Awaitable<AdapterSession | null | undefined>;
/**
* Deletes a session from the database.
* It is preferred that this method also returns the session
* that is being deleted for logging purposes.
*/
deleteSession?: (sessionToken: string) => Promise<void> | Awaitable<AdapterSession | null | undefined>;
createVerificationToken?: (verificationToken: VerificationToken) => Awaitable<VerificationToken | null | undefined>;
/**
* Return verification token from the database
* and delete it so it cannot be used again.
*/
useVerificationToken?: (params: {
identifier: string;
token: string;
}) => Awaitable<VerificationToken | null>;
}
//# sourceMappingURL=adapters.d.ts.map

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

@@ -0,0 +1 @@
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["src/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnE,MAAM,WAAW,WAAY,SAAQ,IAAI;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,IAAI,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,IAAI,CAAA;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,IAAI,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EACP,aAAa,CAAC,YAAY,CAAC,GAC3B,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,SAAS,CAAC,WAAW,CAAC,CAAC,CAAA;IAC/D,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACvD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACjE,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,CACjB,iBAAiB,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,mBAAmB,CAAC,KACtE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAClC,UAAU,CAAC,EAAE,CACX,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,KACjD,SAAS,CAAC,WAAW,CAAC,CAAA;IAC3B,sBAAsB;IACtB,UAAU,CAAC,EAAE,CACX,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IAC9D,WAAW,CAAC,EACR,aAAa,CAAC,aAAa,CAAC,GAC5B,CAAC,CACC,OAAO,EAAE,cAAc,KACpB,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAA;IACtE,sBAAsB;IACtB,aAAa,CAAC,EACV,aAAa,CAAC,eAAe,CAAC,GAC9B,CAAC,CACC,iBAAiB,EAAE,IAAI,CACrB,cAAc,EACd,UAAU,GAAG,mBAAmB,CACjC,KACE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC,CAAA;IAC/D,qDAAqD;IACrD,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;QACxB,YAAY,EAAE,MAAM,CAAA;QACpB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,IAAI,CAAA;KACd,KAAK,SAAS,CAAC,cAAc,CAAC,CAAA;IAC/B,iBAAiB,CAAC,EAAE,CAClB,YAAY,EAAE,MAAM,KACjB,SAAS,CAAC;QAAE,OAAO,EAAE,cAAc,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IACrE,aAAa,CAAC,EAAE,CACd,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,KACpE,SAAS,CAAC,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IACjD;;;;OAIG;IACH,aAAa,CAAC,EAAE,CACd,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IACjE,uBAAuB,CAAC,EAAE,CACxB,iBAAiB,EAAE,iBAAiB,KACjC,SAAS,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;IACpD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE;QAC9B,UAAU,EAAE,MAAM,CAAA;QAClB,KAAK,EAAE,MAAM,CAAA;KACd,KAAK,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;CAC1C"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=client-provider.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"client-provider.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/client-provider.test.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=csrf.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"csrf.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/csrf.test.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,78 @@
export namespace mockSession {
const ok: boolean;
namespace user {
const image: null;
const name: string;
const email: string;
}
const expires: number;
}
export namespace mockProviders {
const ok_1: boolean;
export { ok_1 as ok };
export namespace github {
export const id: string;
const name_1: string;
export { name_1 as name };
export const type: string;
export const signinUrl: string;
export const callbackUrl: string;
}
export namespace credentials {
const id_1: string;
export { id_1 as id };
const name_2: string;
export { name_2 as name };
const type_1: string;
export { type_1 as type };
export const authorize: null;
const credentials_1: null;
export { credentials_1 as credentials };
}
export namespace email_1 {
const id_2: string;
export { id_2 as id };
const type_2: string;
export { type_2 as type };
const name_3: string;
export { name_3 as name };
}
export { email_1 as email };
}
export namespace mockCSRFToken {
const ok_2: boolean;
export { ok_2 as ok };
export const csrfToken: string;
}
export namespace mockGithubResponse {
const ok_3: boolean;
export { ok_3 as ok };
export const status: number;
export const url: string;
}
export namespace mockCredentialsResponse {
const ok_4: boolean;
export { ok_4 as ok };
const status_1: number;
export { status_1 as status };
const url_1: string;
export { url_1 as url };
}
export namespace mockEmailResponse {
const ok_5: boolean;
export { ok_5 as ok };
const status_2: number;
export { status_2 as status };
const url_2: string;
export { url_2 as url };
}
export namespace mockSignOutResponse {
const ok_6: boolean;
export { ok_6 as ok };
const status_3: number;
export { status_3 as status };
const url_3: string;
export { url_3 as url };
}
export const server: import("msw/lib/glossary-58eca5a8").z;
//# sourceMappingURL=mocks.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../../src/client/__tests__/helpers/mocks.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,2DAuBC"}

View File

@@ -0,0 +1,3 @@
export function getBroadcastEvents(): any;
export function printFetchCalls(mockCalls: any): any;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/client/__tests__/helpers/utils.js"],"names":[],"mappings":"AAAA,0CAOC;AAED,qDAIC"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=providers.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"providers.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/providers.test.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=session.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"session.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/session.test.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=sign-in.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sign-in.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/sign-in.test.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=sign-out.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sign-out.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/sign-out.test.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=use-session-hook.test.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"use-session-hook.test.d.ts","sourceRoot":"","sources":["../../src/client/__tests__/use-session-hook.test.js"],"names":[],"mappings":""}

60
node_modules/next-auth/client/_utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
/// <reference types="node" />
import type { IncomingMessage } from "http";
import type { LoggerInstance, Session } from "..";
export interface AuthClientConfig {
baseUrl: string;
basePath: string;
baseUrlServer: string;
basePathServer: string;
/** Stores last session response */
_session?: Session | null | undefined;
/** Used for timestamp since last sycned (in seconds) */
_lastSync: number;
/**
* Stores the `SessionProvider`'s session update method to be able to
* trigger session updates from places like `signIn` or `signOut`
*/
_getSession: (...args: any[]) => any;
}
export interface CtxOrReq {
req?: Partial<IncomingMessage> & {
body?: any;
};
ctx?: {
req: Partial<IncomingMessage> & {
body?: any;
};
};
}
/**
* If passed 'appContext' via getInitialProps() in _app.js
* then get the req object from ctx and use that for the
* req value to allow `fetchData` to
* work seemlessly in getInitialProps() on server side
* pages *and* in _app.js.
*/
export declare function fetchData<T = any>(path: string, __NEXTAUTH: AuthClientConfig, logger: LoggerInstance, { ctx, req }?: CtxOrReq): Promise<T | null>;
export declare function apiBaseUrl(__NEXTAUTH: AuthClientConfig): string;
/** Returns the number of seconds elapsed since January 1, 1970 00:00:00 UTC. */
export declare function now(): number;
export interface BroadcastMessage {
event?: "session";
data?: {
trigger?: "signout" | "getSession";
};
clientId: string;
timestamp: number;
}
/**
* Inspired by [Broadcast Channel API](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API)
* Only not using it directly, because Safari does not support it.
*
* https://caniuse.com/?search=broadcastchannel
*/
export declare function BroadcastChannel(name?: string): {
/** Get notified by other tabs/windows. */
receive(onReceive: (message: BroadcastMessage) => void): () => void;
/** Notify other tabs/windows. */
post(message: Record<string, unknown>): void;
};
//# sourceMappingURL=_utils.d.ts.map

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

@@ -0,0 +1 @@
{"version":3,"file":"_utils.d.ts","sourceRoot":"","sources":["../src/client/_utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;IACrC,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACrC;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAA;KAAE,CAAA;IAC/C,GAAG,CAAC,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG;YAAE,IAAI,CAAC,EAAE,GAAG,CAAA;SAAE,CAAA;KAAE,CAAA;CACzD;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,CAAC,GAAG,GAAG,EACrC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,gBAAgB,EAC5B,MAAM,EAAE,cAAc,EACtB,EAAE,GAAG,EAAE,GAAc,EAAE,GAAE,QAAa,GACrC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAuBnB;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,gBAAgB,UAOtD;AAED,gFAAgF;AAChF,wBAAgB,GAAG,WAElB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;KAAE,CAAA;IAC7C,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAqB;IAEtD,0CAA0C;iCACb,gBAAgB,KAAK,IAAI;IAWtD,iCAAiC;kBACnB,OAAO,MAAM,EAAE,OAAO,CAAC;EAgBxC"}

113
node_modules/next-auth/client/_utils.js generated vendored Normal file
View File

@@ -0,0 +1,113 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BroadcastChannel = BroadcastChannel;
exports.apiBaseUrl = apiBaseUrl;
exports.fetchData = fetchData;
exports.now = now;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function fetchData(_x, _x2, _x3) {
return _fetchData.apply(this, arguments);
}
function _fetchData() {
_fetchData = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(path, __NEXTAUTH, logger) {
var _ref,
ctx,
_ref$req,
req,
url,
_req$headers,
options,
res,
data,
_args = arguments;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_ref = _args.length > 3 && _args[3] !== undefined ? _args[3] : {}, ctx = _ref.ctx, _ref$req = _ref.req, req = _ref$req === void 0 ? ctx === null || ctx === void 0 ? void 0 : ctx.req : _ref$req;
url = "".concat(apiBaseUrl(__NEXTAUTH), "/").concat(path);
_context.prev = 2;
options = {
headers: _objectSpread({
"Content-Type": "application/json"
}, req !== null && req !== void 0 && (_req$headers = req.headers) !== null && _req$headers !== void 0 && _req$headers.cookie ? {
cookie: req.headers.cookie
} : {})
};
if (req !== null && req !== void 0 && req.body) {
options.body = JSON.stringify(req.body);
options.method = "POST";
}
_context.next = 7;
return fetch(url, options);
case 7:
res = _context.sent;
_context.next = 10;
return res.json();
case 10:
data = _context.sent;
if (res.ok) {
_context.next = 13;
break;
}
throw data;
case 13:
return _context.abrupt("return", Object.keys(data).length > 0 ? data : null);
case 16:
_context.prev = 16;
_context.t0 = _context["catch"](2);
logger.error("CLIENT_FETCH_ERROR", {
error: _context.t0,
url: url
});
return _context.abrupt("return", null);
case 20:
case "end":
return _context.stop();
}
}, _callee, null, [[2, 16]]);
}));
return _fetchData.apply(this, arguments);
}
function apiBaseUrl(__NEXTAUTH) {
if (typeof window === "undefined") {
return "".concat(__NEXTAUTH.baseUrlServer).concat(__NEXTAUTH.basePathServer);
}
return __NEXTAUTH.basePath;
}
function now() {
return Math.floor(Date.now() / 1000);
}
function BroadcastChannel() {
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "nextauth.message";
return {
receive: function receive(onReceive) {
var handler = function handler(event) {
var _event$newValue;
if (event.key !== name) return;
var message = JSON.parse((_event$newValue = event.newValue) !== null && _event$newValue !== void 0 ? _event$newValue : "{}");
if ((message === null || message === void 0 ? void 0 : message.event) !== "session" || !(message !== null && message !== void 0 && message.data)) return;
onReceive(message);
};
window.addEventListener("storage", handler);
return function () {
return window.removeEventListener("storage", handler);
};
},
post: function post(message) {
if (typeof window === "undefined") return;
try {
localStorage.setItem(name, JSON.stringify(_objectSpread(_objectSpread({}, message), {}, {
timestamp: now()
})));
} catch (_unused) {}
}
};
}

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"));

Some files were not shown because too many files have changed in this diff Show More