You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@auth/core

Package Overview
Dependencies
7
Maintainers
2
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.26.3 to 0.27.0

lib/utils/email.d.ts

1

lib/utils/env.js

@@ -28,2 +28,3 @@ /** Set default env variables on the config object */

envObject.VERCEL ??
envObject.CF_PAGES ??
envObject.NODE_ENV !== "production"));

@@ -30,0 +31,0 @@ config.providers = config.providers.map((p) => {

7

lib/utils/providers.js

@@ -57,4 +57,6 @@ import { merge } from "./merge.js";

* Returns basic user profile from the userinfo response/`id_token` claims.
* An `id` is generated internally (using `crypto.randomUUID()`) and will override `id` if provided.
* The result if this function is user to create the `User` in the database.
* The returned `id` will become the `account.providerAccountId`. `user.id`
* and `account.id` are auto-generated UUID's.
*
* The result if this function is used to create the `User` in the database.
* @see https://authjs.dev/reference/core/adapters#user

@@ -66,2 +68,3 @@ * @see https://openid.net/specs/openid-connect-core-1_0.html#IDToken

return stripUndefined({
id: profile.sub ?? profile.id ?? crypto.randomUUID(),
name: profile.name ?? profile.nickname ?? profile.preferred_username,

@@ -68,0 +71,0 @@ email: profile.email,

{
"name": "@auth/core",
"version": "0.26.3",
"version": "0.27.0",
"description": "Authentication for the Web.",

@@ -74,3 +74,3 @@ "keywords": [

"@simplewebauthn/browser": "^9.0.1",
"@simplewebauthn/server": "^9.0.1",
"@simplewebauthn/server": "^9.0.2",
"nodemailer": "^6.8.0"

@@ -77,0 +77,0 @@ },

@@ -39,20 +39,2 @@ import type { CommonProviderOptions } from "./index.js";

export type EmailUserConfig = Omit<Partial<EmailConfig>, "options" | "type">;
/**
* Email HTML body
* Insert invisible space into domains from being turned into a hyperlink by email
* clients like Outlook and Apple mail, as this is confusing because it seems
* like they are supposed to click on it to sign in.
*
* @note We don't add the email address to avoid needing to escape it, if you do, remember to sanitize it!
*/
export declare function html(params: {
url: string;
host: string;
theme: Theme;
}): string;
/** Email Text body (fallback for email clients that don't render HTML, e.g. feature phones) */
export declare function text({ url, host }: {
url: string;
host: string;
}): string;
//# sourceMappingURL=email.d.ts.map

@@ -19,60 +19,1 @@ // TODO: Kepts for backwards compatibility

}
/**
* Email HTML body
* Insert invisible space into domains from being turned into a hyperlink by email
* clients like Outlook and Apple mail, as this is confusing because it seems
* like they are supposed to click on it to sign in.
*
* @note We don't add the email address to avoid needing to escape it, if you do, remember to sanitize it!
*/
export function html(params) {
const { url, host, theme } = params;
const escapedHost = host.replace(/\./g, "&#8203;.");
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const brandColor = theme.brandColor || "#346df1";
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const buttonText = theme.buttonText || "#fff";
const color = {
background: "#f9f9f9",
text: "#444",
mainBackground: "#fff",
buttonBackground: brandColor,
buttonBorder: brandColor,
buttonText,
};
return `
<body style="background: ${color.background};">
<table width="100%" border="0" cellspacing="20" cellpadding="0"
style="background: ${color.mainBackground}; max-width: 600px; margin: auto; border-radius: 10px;">
<tr>
<td align="center"
style="padding: 10px 0px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: ${color.text};">
Sign in to <strong>${escapedHost}</strong>
</td>
</tr>
<tr>
<td align="center" style="padding: 20px 0;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 5px;" bgcolor="${color.buttonBackground}"><a href="${url}"
target="_blank"
style="font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: ${color.buttonText}; text-decoration: none; border-radius: 5px; padding: 10px 20px; border: 1px solid ${color.buttonBorder}; display: inline-block; font-weight: bold;">Sign
in</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center"
style="padding: 0px 0px 10px 0px; font-size: 16px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; color: ${color.text};">
If you did not request this email you can safely ignore it.
</td>
</tr>
</table>
</body>
`;
}
/** Email Text body (fallback for email clients that don't render HTML, e.g. feature phones) */
export function text({ url, host }) {
return `Sign in to ${host}\n${url}\n\n`;
}

@@ -1,2 +0,1 @@

import { EmailConfig } from "./email.js";
import type { Transport, TransportOptions } from "nodemailer";

@@ -10,2 +9,3 @@ import * as JSONTransport from "nodemailer/lib/json-transport/index.js";

import type { Awaitable, Theme } from "../types.js";
import type { EmailConfig } from "./email.js";
type AllTransportOptions = string | SMTPTransport | SMTPTransport.Options | SMTPPool | SMTPPool.Options | SendmailTransport | SendmailTransport.Options | StreamTransport | StreamTransport.Options | JSONTransport | JSONTransport.Options | SESTransport | SESTransport.Options | Transport<any> | TransportOptions;

@@ -12,0 +12,0 @@ export interface NodemailerConfig extends EmailConfig {

import { createTransport } from "nodemailer";
import { html, text } from "./email.js";
import { html, text } from "../lib/utils/email.js";
import { AuthError } from "../errors.js";

@@ -4,0 +4,0 @@ export default function Nodemailer(config) {

@@ -1,2 +0,2 @@

export type OAuthProviderType = "42-school" | "apple" | "asgardeo" | "atlassian" | "auth0" | "authentik" | "azure-ad-b2c" | "azure-ad" | "azure-devops" | "battlenet" | "beyondidentity" | "box" | "boxyhq-saml" | "bungie" | "click-up" | "cognito" | "coinbase" | "descope" | "discord" | "dribbble" | "dropbox" | "duende-identity-server6" | "eveonline" | "facebook" | "faceit" | "foursquare" | "freshbooks" | "fusionauth" | "github" | "gitlab" | "google" | "hubspot" | "identity-server4" | "instagram" | "kakao" | "keycloak" | "line" | "linkedin" | "mailchimp" | "mailru" | "mastodon" | "mattermost" | "medium" | "naver" | "netlify" | "nodemailer" | "notion" | "okta" | "onelogin" | "ory-hydra" | "osso" | "osu" | "passage" | "passkey" | "patreon" | "pinterest" | "pipedrive" | "reddit" | "resend" | "salesforce" | "sendgrid" | "slack" | "spotify" | "strava" | "tiktok" | "todoist" | "trakt" | "twitch" | "twitter" | "united-effects" | "vk" | "webauthn" | "wikimedia" | "wordpress" | "workos" | "yandex" | "zitadel" | "zoho" | "zoom";
export type OAuthProviderType = "42-school" | "apple" | "asgardeo" | "atlassian" | "auth0" | "authentik" | "azure-ad-b2c" | "azure-ad" | "azure-devops" | "battlenet" | "beyondidentity" | "box" | "boxyhq-saml" | "bungie" | "click-up" | "cognito" | "coinbase" | "descope" | "discord" | "dribbble" | "dropbox" | "duende-identity-server6" | "eveonline" | "facebook" | "faceit" | "foursquare" | "freshbooks" | "fusionauth" | "github" | "gitlab" | "google" | "hubspot" | "identity-server4" | "instagram" | "kakao" | "keycloak" | "line" | "linkedin" | "mailchimp" | "mailru" | "mastodon" | "mattermost" | "medium" | "naver" | "netlify" | "nodemailer" | "notion" | "okta" | "onelogin" | "ory-hydra" | "osso" | "osu" | "passage" | "passkey" | "patreon" | "pinterest" | "pipedrive" | "reddit" | "resend" | "salesforce" | "sendgrid" | "slack" | "spotify" | "strava" | "tiktok" | "todoist" | "trakt" | "twitch" | "twitter" | "united-effects" | "vk" | "webauthn" | "webex" | "wikimedia" | "wordpress" | "workos" | "yandex" | "zitadel" | "zoho" | "zoom";
//# sourceMappingURL=oauth-types.d.ts.map

@@ -1,4 +0,4 @@

import { type EmailConfig, type EmailUserConfig } from "./index.js";
import type { EmailConfig, EmailUserConfig } from "./index.js";
/** @todo Document this */
export default function Resend(config: EmailUserConfig): EmailConfig;
//# sourceMappingURL=resend.d.ts.map

@@ -1,2 +0,2 @@

import { text, html } from "./index.js";
import { html, text } from "../lib/utils/email.js";
/** @todo Document this */

@@ -3,0 +3,0 @@ export default function Resend(config) {

@@ -1,4 +0,4 @@

import { type EmailConfig, type EmailUserConfig } from "./index.js";
import type { EmailConfig, EmailUserConfig } from "./index.js";
/** @todo Document this */
export default function SendGrid(config: EmailUserConfig): EmailConfig;
//# sourceMappingURL=sendgrid.d.ts.map

@@ -1,2 +0,2 @@

import { text, html } from "./index.js";
import { html, text } from "../lib/utils/email.js";
/** @todo Document this */

@@ -3,0 +3,0 @@ export default function SendGrid(config) {

@@ -28,2 +28,3 @@ import type { AuthAction, AuthConfig } from "../../types.js"

envObject.VERCEL ??
envObject.CF_PAGES ??
envObject.NODE_ENV !== "production"

@@ -30,0 +31,0 @@ )

@@ -89,4 +89,6 @@ import { merge } from "./merge.js"

* Returns basic user profile from the userinfo response/`id_token` claims.
* An `id` is generated internally (using `crypto.randomUUID()`) and will override `id` if provided.
* The result if this function is user to create the `User` in the database.
* The returned `id` will become the `account.providerAccountId`. `user.id`
* and `account.id` are auto-generated UUID's.
*
* The result if this function is used to create the `User` in the database.
* @see https://authjs.dev/reference/core/adapters#user

@@ -98,2 +100,3 @@ * @see https://openid.net/specs/openid-connect-core-1_0.html#IDToken

return stripUndefined({
id: profile.sub ?? profile.id ?? crypto.randomUUID(),
name: profile.name ?? profile.nickname ?? profile.preferred_username,

@@ -100,0 +103,0 @@ email: profile.email,

@@ -56,66 +56,1 @@ import type { CommonProviderOptions } from "./index.js"

export type EmailUserConfig = Omit<Partial<EmailConfig>, "options" | "type">
/**
* Email HTML body
* Insert invisible space into domains from being turned into a hyperlink by email
* clients like Outlook and Apple mail, as this is confusing because it seems
* like they are supposed to click on it to sign in.
*
* @note We don't add the email address to avoid needing to escape it, if you do, remember to sanitize it!
*/
export function html(params: { url: string; host: string; theme: Theme }) {
const { url, host, theme } = params
const escapedHost = host.replace(/\./g, "&#8203;.")
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const brandColor = theme.brandColor || "#346df1"
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const buttonText = theme.buttonText || "#fff"
const color = {
background: "#f9f9f9",
text: "#444",
mainBackground: "#fff",
buttonBackground: brandColor,
buttonBorder: brandColor,
buttonText,
}
return `
<body style="background: ${color.background};">
<table width="100%" border="0" cellspacing="20" cellpadding="0"
style="background: ${color.mainBackground}; max-width: 600px; margin: auto; border-radius: 10px;">
<tr>
<td align="center"
style="padding: 10px 0px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: ${color.text};">
Sign in to <strong>${escapedHost}</strong>
</td>
</tr>
<tr>
<td align="center" style="padding: 20px 0;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 5px;" bgcolor="${color.buttonBackground}"><a href="${url}"
target="_blank"
style="font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: ${color.buttonText}; text-decoration: none; border-radius: 5px; padding: 10px 20px; border: 1px solid ${color.buttonBorder}; display: inline-block; font-weight: bold;">Sign
in</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center"
style="padding: 0px 0px 10px 0px; font-size: 16px; line-height: 22px; font-family: Helvetica, Arial, sans-serif; color: ${color.text};">
If you did not request this email you can safely ignore it.
</td>
</tr>
</table>
</body>
`
}
/** Email Text body (fallback for email clients that don't render HTML, e.g. feature phones) */
export function text({ url, host }: { url: string; host: string }) {
return `Sign in to ${host}\n${url}\n\n`
}
import { createTransport } from "nodemailer"
import { EmailConfig, html, text } from "./email.js"
import { html, text } from "../lib/utils/email.js"
import { AuthError } from "../errors.js"

@@ -13,2 +13,3 @@

import type { Awaitable, Theme } from "../types.js"
import type { EmailConfig } from "./email.js"

@@ -15,0 +16,0 @@ type AllTransportOptions =

@@ -76,2 +76,3 @@

| "webauthn"
| "webex"
| "wikimedia"

@@ -78,0 +79,0 @@ | "wordpress"

@@ -1,2 +0,3 @@

import { text, type EmailConfig, type EmailUserConfig, html } from "./index.js"
import type { EmailConfig, EmailUserConfig } from "./index.js"
import { html, text } from "../lib/utils/email.js"

@@ -3,0 +4,0 @@ /** @todo Document this */

@@ -1,2 +0,3 @@

import { text, type EmailConfig, type EmailUserConfig, html } from "./index.js"
import type { EmailConfig, EmailUserConfig } from "./index.js"
import { html, text } from "../lib/utils/email.js"

@@ -3,0 +4,0 @@ /** @todo Document this */

@@ -162,2 +162,3 @@ /**

export interface Profile {
id?: string | null
sub?: string | null

@@ -164,0 +165,0 @@ name?: string | null

@@ -135,2 +135,3 @@ /**

export interface Profile {
id?: string | null;
sub?: string | null;

@@ -137,0 +138,0 @@ name?: string | null;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc