UNPKG

@meeco/cryppo

Version:

In-browser encryption and decryption. Clone of Ruby Cryppo

52 lines 1.82 kB
import { EncryptionKey } from '../encryption-key.js'; import { IRandomKeyOptions } from '../key-derivation/derived-key.js'; import { SerializationFormat } from '../serialization-versions.js'; import { CipherStrategy } from '../strategies.js'; export interface IEncryptionOptionsWithoutKey { /*** * Data to encrypt */ data: Uint8Array; /** * Encryption/Cipher strategy to use */ strategy: CipherStrategy; /** * Defaults to 32 - length to use for generated key */ keyLength?: number; /** * @deprecated Primarily for testing purposes. */ iv?: string; } export interface IEncryptionArtifacts { iv: any; at: any; ad: any; } export type IEncryptionOptions = IEncryptionOptionsWithoutKey & { key: EncryptionKey; }; export interface IEncryptionResult { serialized: string | null; encrypted: string | null; } export declare function encryptWithGeneratedKey({ data, strategy, keyLength, iv }: IEncryptionOptionsWithoutKey, serializationVersion?: SerializationFormat): Promise<IEncryptionResult & { generatedKey: EncryptionKey; }>; export declare function encryptWithKeyDerivedFromString({ passphrase, data, strategy, iv, serializationVersion, }: { passphrase: string; data: Uint8Array; strategy: CipherStrategy; iv?: string; serializationVersion?: SerializationFormat; }): Promise<IEncryptionResult & IRandomKeyOptions & { key: EncryptionKey; }>; export declare function encryptWithKey({ key, data, strategy, iv }: IEncryptionOptions, serializationVersion?: SerializationFormat): Promise<IEncryptionResult>; export declare function encryptWithKeyUsingArtefacts({ key, data, strategy, iv }: IEncryptionOptions): { encrypted: string | null; artifacts?: any; }; //# sourceMappingURL=encryption.d.ts.map