push neon reactor

This commit is contained in:
2026-07-12 15:11:38 +02:00
parent 172e72dbcd
commit aeab5f7820
9597 changed files with 2407488 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"type":"commonjs"}
@@ -0,0 +1,6 @@
export interface DpapiBindings {
protectData(dataToEncrypt: Uint8Array, optionalEntropy: Uint8Array | null, scope: string): Uint8Array;
unprotectData(encryptData: Uint8Array, optionalEntropy: Uint8Array | null, scope: string): Uint8Array;
}
declare let Dpapi: DpapiBindings;
export { Dpapi };
@@ -0,0 +1,21 @@
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { AccountInfo, AuthenticationResult, INativeBrokerPlugin, LoggerOptions, NativeRequest, NativeSignOutRequest } from "@azure/msal-common/node";
export declare class NativeBrokerPlugin implements INativeBrokerPlugin {
private logger;
isBrokerAvailable: boolean;
constructor();
setLogger(loggerOptions: LoggerOptions): void;
getAccountById(accountId: string, correlationId: string): Promise<AccountInfo>;
getAllAccounts(clientId: string, correlationId: string): Promise<AccountInfo[]>;
acquireTokenSilent(request: NativeRequest): Promise<AuthenticationResult>;
acquireTokenInteractive(request: NativeRequest, providedWindowHandle?: Buffer): Promise<AuthenticationResult>;
signOut(request: NativeSignOutRequest): Promise<void>;
private getAccount;
private readAccountById;
private generateRequestParameters;
private getAuthenticationResult;
private generateAccountInfo;
private isMsalRuntimeError;
private wrapError;
}
@@ -0,0 +1,6 @@
import { AuthError } from "@azure/msal-common/node";
export declare class NativeAuthError extends AuthError {
statusCode: number;
tag: number;
constructor(errorStatus: string, errorContext: string, errorCode: number, errorTag: number);
}
@@ -0,0 +1,57 @@
/**
* Error thrown when trying to write MSAL cache to persistence.
*/
export declare class PersistenceError extends Error {
errorCode: string;
errorMessage: string;
constructor(errorCode: string, errorMessage: string);
/**
* Error thrown when trying to access the file system.
*/
static createFileSystemError(errorCode: string, errorMessage: string): PersistenceError;
/**
* Error thrown when trying to write, load, or delete data from secret service on linux.
* Libsecret is used to access secret service.
*/
static createLibSecretError(errorMessage: string): PersistenceError;
/**
* Error thrown when trying to write, load, or delete data from keychain on macOs.
*/
static createKeychainPersistenceError(errorMessage: string): PersistenceError;
/**
* Error thrown when trying to encrypt or decrypt data using DPAPI on Windows.
*/
static createFilePersistenceWithDPAPIError(errorMessage: string): PersistenceError;
/**
* Error thrown when using the cross platform lock.
*/
static createCrossPlatformLockError(errorMessage: string): PersistenceError;
/**
* Throw cache persistence error
*
* @param errorMessage string
* @returns PersistenceError
*/
static createCachePersistenceError(errorMessage: string): PersistenceError;
/**
* Throw unsupported error
*
* @param errorMessage string
* @returns PersistenceError
*/
static createNotSupportedError(errorMessage: string): PersistenceError;
/**
* Throw persistence not verified error
*
* @param errorMessage string
* @returns PersistenceError
*/
static createPersistenceNotVerifiedError(errorMessage: string): PersistenceError;
/**
* Throw persistence creation validation error
*
* @param errorMessage string
* @returns PersistenceError
*/
static createPersistenceNotValidatedError(errorMessage: string): PersistenceError;
}
@@ -0,0 +1,12 @@
export { PersistenceCachePlugin } from "./persistence/PersistenceCachePlugin.js";
export { FilePersistence } from "./persistence/FilePersistence.js";
export { FilePersistenceWithDataProtection } from "./persistence/FilePersistenceWithDataProtection.js";
export { DataProtectionScope } from "./persistence/DataProtectionScope.js";
export { KeychainPersistence } from "./persistence/KeychainPersistence.js";
export { LibSecretPersistence } from "./persistence/LibSecretPersistence.js";
export { IPersistence } from "./persistence/IPersistence.js";
export { CrossPlatformLockOptions } from "./lock/CrossPlatformLockOptions.js";
export { PersistenceCreator } from "./persistence/PersistenceCreator.js";
export { IPersistenceConfiguration } from "./persistence/IPersistenceConfiguration.js";
export { Environment } from "./utils/Environment.js";
export { NativeBrokerPlugin } from "./broker/NativeBrokerPlugin.js";
@@ -0,0 +1,24 @@
import { CrossPlatformLockOptions } from "./CrossPlatformLockOptions.js";
import { Logger } from "@azure/msal-common/node";
/**
* Cross-process lock that works on all platforms.
*/
export declare class CrossPlatformLock {
private readonly lockFilePath;
private lockFileHandle;
private readonly retryNumber;
private readonly retryDelay;
private logger;
constructor(lockFilePath: string, logger: Logger, lockOptions?: CrossPlatformLockOptions);
/**
* Locks cache from read or writes by creating file with same path and name as
* cache file but with .lockfile extension. If another process has already created
* the lockfile, will back off and retry based on configuration settings set by CrossPlatformLockOptions
*/
lock(): Promise<void>;
/**
* unlocks cache file by deleting .lockfile.
*/
unlock(): Promise<void>;
private sleep;
}
@@ -0,0 +1,10 @@
/**
* Options for CrossPlatform lock.
*
* retryNumber: Numbers of times we should try to acquire a lock. Defaults to 500.
* retryDelay: Time to wait before trying to retry a lock acquisition. Defaults to 100 ms.
*/
export type CrossPlatformLockOptions = {
retryNumber: number;
retryDelay: number;
};
@@ -0,0 +1,2 @@
export declare const name = "@azure/msal-node-extensions";
export declare const version = "1.5.17";
@@ -0,0 +1,5 @@
import { IPersistence } from "./IPersistence.js";
export declare abstract class BasePersistence {
abstract createForPersistenceValidation(): Promise<IPersistence>;
verifyPersistence(): Promise<boolean>;
}
@@ -0,0 +1,16 @@
/**
* Specifies the scope of the data protection - either the current user or the local
* machine.
*
* You do not need a key to protect or unprotect the data.
* If you set the Scope to CurrentUser, only applications running on your credentials can
* unprotect the data; however, that means that any application running on your credentials
* can access the protected data. If you set the Scope to LocalMachine, any full-trust
* application on the computer can unprotect, access, and modify the data.
*
*/
export declare const DataProtectionScope: {
readonly CurrentUser: "CurrentUser";
readonly LocalMachine: "LocalMachine";
};
export type DataProtectionScope = (typeof DataProtectionScope)[keyof typeof DataProtectionScope];
@@ -0,0 +1,29 @@
import { IPersistence } from "./IPersistence.js";
import { Logger, LoggerOptions } from "@azure/msal-common/node";
import { BasePersistence } from "./BasePersistence.js";
/**
* Reads and writes data to file specified by file location. File contents are not
* encrypted.
*
* If file or directory has not been created, it FilePersistence.create() will create
* file and any directories in the path recursively.
*/
export declare class FilePersistence extends BasePersistence implements IPersistence {
private filePath;
private logger;
private constructor();
static create(fileLocation: string, loggerOptions?: LoggerOptions): Promise<FilePersistence>;
save(contents: string): Promise<void>;
saveBuffer(contents: Uint8Array): Promise<void>;
load(): Promise<string | null>;
loadBuffer(): Promise<Uint8Array>;
delete(): Promise<boolean>;
getFilePath(): string;
reloadNecessary(lastSync: number): Promise<boolean>;
getLogger(): Logger;
createForPersistenceValidation(): Promise<FilePersistence>;
private static createDefaultLoggerOptions;
private timeLastModified;
private createCacheFile;
private createFileDirectory;
}
@@ -0,0 +1,24 @@
import { IPersistence } from "./IPersistence.js";
import { DataProtectionScope } from "./DataProtectionScope.js";
import { Logger, LoggerOptions } from "@azure/msal-common/node";
import { BasePersistence } from "./BasePersistence.js";
/**
* Uses CryptProtectData and CryptUnprotectData on Windows to encrypt and decrypt file contents.
*
* scope: Scope of the data protection. Either local user or the current machine
* optionalEntropy: Password or other additional entropy used to encrypt the data
*/
export declare class FilePersistenceWithDataProtection extends BasePersistence implements IPersistence {
private filePersistence;
private scope;
private optionalEntropy;
private constructor();
static create(fileLocation: string, scope: DataProtectionScope, optionalEntropy?: string, loggerOptions?: LoggerOptions): Promise<FilePersistenceWithDataProtection>;
save(contents: string): Promise<void>;
load(): Promise<string | null>;
delete(): Promise<boolean>;
reloadNecessary(lastSync: number): Promise<boolean>;
getFilePath(): string;
getLogger(): Logger;
createForPersistenceValidation(): Promise<FilePersistenceWithDataProtection>;
}
@@ -0,0 +1,11 @@
import { Logger } from "@azure/msal-common/node";
export interface IPersistence {
save(contents: string): Promise<void>;
load(): Promise<string | null>;
delete(): Promise<boolean>;
reloadNecessary(lastSync: number): Promise<boolean>;
getFilePath(): string;
getLogger(): Logger;
verifyPersistence(): Promise<boolean>;
createForPersistenceValidation(): Promise<IPersistence>;
}
@@ -0,0 +1,10 @@
import type { LoggerOptions } from "@azure/msal-common/node";
import { DataProtectionScope } from "./DataProtectionScope.js";
export interface IPersistenceConfiguration {
cachePath?: string;
dataProtectionScope?: DataProtectionScope;
serviceName?: string;
accountName?: string;
usePlaintextFileOnLinux?: boolean;
loggerOptions?: LoggerOptions;
}
@@ -0,0 +1,23 @@
import { IPersistence } from "./IPersistence.js";
import { Logger, LoggerOptions } from "@azure/msal-common/node";
import { BasePersistence } from "./BasePersistence.js";
/**
* Uses reads and writes passwords to macOS keychain
*
* serviceName: Identifier used as key for whatever value is stored
* accountName: Account under which password should be stored
*/
export declare class KeychainPersistence extends BasePersistence implements IPersistence {
protected readonly serviceName: string;
protected readonly accountName: string;
private filePersistence;
private constructor();
static create(fileLocation: string, serviceName: string, accountName: string, loggerOptions?: LoggerOptions): Promise<KeychainPersistence>;
save(contents: string): Promise<void>;
load(): Promise<string | null>;
delete(): Promise<boolean>;
reloadNecessary(lastSync: number): Promise<boolean>;
getFilePath(): string;
getLogger(): Logger;
createForPersistenceValidation(): Promise<KeychainPersistence>;
}
@@ -0,0 +1,24 @@
import { IPersistence } from "./IPersistence.js";
import { Logger, LoggerOptions } from "@azure/msal-common/node";
import { BasePersistence } from "./BasePersistence.js";
/**
* Uses reads and writes passwords to Secret Service API/libsecret. Requires libsecret
* to be installed.
*
* serviceName: Identifier used as key for whatever value is stored
* accountName: Account under which password should be stored
*/
export declare class LibSecretPersistence extends BasePersistence implements IPersistence {
protected readonly serviceName: string;
protected readonly accountName: string;
private filePersistence;
private constructor();
static create(fileLocation: string, serviceName: string, accountName: string, loggerOptions?: LoggerOptions): Promise<LibSecretPersistence>;
save(contents: string): Promise<void>;
load(): Promise<string | null>;
delete(): Promise<boolean>;
reloadNecessary(lastSync: number): Promise<boolean>;
getFilePath(): string;
getLogger(): Logger;
createForPersistenceValidation(): Promise<LibSecretPersistence>;
}
@@ -0,0 +1,38 @@
import { IPersistence } from "./IPersistence.js";
import { CrossPlatformLockOptions } from "../lock/CrossPlatformLockOptions.js";
import { TokenCacheContext, ICachePlugin } from "@azure/msal-common/node";
/**
* MSAL cache plugin which enables callers to write the MSAL cache to disk on Windows,
* macOs, and Linux.
*
* - Persistence can be one of:
* - FilePersistence: Writes and reads from an unencrypted file. Can be used on Windows,
* macOs, or Linux.
* - FilePersistenceWithDataProtection: Used on Windows, writes and reads from file encrypted
* with windows dpapi-addon.
* - KeychainPersistence: Used on macOs, writes and reads from keychain.
* - LibSecretPersistence: Used on linux, writes and reads from secret service API. Requires
* libsecret be installed.
*/
export declare class PersistenceCachePlugin implements ICachePlugin {
persistence: IPersistence;
lastSync: number;
currentCache: string | null;
lockFilePath: string;
private crossPlatformLock;
private logger;
constructor(persistence: IPersistence, lockOptions?: CrossPlatformLockOptions);
/**
* Reads from storage and saves an in-memory copy. If persistence has not been updated
* since last time data was read, in memory copy is used.
*
* If cacheContext.cacheHasChanged === true, then file lock is created and not deleted until
* afterCacheAccess() is called, to prevent the cache file from changing in between
* beforeCacheAccess() and afterCacheAccess().
*/
beforeCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
/**
* Writes to storage if MSAL in memory copy of cache has been changed.
*/
afterCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
}
@@ -0,0 +1,5 @@
import { IPersistence } from "./IPersistence.js";
import { IPersistenceConfiguration } from "./IPersistenceConfiguration.js";
export declare class PersistenceCreator {
static createPersistence(config: IPersistenceConfiguration): Promise<IPersistence>;
}
@@ -0,0 +1,54 @@
export declare const Constants: {
/**
* An existing file was the target of an operation that required that the target not exist
*/
EEXIST_ERROR: string;
/**
* No such file or directory: Commonly raised by fs operations to indicate that a component
* of the specified pathname does not exist. No entity (file or directory) could be found
* by the given path
*/
ENOENT_ERROR: string;
/**
* Operation not permitted. An attempt was made to perform an operation that requires
* elevated privileges.
*/
EPERM_ERROR: string;
/**
* Default service name for using MSAL Keytar
*/
DEFAULT_SERVICE_NAME: string;
/**
* Test data used to verify underlying persistence mechanism
*/
PERSISTENCE_TEST_DATA: string;
/**
* This is the value of a the guid if the process is being ran by the root user
*/
LINUX_ROOT_USER_GUID: number;
/**
* List of environment variables
*/
ENVIRONMENT: {
HOME: string;
LOGNAME: string;
USER: string;
LNAME: string;
USERNAME: string;
PLATFORM: string;
LOCAL_APPLICATION_DATA: string;
};
DEFAULT_CACHE_FILE_NAME: string;
};
export declare const Platform: {
readonly WINDOWS: "win32";
readonly LINUX: "linux";
readonly MACOS: "darwin";
};
export type Platform = (typeof Platform)[keyof typeof Platform];
export declare const ErrorCodes: {
readonly INTERATION_REQUIRED_ERROR_CODE: "interaction_required";
readonly SERVER_UNAVAILABLE: "server_unavailable";
readonly UNKNOWN: "unknown_error";
};
export type ErrorCodes = (typeof ErrorCodes)[keyof typeof ErrorCodes];
@@ -0,0 +1,16 @@
export declare class Environment {
static get homeEnvVar(): string;
static get lognameEnvVar(): string;
static get userEnvVar(): string;
static get lnameEnvVar(): string;
static get usernameEnvVar(): string;
static getEnvironmentVariable(name: string): string;
static getEnvironmentPlatform(): string;
static isWindowsPlatform(): boolean;
static isLinuxPlatform(): boolean;
static isMacPlatform(): boolean;
static isLinuxRootUser(): boolean;
static getUserRootDirectory(): string | null;
static getUserHomeDirOnWindows(): string;
static getUserHomeDirOnUnix(): string | null;
}
@@ -0,0 +1,5 @@
/// <reference types="node" resolution-mode="require"/>
/**
* Returns whether or not the given object is a Node.js error
*/
export declare const isNodeError: (error: unknown) => error is NodeJS.ErrnoException;