/** * Crypto utilities using Web Crypto API (Edge compatible) * * Encrypts individual values with format: relic:v1:base64(salt + iv + ciphertext) * This allows the JSON structure to remain visible for easier git diffs and merges. */ import { type EncryptOptions, type SecretsData } from "./types.ts"; /** * Check if a string is an encrypted value */ export declare function isEncryptedValue(value: unknown): boolean; /** * Encrypt a single value * Returns format: relic:v1:base64(iterations[4] + salt[16] + iv[12] + ciphertext) * Iterations are stored as 4-byte big-endian uint32 */ export declare function encryptValue(masterKey: string, value: unknown, options?: EncryptOptions): Promise; /** * Decrypt a single encrypted value */ export declare function decryptValue(masterKey: string, encryptedString: string): Promise; /** * Recursively encrypt all values in an object (parallelized) */ export declare function encryptSecrets(masterKey: string, data: SecretsData, options?: EncryptOptions): Promise; /** * Recursively decrypt all encrypted values in an object (parallelized) */ export declare function decryptSecrets(masterKey: string, data: SecretsData): Promise; /** * Encrypt secrets and serialize to JSON string (for saving artifact file) */ export declare function encryptPayload(masterKey: string, plaintext: string, options?: EncryptOptions): Promise; /** * Parse artifact and decrypt all values (for loading artifact file) */ export declare function decryptPayload(masterKey: string, artifactString: string): Promise; /** * Decrypt and parse artifact as JSON */ export declare function decryptAndParse(masterKey: string, artifactString: string): Promise;