UNPKG

1.33 kBTypeScriptView Raw
1import { AsyncOptionalCreatable } from '@salesforce/kit';
2import { Optional } from '@salesforce/ts-types';
3import { KeyChain } from './keyChainImpl';
4interface CryptoOptions {
5 keychain?: KeyChain;
6 platform?: string;
7 retryStatus?: string;
8 noResetOnClose?: boolean;
9}
10/**
11 * Class for managing encrypting and decrypting private auth information.
12 */
13export declare class Crypto extends AsyncOptionalCreatable<CryptoOptions> {
14 private _key;
15 private options;
16 private messages;
17 private noResetOnClose;
18 /**
19 * Constructor
20 * **Do not directly construct instances of this class -- use {@link Crypto.create} instead.**
21 * @param options The options for the class instance.
22 * @ignore
23 */
24 constructor(options?: CryptoOptions);
25 /**
26 * Encrypts text. Returns the encrypted string or undefined if no string was passed.
27 * @param text The text to encrypt.
28 */
29 encrypt(text?: string): Optional<string>;
30 /**
31 * Decrypts text.
32 * @param text The text to decrypt.
33 */
34 decrypt(text?: string): Optional<string>;
35 /**
36 * Clears the crypto state. This should be called in a finally block.
37 */
38 close(): void;
39 /**
40 * Initialize async components.
41 */
42 protected init(): Promise<void>;
43 private getKeyChain;
44}
45export {};