<commit_before>// Type definitions for smtp-server 3.5
// Project: https://github.com/nodemailer/smtp-server, https://github.com/andris9/smtp-server
// Definitions by: markisme <https://github.com/markisme>
//                 taisiias <https://github.com/Taisiias>
//                 <NAME> <https://github.com/dex4er>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3

/// <reference types="node" />
/// <reference types="nodemailer" />

import { EventEmitter } from 'events';
import * as net from 'net';
import * as shared from 'nodemailer/lib/shared';
import { PassThrough } from 'stream';
import * as tls from 'tls';

export type ms = number;

export interface SMTPServerAddress {
    /**
     * the address provided with the MAIL FROM or RCPT TO command
     */
    address: string;
    /**
     * an object with additional arguments (all key names are uppercase)
     */
    args: object;
}

export interface SMTPServerAuthentication {
    /**
     * indicates the authentication method used, 'PLAIN', 'LOGIN' or 'XOAUTH2'
     */
    method: 'PLAIN' | 'LOGIN' | 'XOAUTH2';
    /**
     * the username of the user
     */
    username?: string;
    /**
     * the password if LOGIN or PLAIN was used
     */
    password?: string;
    /**
     *  the OAuth2 bearer access token if 'XOAUTH2' was used as the authentication method
     */
    accessToken?: string;
    /**
     * a function for validating CRAM-MD5 challenge responses.
     * Takes the password of the user as an argument and returns true if the response matches the password
     */
    validatePassword(password: string): boolean;
}

export interface SMTPServerAuthenticationResponse {
    /**
     * can be any value - if this is set then the user is considered logged in
     * and this value is used later with the session data to identify the user.
     * If this value is empty, then the authentication is considered failed
     */
    user: any;
    /**
     * an object to return if XOAUTH2 authentication failed (do not set the error object in this case).
     * This value is serialized to JSON and base64 encoded automatically, so you can just return the object<commit_msg>🤖 Merge PR #48342 smtp-server: change SMTPServerAuthenticationResponse.user type to be nullable by @quantumsheep<commit_after>// Type definitions for smtp-server 3.5
// Project: https://github.com/nodemailer/smtp-server, https://github.com/andris9/smtp-server
// Definitions by: markisme <https://github.com/markisme>
//                 taisiias <https://github.com/Taisiias>
//                 <NAME> <https://github.com/dex4er>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3

/// <reference types="node" />
/// <reference types="nodemailer" />

import { EventEmitter } from 'events';
import * as net from 'net';
import * as shared from 'nodemailer/lib/shared';
import { PassThrough } from 'stream';
import * as tls from 'tls';

export type ms = number;

export interface SMTPServerAddress {
    /**
     * the address provided with the MAIL FROM or RCPT TO command
     */
    address: string;
    /**
     * an object with additional arguments (all key names are uppercase)
     */
    args: object;
}

export interface SMTPServerAuthentication {
    /**
     * indicates the authentication method used, 'PLAIN', 'LOGIN' or 'XOAUTH2'
     */
    method: 'PLAIN' | 'LOGIN' | 'XOAUTH2';
    /**
     * the username of the user
     */
    username?: string;
    /**
     * the password if LOGIN or PLAIN was used
     */
    password?: string;
    /**
     *  the OAuth2 bearer access token if 'XOAUTH2' was used as the authentication method
     */
    accessToken?: string;
    /**
     * a function for validating CRAM-MD5 challenge responses.
     * Takes the password of the user as an argument and returns true if the response matches the password
     */
    validatePassword(password: string): boolean;
}

export interface SMTPServerAuthenticationResponse {
    /**
     * can be any value - if this is set then the user is considered logged in
     * and this value is used later with the session data to identify the user.
     * If this value is empty, then the authentication is considered failed
     */
    user?: any;
    /**
     * an object to return if XOAUTH2 authentication failed (do not set the error object in this case).
     * This value is serialized to JSON and base64 encoded automatically, so you can just return the object
{'fraction_non_alphanumeric': 0.10111111111111111, 'fraction_numerical': 0.007333333333333333, 'mean_word_length': 2.8241291418861514, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7221829', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1260, 'n_words': 483}