import * as pgp from 'openpgp'; import { Json } from '@app-config/utils'; import { EnvironmentOptions } from '@app-config/node'; import { EncryptedSymmetricKey } from '@app-config/meta'; export type Key = pgp.key.Key & { keyName?: string; }; export declare const keyDirs: { readonly keychain: string; readonly privateKey: string; readonly publicKey: string; readonly revocationCert: string; }; interface UserKeys { privateKeyArmored: string; publicKeyArmored: string; revocationCertificate: string; } export declare function initializeKeysManually(options: { name: string; email: string; passphrase?: string; }): Promise; export declare function initializeKeys(withPassphrase?: boolean): Promise; export declare function initializeLocalKeys(keys?: UserKeys, dirs?: typeof keyDirs): Promise; export declare function deleteLocalKeys(dirs?: typeof keyDirs): Promise; export declare function loadKey(contents: string | Buffer): Promise; export declare function loadPrivateKey(override?: string | Buffer | undefined, environmentOptions?: EnvironmentOptions): Promise; export declare function loadPublicKey(override?: string | Buffer | undefined, environmentOptions?: EnvironmentOptions): Promise; export declare function loadPrivateKeyLazy(environmentOptions?: EnvironmentOptions): Promise; export declare function loadPublicKeyLazy(environmentOptions?: EnvironmentOptions): Promise; export { EncryptedSymmetricKey }; export interface DecryptedSymmetricKey { revision: string; key: Uint8Array; } export declare function generateSymmetricKey(revision: string): Promise; export declare function encryptSymmetricKey(decrypted: DecryptedSymmetricKey, teamMembers: Key[]): Promise; export declare function decryptSymmetricKey(encrypted: EncryptedSymmetricKey, privateKey: Key): Promise; export declare function saveNewSymmetricKey(symmetricKey: DecryptedSymmetricKey, teamMembers: Key[], environmentOptions?: EnvironmentOptions): Promise; export declare function loadSymmetricKeys(lazy?: boolean, environmentOptions?: EnvironmentOptions): Promise; export declare function loadSymmetricKey(revision: string, privateKey: Key, lazyMeta?: boolean, environmentOptions?: EnvironmentOptions): Promise; export declare function loadSymmetricKeyLazy(revision: string, privateKey: Key, environmentOptions?: EnvironmentOptions): Promise; export declare function loadLatestSymmetricKey(privateKey: Key, environmentOptions?: EnvironmentOptions): Promise; export declare function loadLatestSymmetricKeyLazy(privateKey: Key, environmentOptions?: EnvironmentOptions): Promise; export declare function encryptValue(value: Json, symmetricKeyOverride?: DecryptedSymmetricKey, environmentOptions?: EnvironmentOptions): Promise; export declare function decryptValue(text: string, symmetricKeyOverride?: DecryptedSymmetricKey, environmentOptions?: EnvironmentOptions): Promise; export declare function loadTeamMembers(environmentOptions?: EnvironmentOptions): Promise; export declare function loadTeamMembersLazy(environmentOptions?: EnvironmentOptions): Promise; export declare function trustTeamMember(newTeamMember: Key, privateKey: Key, environmentOptions?: EnvironmentOptions): Promise; export declare function untrustTeamMember(email: string, privateKey: Key, environmentOptions?: EnvironmentOptions): Promise; export declare function getRevisionNumber(revision: string): number; export declare function latestSymmetricKeyRevision(keys: (EncryptedSymmetricKey | DecryptedSymmetricKey)[]): string;