UNPKG

@salesforce/core

Version:

Core libraries to interact with SFDX projects, orgs, and APIs.

61 lines (60 loc) 1.72 kB
import { AsyncOptionalCreatable } from '@salesforce/kit'; import { KeyChain } from './keyChainImpl'; type CryptoOptions = { keychain?: KeyChain; platform?: string; retryStatus?: string; noResetOnClose?: boolean; }; /** * Class for managing encrypting and decrypting private auth information. */ export declare class Crypto extends AsyncOptionalCreatable<CryptoOptions> { private key; private options; private noResetOnClose; /** * Constructor * **Do not directly construct instances of this class -- use {@link Crypto.create} instead.** * * @param options The options for the class instance. * @ignore */ constructor(options?: CryptoOptions); private static unsetCryptoVersion; /** * Encrypts text. Returns the encrypted string or undefined if no string was passed. * * @param text The text to encrypt. */ encrypt(text: string): string; /** * Decrypts text. * * @param text The text to decrypt. */ decrypt(text: string): string; /** * Takes a best guess if the value provided was encrypted by {@link Crypto.encrypt} by * checking the delimiter, tag length, and valid characters. * * @param text The text * @returns true if the text is encrypted, false otherwise. */ isEncrypted(text?: string): boolean; /** * Clears the crypto state. This should be called in a finally block. */ close(): void; isV2Crypto(): boolean; /** * Initialize async components. */ protected init(): Promise<void>; private encryptV1; private encryptV2; private decryptV1; private decryptV2; private getKeyChain; } export {};