declare module "storage/StorageInterface" { export = StorageInterface; /** * Storage Interface (stub only) * @see MemoryStorageInterface * @memberof module:Buttercup */ class StorageInterface { /** * Get all keys as an array * @memberof StorageInterface */ getAllKeys(): Promise; /** * Get a value for a key * @memberof StorageInterface */ getValue(): Promise; /** * Remove a value for a key * @memberof StorageInterface */ removeKey(): Promise; /** * Set a value for a key * @memberof StorageInterface */ setValue(): Promise; } } declare module "storage/MemoryStorageInterface" { export = MemoryStorageInterface; const MemoryStorageInterface_base: typeof import("storage/StorageInterface.js"); /** * Storage interface for memory storage * @augments StorageInterface * @memberof module:Buttercup */ class MemoryStorageInterface extends MemoryStorageInterface_base { _store: {}; } } declare module "env/core/prop" { export function assignObjImmutableProp(obj: any, name: any, method: any): void; } declare module "env/core/appEnv" { export type AppEnv = any; /** * Internal private API */ export type AppEnvIntPrv = { /** * Index of set environment properties */ properties: any; }; export type GetPropertyOptions = { /** * The default value to return (default: null) */ defaultValue?: any | undefined; /** * Fail if the property doesn't exist (default: true) */ failIfNotExist?: boolean | undefined; }; /** * Create a new application environment * @returns {AppEnv} */ export function createAppEnv(): AppEnv; } declare module "env/core/global" { export function getGlobal(): (Window & typeof globalThis) | (NodeJS.Global & typeof globalThis); } declare module "env/core/singleton" { /** * Get the shared app-environment configurator * (provides a controller for handling the substitution of * functions that need to work differently on different * environments) * @returns {AppEnv} * @memberof module:Buttercup */ export function getSharedAppEnv(): any; } declare module "env/appEnv" { export const getSharedAppEnv: () => any; } declare module "io/VaultFormat" { export = VaultFormat; const VaultFormat_base: typeof import("eventemitter3"); class VaultFormat extends VaultFormat_base { static encodeRaw(): void; static extractSharesFromHistory(): void; static isEncrypted(): void; static parseEncrypted(): void; static prepareHistoryForMerge(): void; constructor(source?: {}); dirty: boolean; history: any[]; _readOnly: boolean; source: any; get readOnly(): boolean; clear(): void; cloneEntry(): void; cloneGroup(): void; createEntry(): void; createGroup(): void; deleteEntry(): void; deleteEntryAttribute(): void; deleteEntryProperty(): void; deleteGroup(): void; deleteGroupAttribute(): void; deleteVaultAttribute(): void; erase(): void; execute(): void; generateID(): void; getFormat(): typeof VaultFormat; initialise(): void; moveEntry(): void; moveGroup(): void; optimise(): void; setEntryAttribute(): void; setEntryProperty(): void; setGroupAttribute(): void; setGroupTitle(): void; setVaultAttribute(): void; } } declare module "tools/rawVaultSearch" { export type FoundGroupResult = { /** * The found group dataset */ group: any; /** * The index the group was located at */ index: number; }; export function findEntryByID(groups: any, id: any): any; export function findGroupByCheck(groups: any, checkFn: any): any; export function findGroupByID(groups: any, id: any): any; export function findGroupByTitle(groups: any, title: any): any; /** * @typedef {Object} FoundGroupResult * @property {Object} group The found group dataset * @property {Number} index The index the group was located at */ /** * Find a raw group that contains an entry with an ID * @param {Array.} groups An array of raw groups * @param {String} id The entry ID to search for * @returns {FoundGroupResult} The parent group of the found entry */ export function findGroupContainingEntryID(groups: Array, id: string): FoundGroupResult; /** * Find a raw group that contains a group with an ID * @param {Object} group The group/archive to search in * @param {String} id The group ID to search for * @returns {FoundGroupResult} The parent of the located group ID */ export function findGroupContainingGroupID(group: any, id: string): FoundGroupResult; } declare module "tools/uuid" { /** * Generate a UUID (v4) * @returns {String} The new UUID */ export function generateUUID(): string; } declare module "tools/encoding" { export const ENCODED_STRING_PREFIX: "utf8+base64:"; /** * Decode an encoded property value * @param {String} value The encoded value * @returns {String} The decoded value */ export function decodeStringValue(value: string): string; /** * Encode a raw value into safe storage form * Uses base64 for encoding * @param {String} value The raw value to encode * @returns {String} The encoded result */ export function encodeStringValue(value: string): string; /** * Get a unique identifier (UUID v4) * @returns {String} A unique identifier */ export function getUniqueID(): string; /** * Check if a string value is encoded * @param {String} text The value to check * @returns {Boolean} True if the text is encoded */ export function isEncoded(text: string): boolean; } declare module "io/formatA/tools" { export type EntryHistoryItem = { /** * The property/attribute name */ property: string; /** * Either "property" or "attribute" */ propertyType: string; /** * The original value or null if it did not exist * before this change */ originalValue: string | null; /** * The new value or null if it was deleted */ newValue: string | null; }; export namespace COMMAND_ARGUMENT { export namespace ItemID { export const test: RegExp; export function wrap(txt: any): any; export const encode: boolean; } export namespace ItemIDOrRoot { const test_1: RegExp; export { test_1 as test }; export function wrap_1(txt: any): any; export { wrap_1 as wrap }; const encode_1: boolean; export { encode_1 as encode }; } export namespace StringKey { const test_2: RegExp; export { test_2 as test }; export function wrap_2(txt: any): string; export { wrap_2 as wrap }; const encode_2: boolean; export { encode_2 as encode }; } export namespace StringValue { const test_3: RegExp; export { test_3 as test }; export function wrap_3(txt: any): string; export { wrap_3 as wrap }; const encode_3: boolean; export { encode_3 as encode }; } } export namespace COMMAND_MANIFEST { export namespace ArchiveID { export const s: string; export const d: boolean; export const args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; } export namespace Comment { const s_1: string; export { s_1 as s }; const d_1: boolean; export { d_1 as d }; const args_1: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; export { args_1 as args }; } export namespace CreateEntry { const s_2: string; export { s_2 as s }; const d_2: boolean; export { d_2 as d }; const args_2: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_2 as args }; } export namespace CreateGroup { const s_3: string; export { s_3 as s }; const d_3: boolean; export { d_3 as d }; const args_3: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_3 as args }; } export namespace DeleteArchiveAttribute { const s_4: string; export { s_4 as s }; const d_4: boolean; export { d_4 as d }; const args_4: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; export { args_4 as args }; } export namespace DeleteEntry { const s_5: string; export { s_5 as s }; const d_5: boolean; export { d_5 as d }; const args_5: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_5 as args }; } export namespace DeleteEntryAttribute { const s_6: string; export { s_6 as s }; const d_6: boolean; export { d_6 as d }; const args_6: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_6 as args }; } export namespace DeleteEntryMeta { const s_7: string; export { s_7 as s }; const d_7: boolean; export { d_7 as d }; const args_7: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_7 as args }; } export namespace DeleteEntryProperty { const s_8: string; export { s_8 as s }; const d_8: boolean; export { d_8 as d }; const args_8: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_8 as args }; } export namespace DeleteGroup { const s_9: string; export { s_9 as s }; const d_9: boolean; export { d_9 as d }; const args_9: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_9 as args }; } export namespace DeleteGroupAttribute { const s_10: string; export { s_10 as s }; const d_10: boolean; export { d_10 as d }; const args_10: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_10 as args }; } export namespace Format { const s_11: string; export { s_11 as s }; const d_11: boolean; export { d_11 as d }; const args_11: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; export { args_11 as args }; } export namespace MoveEntry { const s_12: string; export { s_12 as s }; const d_12: boolean; export { d_12 as d }; const args_12: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_12 as args }; } export namespace MoveGroup { const s_13: string; export { s_13 as s }; const d_13: boolean; export { d_13 as d }; const args_13: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_13 as args }; } export namespace Pad { const s_14: string; export { s_14 as s }; const d_14: boolean; export { d_14 as d }; const args_14: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_14 as args }; } export namespace SetArchiveAttribute { const s_15: string; export { s_15 as s }; const d_15: boolean; export { d_15 as d }; const args_15: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; export { args_15 as args }; } export namespace SetEntryAttribute { const s_16: string; export { s_16 as s }; const d_16: boolean; export { d_16 as d }; const args_16: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_16 as args }; } export namespace SetEntryMeta { const s_17: string; export { s_17 as s }; const d_17: boolean; export { d_17 as d }; const args_17: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_17 as args }; } export namespace SetEntryProperty { const s_18: string; export { s_18 as s }; const d_18: boolean; export { d_18 as d }; const args_18: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_18 as args }; } export namespace SetGroupAttribute { const s_19: string; export { s_19 as s }; const d_19: boolean; export { d_19 as d }; const args_19: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_19 as args }; } export namespace SetGroupTitle { const s_20: string; export { s_20 as s }; const d_20: boolean; export { d_20 as d }; const args_20: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; export { args_20 as args }; } } export class InigoCommand { static Command: { ArchiveID: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; Comment: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; }; CreateEntry: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; CreateGroup: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; DeleteArchiveAttribute: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; }; DeleteEntry: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; DeleteEntryAttribute: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; DeleteEntryMeta: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; DeleteEntryProperty: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; DeleteGroup: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; DeleteGroupAttribute: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; Format: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; }; MoveEntry: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; MoveGroup: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; Pad: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; SetArchiveAttribute: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => string; encode: boolean; }[]; }; SetEntryAttribute: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; SetEntryMeta: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; SetEntryProperty: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; SetGroupAttribute: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; SetGroupTitle: { s: string; d: boolean; args: { test: RegExp; wrap: (txt: any) => any; encode: boolean; }[]; }; }; static create(cmd: any): InigoCommand; static generatePaddingCommand(): string; constructor(cmdKey: any); _commandKey: any; _commandArgs: any[]; addArgument(arg: any): InigoCommand; generateCommand(): string; } /** * Extract command components from a string * @param {String} command The command to extract from * @returns {String[]} The separated parts */ export function extractCommandComponents(cmd: any): string[]; /** * @typedef {Object} EntryHistoryItem * @property {String} property The property/attribute name * @property {String} propertyType Either "property" or "attribute" * @property {String|null} originalValue The original value or null if it did not exist * before this change * @property {String|null} newValue The new value or null if it was deleted */ /** * Generate a new entry history item * @param {String} property The property/attribute name * @param {String} propertyType Either "property" or "attribute" * @param {String|null} originalValue The original value or null if it did not exist * before this change * @param {String|null} newValue The new value or null if it was deleted * @returns {EntryHistoryItem} */ export function generateEntryHistoryItem(property: string, propertyType: string, originalValue?: string | null, newValue?: string | null): EntryHistoryItem; export function historyArrayToString(historyArray: any): any; export function historyStringToArray(historyString: any): any; /** * Strip destructive commands from a history collection * @param {Array.} history The history * @returns {Array.} The history minus any destructive commands */ export function stripDestructiveCommands(history: Array): Array; } declare module "io/formatA/commands" { export function executeArchiveID(vault: any, opts: any, id: any): void; export function executeComment(): void; export function executeCreateEntry(archive: any, opts: any, groupID: any, entryID: any): void; export function executeCreateGroup(archive: any, opts: any, parentID: any, newID: any): void; export function executeDeleteArchiveAttribute(archive: any, opts: any, attribute: any): void; export function executeDeleteEntry(archive: any, opts: any, entryID: any): void; export function executeDeleteEntryAttribute(archive: any, opts: any, entryID: any, attribute: any): void; export function executeDeleteEntryProperty(archive: any, opts: any, entryID: any, property: any): void; export function executeDeleteGroup(archive: any, opts: any, groupID: any): void; export function executeDeleteGroupAttribute(archive: any, opts: any, groupID: any, attribute: any): void; export function executeFormat(archive: any, opts: any, format: any): void; export function executeMoveEntry(archive: any, opts: any, entryID: any, groupID: any): void; export function executeMoveGroup(archive: any, opts: any, groupID: any, targetGroupID: any): void; export function executePad(): void; export function executeSetArchiveAttribute(archive: any, opts: any, attribute: any, value: any): void; export function executeSetEntryAttribute(archive: any, opts: any, entryID: any, attribute: any, value: any): void; export function executeSetEntryProperty(archive: any, opts: any, entryID: any, property: any, value: any): void; export function executeSetGroupAttribute(archive: any, opts: any, groupID: any, attribute: any, value: any): void; export function executeTitleGroup(archive: any, opts: any, groupID: any, title: any): void; } declare module "io/formatA/describe" { /** * Describe a vault dataset - to history commands * @param {Object} dataset The vault dataset * @param {String} parentGroupID The ID of the parent group * @returns {Array.} An array of commands */ export function describeVaultDataset(dataset: any, parentGroupID: string): Array; } declare module "io/formatA/Flattener" { export = Flattener; /** * Flattener class for flattening archive history sets */ class Flattener { /** * Minimum history lines before flattening can occur * @type {Number} * @static * @memberof Flattener */ static FLATTENING_MIN_LINES: number; /** * Number of lines to preserve (most recent) * @type {Number} * @static * @memberof Flattener */ static PRESERVE_LINES: number; constructor(format: any); format: any; /** * Check if the dataset can be flattened * @returns {Boolean} True if it can be flattened * @memberof Flattener */ canBeFlattened(): boolean; /** * Flatten a dataset * @param {Boolean=} force Force flattening even if it is detected to be unnecessary * @returns {Boolean} True if flattening occurred, false otherwise * @memberof Flattener */ flatten(force?: boolean | undefined): boolean; } } declare module "io/formatA/signing" { /** * Get the current format * @returns {String} The format */ export function getFormat(): string; /** * Get the current signature * @returns {String} The signature */ export function getSignature(): string; /** * Detect if a string has a valid signature * @param {String} text The text to check * @returns {Boolean} True if a valid signature is detected */ export function hasValidSignature(text: string): boolean; /** * Sign some text * @param {String} text The text to sign * @returns {String} The signed text */ export function sign(text: string): string; /** * Strip the signature from some text * @param {String} text The text to strip the signature from * @returns {String} The text with the signature removed */ export function stripSignature(text: string): string; /** * Check if vault contents are in encrypted form * @param {String} contents The vault contents * @returns {Boolean} True if encrypted, false otherwise */ export function vaultContentsEncrypted(contents: string): boolean; } declare module "credentials/channel" { export function credentialsAllowsPurpose(id: any, purpose: any): any; export function getCredentials(id: any): any; export function removeCredentials(id: any): void; export function setCredentials(id: any, value: any): void; } declare module "io/VaultFormatA" { export = VaultFormatA; const VaultFormatA_base: typeof import("io/VaultFormat.js"); class VaultFormatA extends VaultFormatA_base { static encodeRaw(rawContent: any, credentials: any): Promise; /** * Extract shares from a history collection * @param {String[]} history A history collection, containing shares * @returns {Object} The resulting separated histories. The object will * always contain a `base` property containing the non-share history. * Each share detected is set on the object under its share ID - being * set to an array of history lines (non-prefixed) for that share. */ static extractSharesFromHistory(history: string[]): any; static isEncrypted(contents: any): boolean; static parseEncrypted(encryptedContent: any, credentials: any): Promise; static prepareHistoryForMerge(history: any): string[]; constructor(source?: {}); _executeCommand(command: any): void; _pad(): void; _processCommandParameters(commandKey: any, parameters: any): any; } } declare module "io/formatRouter" { export function detectFormat(encryptedContent: any): typeof import("io/VaultFormatA.js"); export function getDefaultFormat(): typeof import("io/VaultFormatA.js"); } declare module "search/groups" { export function findGroupByID(parentGroups: any, groupID: any): any; export function findGroupsByTitle(parentGroups: any, title: any): any[]; } declare module "search/entries" { export function findEntriesByProperty(parentGroups: any, property: any, value: any): any[]; export function findEntryByID(parentGroups: any, id: any): any; } declare module "tools/permissions" { export const PERM_MANAGE: "archive/member/manage"; export const PERM_READ: "archive/member/read"; export const PERM_WRITE: "archive/member/write"; } declare module "core/VaultItem" { export = VaultItem; /** * Base vault member class (for Entry, Group etc.) */ class VaultItem { /** * Constructor for the vault member base class * @param {Vault} vault Vault reference * @param {Object} source Remote source object reference */ constructor(vault: any, source: any); /** * Reference to the containing vault * @protected * @memberof VaultItem */ protected _vault: any; _source: any; /** * The ID of the entry or group * @readonly * @type {String} * @memberof VaultItem */ readonly get id(): string; /** * The current granted permissions * @type {Array.} * @memberof VaultItem */ get permissions(): string[]; /** * The vault this item belongs to * @readonly * @type {Vault} * @memberof VaultItem */ readonly get vault(): any; /** * Grant a new permission to the member * @param {String} perm The permission to grant * @memberof VaultItem */ grantPermission(perm: string): void; /** * Check if the member has a permission * @param {String} perm The permission to check for * @returns {Boolean} * @memberof VaultItem */ hasPermission(perm: string): boolean; /** * Revoke all permissions * @memberof VaultItem */ revokeAllPermissions(): void; /** * Revoke a single permission * @param {String} perm The permission to revoke * @memberof VaultItem */ revokePermission(perm: string): void; /** * Clean up all of the data in the vault item * @protected * @memberof VaultItem */ protected _cleanUp(): void; } } declare module "tools/polyfill" { export function objectValues(obj: any): any[]; } declare module "tools/entry" { export const ENTRY_URL_TYPE_ANY: "any"; export const ENTRY_URL_TYPE_GENERAL: "general"; export const ENTRY_URL_TYPE_ICON: "icon"; export const ENTRY_URL_TYPE_LOGIN: "login"; /** * Get URLs from an entry's properties * Allows for preferential sorting * @param {Object} properties The entry properties * @param {*} preference */ export function getEntryURLs(properties: any, preference?: any): any[]; /** * Check if a property name is valid * @param {String} name The name to check * @returns {Boolean} True if the name is valid */ export function isValidProperty(name: string): boolean; } declare module "core/Entry" { export = Entry; const Entry_base: typeof import("core/VaultItem.js"); /** * Entry class - some secret item, login or perhaps * even a credit card * @augments VaultItem * @memberof module:Buttercup */ class Entry extends Entry_base { static Attributes: Readonly<{ FacadeType: string; FieldTypePrefix: string; }>; /** * Create a new Entry instance within a vault * and group * @param {Vault} vault The target vault instance * @param {String} parentGroupID The target group to * create the entry in (cannot be vault-level) * @returns {Entry} * @memberof Entry * @static */ static createNew(vault: any, parentGroupID: string): Entry; constructor(vault: any, source: any); /** * Get the instance type * @type {String} * @readonly * @memberof Entry */ readonly get type(): string; /** * Delete the entry - either trashes the entry, or removes it completely. * If the entry is in the trash already, it is removed (including if there is no * trash group). If the entry is in a normal group and a trash group exists, it * is moved there instead of being deleted. * @param {Boolean=} skipTrash Skip the trash and force-delete the entry * @see moveToGroup * @see Vault.getTrashGroup * @returns {Boolean} Whether or not the item was deleted * @memberof Entry */ delete(skipTrash?: boolean | undefined): boolean; /** * Delete an attribute * @param {String} attribute The attribute name * @throws {Error} Throws if the attribute doesn't exist, or cannot be deleted * @memberof Entry * @returns {Entry} Self */ deleteAttribute(attribute: string): Entry; /** * Delete a property * @throws {Error} Throws if property doesn't exist, or cannot be deleted * @param {String} property The property to delete * @memberof Entry * @returns {Entry} Self */ deleteProperty(property: string): Entry; /** * Get an attribute * If no attribute name is specified, an object with all attributes and their * values is returned. * @param {String=} attribute The name of the attribute to fetch * @returns {String|undefined|Object} The attribute value or an object * containing all attribute keys and their values if no attribute name * is provided * @memberof Entry */ getAttribute(attribute?: string | undefined): string | undefined | any; /** * Get an array of all history changes made to the entry * @returns {Array.} * @memberof Entry */ getChanges(): Array; /** * Get the containing group for the entry * @returns {Group|null} The parent group * @memberof Entry * @throws {Error} Throws if no parent group found */ getGroup(): import("core/Group.js") | null; /** * Get a property value * If no property name is specified, an object with all properties and their * values is returned. * @param {String=} property The name of the property to fetch * @returns {String|undefined|Object} The property value or an object with all * values if no property specified * @memberof Entry */ getProperty(property?: string | undefined): string | undefined | any; /** * Get property values via RegExp expressions. * If no property expression is specified, it returns the empty behavior of * {@see Entry.getProperty}. * @param {RegExp|String} propertyExpression * @returns {Object} A key-value object of the matching properties * @memberof Entry */ getProperties(propertyExpression: RegExp | string): any; /** * Get an array of URLs from the Entry * Returns an array of detected URL values in the Entry's properties. The * types of URLs can be configured by providing a preference: * - "general" - General URLs (of any type, preferring "URL" named props) * - "login" - Prefer URLs whose key has "login" in it * - "icon" - Return only icon-like URLs * - "any" - Return all found URLs * @param {String=} urlTypePreference The URL type preference * @returns {Array.} An array of URLs * @memberof Entry */ getURLs(urlTypePreference?: string | undefined): Array; /** * Check if the entry is in the trash * @returns {Boolean} Whether or not the entry is in the trash * @memberof Entry */ isInTrash(): boolean; /** * Move the entry to another group * @params {Group} group The target group * @returns {Entry} Returns self * @param {Group} group The target group * @memberof Entry */ moveToGroup(group: any): Entry; /** * Set an attribute on the entry * @param {String} attribute The name of the attribute * @param {String} value The value to set * @returns {Entry} Returns self * @memberof Entry */ setAttribute(attribute: string, value: string): Entry; /** * Set a property on the entry * @param {String} property The property name * @param {String=} value The property value * @returns {Entry} Returns self * @memberof Entry */ setProperty(property: string, value?: string | undefined): Entry; } } declare module "tools/sharing" { export function mergeHistories(initial: any, incoming: any): void; /** * Move a group between archives * @param {Group} movingGroup The group to move * @param {Group|Vault} targetGroup The group to move to * @throws {Error} Throws if the remote type is not recognised */ export function moveGroupBetweenVaults(movingGroup: any, targetGroup: any | any): void; /** * Prepend the share prefix to every line that doesn't have it * @param {String[]} history Array of history lines * @returns {String[]} Prefixed history lines */ export function prependSharePrefix(history: string[], shareID: any): string[]; /** * Remove the share prefix to every line that has it * @param {String[]} history Array of history lines * @returns {String[]} Non-prefixed history lines */ export function removeSharePrefix(history: string[]): string[]; } declare module "core/Group" { export = Group; const Group_base: typeof import("core/VaultItem.js"); /** * Group class - contains Entrys * @augments VaultItem * @memberof module:Buttercup */ class Group extends Group_base { static Attribute: Readonly<{ Role: string; }>; /** * Create a new Group instance within a vault and maybe a group * @param {Vault} vault The vault to add the group to * @param {String=} parentID Optional parent group ID. If no * value is specified the group is added to the root of the * vault. * @returns {Group} * @memberof Group * @static */ static createNew(vault: any, parentID?: string | undefined): Group; constructor(vault: any, source: any); /** * The type of the instance * @type {String} * @readonly * @memberof Group */ readonly get type(): string; /** * Create a new entry with a title * @param {String=} title The title of the new entry * @returns {Entry} The new entry * @memberof Group */ createEntry(title?: string | undefined): import("core/Entry.js"); /** * Create a child group * @param {string=} title Optionally set a title * @returns {Group} The new child group * @memberof Group */ createGroup(title?: string | undefined): Group; /** * Delete the group * If there is a trash group available, the group is moved there. If the group * is already in the trash, it is deleted permanently. * @param {Boolean=} skipTrash Skip the trash * @returns {Boolean} True when deleted, false when moved to trash * @memberof Group */ delete(skipTrash?: boolean | undefined): boolean; /** * Delete an attribute * @param {String} attr The name of the attribute * @returns {Group} Returns self * @memberof Group */ deleteAttribute(attr: string): Group; /** * Find an entry by its ID * @param {String} id The ID to search for * @returns {null|Entry} Null if not found, or the Entry instance * @memberof Group */ findEntryByID(id: string): null | import("core/Entry.js"); /** * Find all entries that match a certain property * @name findEntriesByProperty * @param {RegExp|String} property The property to search with * @param {RegExp|String} value The value to search for * @returns {Array.} An array of found extries * @memberof Group */ findEntriesByProperty(property: RegExp | string, value: RegExp | string): Array; /** * Find a group by its ID * @param {String} id The group ID to search for * @returns {Group|null} The group or null if not found * @memberof Group */ findGroupByID(id: string): Group | null; /** * Find groups by their title * @name findGroupsByTitle * @param {String|RegExp} title The group title * @returns {Array.} An array of groups * @memberof Group */ findGroupsByTitle(title: string | RegExp): Array; /** * Get an attribute * @param {String=} attribute The name of the attribute. If none provided * the entire attributes object is returned. * @returns {String|undefined|Object} Returns the attribute or undefined if not found. * If no attribute name is provided an object containing all attributes is returned. * @memberof Group */ getAttribute(attribute?: string | undefined): string | undefined | any; /** * Get the entries within the group * @returns {Array.} An array of entries * @memberof Group */ getEntries(): Array; /** * Get the groups within the group * @returns {Array.} An array of child groups * @memberof Group */ getGroups(): Array; /** * Get the parent group * @returns {Group|null} Returns the parent group instance or null if the parent * is the archive * @throws {Error} Throws if no parent could be found (detached) * @memberof Group */ getParentGroup(): Group | null; /** * Get the group title * @returns {String} The title of the group * @memberof Group */ getTitle(): string; /** * Check if the group is in the trash * @returns {Boolean} Whether or not the group is within the trash group * @memberof Group */ isInTrash(): boolean; /** * Check if the group is used for trash * @returns {Boolean} Whether or not the group is the trash group * @memberof Group */ isTrash(): boolean; /** * Move the group to another group or archive * @param {Group|Vault} target The destination Group or Vault instance * @returns {Group} Self * @memberof Group */ moveTo(target: Group | any): Group; /** * Set an attribute * @param {string} attribute The name of the attribute * @param {string} value The value to set * @returns {Group} Returns self * @memberof Group */ setAttribute(attribute: string, value: string): Group; /** * Set the group title * @param {String} title The title of the group * @returns {Group} Returns self */ setTitle(title: string): Group; } } declare module "core/Vault" { export = Vault; const Vault_base: typeof import("eventemitter3"); /** * Vault class - Contains Groups and Entrys * @augments EventEmitter * @memberof module:Buttercup */ class Vault extends Vault_base { /** * Create a new archive instance from a list of commands (history) * @param {Array.} history The command list * @param {VaultFormat=} format Optional vault format override * @returns {Vault} The vault instance * @static * @memberof Vault */ static createFromHistory(history: Array, format?: any): Vault; /** * Create a Vault with the default template * @returns {Vault} The new vault * @memberof Vault * @static */ static createWithDefaults(): Vault; /** * Create a new Vault instance * @param {VaultFormat=} Format Optional vault format specification. * Will use the default system format (recommended) if not * specified. */ constructor(Format?: any); /** * Object form of the vault - The "dataset" * (do not use directly) * @protected * @memberof Vault */ protected _dataset: {}; /** * The ID of the Vault * @type {String} * @readonly * @memberof Vault */ readonly get id(): string; /** * Whether the Vault is in read-only mode * or not * @type {Boolean} * @readonly * @memberof Vault */ readonly get readOnly(): boolean; /** * The type of the instance * @type {String} * @readonly * @memberof Vault */ readonly get type(): string; format: any; /** * Create a new group * @param {String=} title The title for the group * @returns {Group} The newly created group * @memberof Vault */ createGroup(title?: string | undefined): import("core/Group.js"); /** * Delete an attribute * @param {String} attribute The name of the attribute to delete * @returns {Vault} Self * @memberof Vault */ deleteAttribute(attribute: string): Vault; /** * Remove all entries and groups from the trash (permanent) * - does nothing if no trash group * @returns {Vault} Self * @memberof Vault */ emptyTrash(): Vault; /** * Find an entry by its ID * @param {String} id The ID to search for * @returns {null|Entry} Null if not found, or the Entry instance * @memberof Vault */ findEntryByID(id: string): null | any; /** * Find all entries that match a certain property * @name findEntriesByProperty * @param {RegExp|String} property The property to search with * @param {RegExp|String} value The value to search for * @returns {Array.} An array of found extries * @memberof Vault */ findEntriesByProperty(property: RegExp | string, value: RegExp | string): Array; /** * Find a group by its ID * @param {String} id The group ID to search for * @returns {Group|null} The group or null if not found * @memberof Vault */ findGroupByID(id: string): import("core/Group.js") | null; /** * Find groups by their title * @name findGroupsByTitle * @param {String|RegExp} title The group title * @returns {Array.} An array of groups * @memberof Vault */ findGroupsByTitle(title: string | RegExp): Array; /** * Get the value of an attribute * @param {String=} attributeName The attribute to get * @returns {undefined|String|Object} The value of the attribute or undefined if not * set. Returns an object if no attribute name is given. * @memberof Vault */ getAttribute(attributeName?: string | undefined): undefined | string | any; /** * Get the top-level groups in the vault * @returns {Array.} * @memberof Vault */ getGroups(): Array; /** * Get the trash group * @returns {Group|null} The trash group or null if it doesn't * exist * @memberof Vault */ getTrashGroup(): import("core/Group.js") | null; /** * Set an attribute on the vault * @param {String} attribute The attribute to set * @param {String} value The value to set for the attribute * @returns {Vault} Self * @memberof Vault */ setAttribute(attribute: string, value: string): Vault; } } declare module "credentials/Credentials" { export = Credentials; /** * Secure credentials storage/transfer class * - Allows for the safe transfer of credentials within the * Buttercup application environment. Will not allow * credentials to be shared or transferred outside of the * environment. Credential properties are stored in memory * and are inaccessible to public functions. * @memberof module:Buttercup */ class Credentials { static PURPOSE_DECRYPT_VAULT: string; static PURPOSE_ENCRYPT_VAULT: string; static PURPOSE_SECURE_EXPORT: string; /** * Get all available purposes * @returns {Array.} * @memberof Credentials * @static */ static allPurposes(): Array; /** * Create a new Credentials instance using an existing Credentials * instance - This can be used to reset a credentials's purposes. * @param {Credentials} credentials A credentials instance * @param {String} masterPassword The master password used to * encrypt the instance being cloned * @returns {Credentials} * @memberof Credentials * @static * @throws {Error} Throws if no master password provided * @throws {Error} Throws if master password does not match * original */ static fromCredentials(credentials: Credentials, masterPassword: string): Credentials; /** * Create a new Credentials instance from a Datasource configuration * @param {Object} datasourceConfig The configuration for the * datasource - this usually includes the credential data used for * authenticating against the datasource host platform. * @param {String|null=} masterPassword Optional master password to * store alongside the credentials. Used to create secure strings. * @returns {Credentials} * @memberof Credentials * @static */ static fromDatasource(datasourceConfig: any, masterPassword?: (string | null) | undefined): Credentials; /** * Create a new Credentials instance from a password * - uses the single password value as the master password stored * alongside the original password if no master password is * provided. The master password is used when generating secure * strings. * @param {String} password The password to store * @param {String|null=} masterPassword Optional master password * to store alongside the credentials. Used to create secure * strings. * @returns {Credentials} * @memberof Credentials * @static */ static fromPassword(password: string, masterPassword?: (string | null) | undefined): Credentials; /** * Create a new instance from a secure string * @param {String} content Encrypted content * @param {String} masterPassword The password for decryption * @returns {Promise.} A promise that resolves with the new instance * @static * @memberof Credentials */ static fromSecureString(content: string, masterPassword: string): Promise; /** * Check if a value is an instance of Credentials * @param {*} inst The value to check * @returns {Boolean} * @statuc * @memberof Credentials */ static isCredentials(inst: any): boolean; /** * Create a new Credentials instance * @param {Object=} obj Object data representing some credentials * @param {String|null=} masterPassword Optional master password to store with * the credentials data, which is used for generating secure strings. */ constructor(obj?: any | undefined, masterPassword?: (string | null) | undefined); /** * Restrict the purposes that this set of credentials * can be used for. Once a purpose is removed it can * no longer be added again to the same instance. * @param {Array.} allowedPurposes An array of * new allowed purposes. If a purpose mentioned is * not currently permitted, it will be ignored. * @returns {Credentials} Returns self * @memberof Credentials * @example * credentials.restrictPurposes( * Credentials.PURPOSE_SECURE_EXPORT * ); * // credentials can only be exported to an * // encrypted string, and not used for things * // like encrypting datasource changes. */ restrictPurposes(allowedPurposes: Array): Credentials; /** * Convert the credentials to an encrypted string, for storage * @returns {Promise.} A promise that resolves with the encrypted credentials * @throws {Error} Rejects when masterPassword is not a string * @throws {Error} Rejects if credentials don't permit secure export purposes * @memberof Credentials */ toSecureString(): Promise; } } declare module "tools/vaultManagement" { export function getSourceOfflineArchive(storage: any, sourceID: any): any; export function sourceHasOfflineCopy(storage: any, sourceID: any): any; export function storeSourceOfflineCopy(storage: any, sourceID: any, content: any): any; } declare module "datasources/register" { export type RegisterDatasourcePostProcessorResult = { /** * - Function to call to remove the handler */ remove: Function; }; /** * Convert a Credentials instance to a Datasource * @param {Credentials} credentials A Credentials instance that * contains a datasource configuration * @returns {TextDatasource} * @throws {Error} Throws if no datasource configuration in * credentials * @throws {Error} Throws if no type specified in datasource * configuration * @throws {Error} Throws if no datasource found for type * @private */ export function credentialsToDatasource(credentials: any): any; /** * Execute all datasource postprocessors * @param {TextDatasource} datasource The datasource instance * @private */ export function fireInstantiationHandlers(type: any, datasource: any): void; /** * Register a new datasource * This is called internally by the built-in datasources, but should be called if a * custom datasource is used. * @param {String} datasourceType The name (slug) of the datasource * @param {Object} DSClass The class for the new datasource * @memberof module:Buttercup */ export function registerDatasource(datasourceType: string, DSClass: any): void; /** * @typedef {Object} RegisterDatasourcePostProcessorResult * @property {Function} remove - Function to call to remove the handler */ /** * Register a post-processor for a datasource being instantiated * @param {Function} callback The callback to execute with the instantiated datasource * @returns {RegisterDatasourcePostProcessorResult} The result of the registration * @private */ export function registerDatasourcePostProcessor(callback: Function): RegisterDatasourcePostProcessorResult; } declare module "tools/hash" { export {}; } declare module "myButtercup/Share" { export = Share; class Share { constructor(shareID: any, history: any, permissions?: any[]); _id: any; _history: string[]; _lastHash: any; _dirty: boolean; _permissions: any[]; get id(): any; get permissions(): any[]; applyToArchive(archive: any): void; archiveHasAppliedShare(archive: any): boolean; getPrefixedHistory(): string[]; updateHistory(history: any): boolean; } } declare module "myButtercup/sharing" { export function initialiseShares(workspace: any): any; } declare module "facades/detection" { /** * Check if a string is an OTP URI * @param {String} str The string to check * @returns {Boolean} * @memberof module:Buttercup */ export function isOTPURI(str: string): boolean; /** * Check if an object is a vault facade * @param {Object|*} obj The item to check * @returns {Boolean} True if a vault facade * @memberof module:Buttercup */ export function isVaultFacade(obj: any | any): boolean; } declare module "facades/symbols" { export type FlagSpecification = { /** * The title of the entry type */ title: string; /** * The slug of the entry type */ slug: string; }; /** * Default entry type * @type {String} * @memberof module:Buttercup */ export const DEFAULT_ENTRY_TYPE: string; /** * Default entry field type * @type {String} * @memberof module:Buttercup */ export const DEFAULT_FIELD_TYPE: string; /** * Credit-card entry type * @type {String} * @memberof module:Buttercup */ export const ENTRY_TYPE_CREDITCARD: string; /** * Login (default) entry type * @type {String} * @memberof module:Buttercup */ export const ENTRY_TYPE_LOGIN: string; /** * Note entry type * @type {String} * @memberof module:Buttercup */ export const ENTRY_TYPE_NOTE: string; /** * SSH public/private key-pair entry type * @type {String} * @memberof module:Buttercup */ export const ENTRY_TYPE_SSHKEY: string; /** * Website entry type (includes URL) * @type {String} * @memberof module:Buttercup */ export const ENTRY_TYPE_WEBSITE: string; /** * @typedef {Object} FlagSpecification * @property {String} title The title of the entry type * @property {String} slug The slug of the entry type */ /** * Entry types collection (all available) * @type {Object.} * @memberof module:Buttercup */ export const ENTRY_TYPES: any; export const FACADE_VERSION: 2; /** * Note type entry field value * @type {String} * @memberof module:Buttercup */ export const FIELD_VALUE_TYPE_NOTE: string; /** * OTP (One Time Password) type entry field value * @type {String} * @memberof module:Buttercup */ export const FIELD_VALUE_TYPE_OTP: string; /** * Password type entry field value * @type {String} * @memberof module:Buttercup */ export const FIELD_VALUE_TYPE_PASSWORD: string; /** * Text (default) type entry field value * @type {String} * @memberof module:Buttercup */ export const FIELD_VALUE_TYPE_TEXT: string; /** * Entry field value types collection (all available) * @type {Object.} * @memberof module:Buttercup */ export const FIELD_VALUE_TYPES: any; } declare module "facades/tools" { export type EntryFacadeFieldFormattingSegment = { /** * - A character to match with a regular expression */ char?: RegExp | undefined; /** * - Number of times to repeat the character match (required for `char`) */ repeat?: number | undefined; /** * - The exact character match (operates in opposition to `char`) */ exactly?: string | undefined; }; export type EntryFacadeFieldFormatting = { /** * - The segmented formatting of the value */ format?: Array | undefined; /** * - Optional placeholder for the input (ties in to `format`) */ placeholder?: string | undefined; /** * - Options for a dropdown: either an array of option values or an object * (key:value) of values and titles */ options?: (any | Array) | undefined; /** * - The default option value if none set */ defaultOption?: string | undefined; }; /** * Entry facade data field */ export type EntryFacadeField = { /** * - A randomly generated ID (UUID) for identifying this field during editing */ id: string; /** * - The user-friendly title of the field */ title: string; /** * - The type of data to map back to on the Entry instance (property/attribute) */ propertyType: string; /** * - The property name within the field type of the Entry instance */ property: string; /** * - The value of the property (read/write) */ value: string; /** * - The type of value (rendering) (null for attributes) */ valueType?: string | undefined; /** * - Vendor formatting options object, or false if no formatting necessary */ formatting: EntryFacadeFieldFormatting | boolean; /** * - Whether or not the field can be removed or have its key changed */ removeable: boolean; }; /** * @typedef {Object} EntryFacadeFieldFormattingSegment * @property {RegExp=} char - A character to match with a regular expression * @property {Number=} repeat - Number of times to repeat the character match (required for `char`) * @property {String=} exactly - The exact character match (operates in opposition to `char`) */ /** * @typedef {Object} EntryFacadeFieldFormatting * @property {Array.=} format - The segmented formatting of the value * @property {String=} placeholder - Optional placeholder for the input (ties in to `format`) * @property {Object|Array=} options - Options for a dropdown: either an array of option values or an object * (key:value) of values and titles * @property {String=} defaultOption - The default option value if none set */ /** * Entry facade data field * @typedef {Object} EntryFacadeField * @property {String} id - A randomly generated ID (UUID) for identifying this field during editing * @property {String} title - The user-friendly title of the field * @property {String} propertyType - The type of data to map back to on the Entry instance (property/attribute) * @property {String} property - The property name within the field type of the Entry instance * @property {String} value - The value of the property (read/write) * @property {String=} valueType - The type of value (rendering) (null for attributes) * @property {EntryFacadeFieldFormatting|Boolean} formatting - Vendor formatting options object, or false if no formatting necessary * @property {Boolean} removeable - Whether or not the field can be removed or have its key changed */ /** * Create a descriptor for a field to be used within a facade * @param {Entry|null} entry The entry instance to process or null if the initial value * should be empty * @param {String} title The field title * @param {String} entryPropertyType The type of entry property (property/attribute) * @param {String} entryPropertyName The name of the property * @param {Object} options The options for the field * @returns {EntryFacadeField} The field descriptor * @memberof module:Buttercup */ export function createFieldDescriptor(entry: any | null, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any): EntryFacadeField; /** * Get a value on an entry for a specific property type * @param {Entry} entry The entry instance * @param {String} propertyType The type of entry property (property/attribute) * @param {String} name The property name * @returns {String} The property value * @throws {Error} Throws for unknown property types * @deprecated Not in use - To be removed */ export function getEntryValue(entry: any, propertyType: string, name: string): string; /** * Get the entry value type * @param {Entry|null} entry Entry instance * @param {String} propertyName The entry property name * @returns {String} The entry value type (returns default "text" * if entry not specified) */ export function getEntryValueType(entry: import("core/Entry.js") | null, propertyName: string): string; /** * Check if an ID signifies a new instance and not an * existing one * @param {String|Number} id The ID to check * @returns {Boolean} */ export function idSignifiesNew(id: string | number): boolean; /** * Set the value type attribute of an entry * @param {Entry} entry Entry instance * @param {String} propertyName The property name * @param {String} valueType The value type */ export function setEntryValueType(entry: import("core/Entry.js"), propertyName: string, valueType: string): void; } declare module "facades/entryFields" { const _exports: { [x: string]: typeof createLoginFields; }; export = _exports; function createLoginFields(entry: any): import("facades/tools.js").EntryFacadeField[]; } declare module "facades/entry" { export type EntryHistoryItem = { /** * The property/attribute name */ property: string; /** * Either "property" or "attribute" */ propertyType: string; /** * The original value or null if it did not exist * before this change */ originalValue: string | null; /** * The new value or null if it was deleted */ newValue: string | null; }; /** * Entry facade for data input */ export type EntryFacade = { /** * - The entry ID */ id: string; /** * - The type of the facade */ type: string; /** * - An array of fields */ fields: Array; /** * - The parent group ID */ parentID: string; /** * - Array of changes for all properties of * the entry */ _history: Array; }; export type CreateEntryFacadeOptions = { /** * - Optionally override the created facade type */ type?: string | undefined; }; /** * Process a modified entry facade * @param {Entry} entry The entry to apply processed data on * @param {EntryFacade} facade The facade object * @memberof module:Buttercup */ export function consumeEntryFacade(entry: import("core/Entry.js"), facade: EntryFacade): void; /** * @typedef {Object} CreateEntryFacadeOptions * @property {String=} type - Optionally override the created facade type */ /** * Create a data/input facade for an Entry instance * @param {Entry=} entry The Entry instance * @param {CreateEntryFacadeOptions=} ops Options for the entry facade creation * @returns {EntryFacade} A newly created facade * @memberof module:Buttercup */ export function createEntryFacade(entry?: import("core/Entry.js") | undefined, { type }?: CreateEntryFacadeOptions | undefined): EntryFacade; } declare module "facades/vault" { export type VaultFacade = { /** * - The facade type: "vault" */ type: string; /** * - The vault ID */ id: string; /** * - A key/value list of all the vault attributes */ attributes: any; /** * - An array of group facades */ groups: Array; /** * - An array of entry facades */ entries: Array; /** * - The UUID tag for the generation of the facade */ _tag: string; }; export type GroupFacade = { /** * - The facade type: "group" */ type: string; /** * - The group ID. Will be set to null if * the group is a new one */ id: string | null; /** * - The group title */ title: string; /** * - A key/value list of group attributes */ attributes: any; /** * - The parent group ID. Set to "0" if * it is to be created in the root. */ parentID: string | null; }; /** * Consume a group facade and apply the differences to a group instance * @param {Group} group The group instance to apply to * @param {GroupFacade} facade The facade to apply * @memberof module:Buttercup */ export function consumeGroupFacade(group: any, facade: GroupFacade): void; /** * Consume a vault facade and apply the differences to the vault * instance * @param {Vault} vault The vault instance to apply to * @param {VaultFacade} facade The facade to apply * @memberof module:Buttercup */ export function consumeVaultFacade(vault: any, facade: VaultFacade): void; /** * @typedef {Object} GroupFacade * @property {String} type - The facade type: "group" * @property {String|null} id - The group ID. Will be set to null if * the group is a new one * @property {String} title - The group title * @property {Object} attributes - A key/value list of group attributes * @property {String|null} parentID - The parent group ID. Set to "0" if * it is to be created in the root. */ /** * Create a group facade from a Group instance * @param {Group} group The group instance * @param {String=} parentID The parent ID of the group * @memberof module:Buttercup */ export function createGroupFacade(group: any, parentID?: string | undefined): { type: string; id: any; title: any; attributes: any; parentID: string; }; /** * @typedef {Object} VaultFacade * @property {String} type - The facade type: "vault" * @property {String} id - The vault ID * @property {Object} attributes - A key/value list of all the vault attributes * @property {Array.} groups - An array of group facades * @property {Array.} entries - An array of entry facades * @property {String} _tag - The UUID tag for the generation of the facade */ /** * Create a vault facade from an Vault instance * @param {Vault} vault A vault instance * @returns {VaultFacade} A vault facade * @memberof module:Buttercup */ export function createVaultFacade(vault: any): VaultFacade; } declare module "core/VaultComparator" { export = VaultComparator; /** * Vault comparison class */ class VaultComparator { static calculateHistoryDifferences(historyA: any, historyB: any): boolean | { original: string[]; secondary: string[]; }; /** * Constructor for the vault comparator * @param {Vault} originalVault The primary vault * @param {Vault} secondaryVault The secondary vault */ constructor(originalVault: any, secondaryVault: any); _vaultA: any; _vaultB: any; /** * Calculate the differences, in commands, between the two vaults * @returns {{ original:Array, secondary:Array }|null} Returns null if no common base * is found, or the command differences as two arrays * @memberof VaultComparator */ calculateDifferences(): { original: Array; secondary: Array; } | null; /** * Check if the current vaults differ * @returns {Boolean} True if the vaults are different * @memberof VaultComparator */ vaultsDiffer(): boolean; } } declare module "insight/vault" { export type VaultInsights = { /** * Average password length */ avgPassLen?: number | undefined; /** * Number of entries in the vault */ entries?: number | undefined; /** * Number of groups in the vault */ groups?: number | undefined; /** * Longest password length */ longPassLen?: number | undefined; /** * Shortest password length */ shortPassLen?: number | undefined; /** * Number of entries in trash */ trashEntries?: number | undefined; /** * Number of groups in trash */ trashGroups?: number | undefined; }; export type Insights = { /** * Average password length */ avgPassLen?: number | undefined; /** * Number of entries in the vault */ entries?: number | undefined; /** * Number of groups in the vault */ groups?: number | undefined; /** * Longest password length */ longPassLen?: number | undefined; /** * Shortest password length */ shortPassLen?: number | undefined; /** * Number of entries in trash */ trashEntries?: number | undefined; /** * Number of groups in trash */ trashGroups?: number | undefined; }; /** * @typedef {Object} VaultInsights * @property {Number=} avgPassLen Average password length * @property {Number=} entries Number of entries in the vault * @property {Number=} groups Number of groups in the vault * @property {Number=} longPassLen Longest password length * @property {Number=} shortPassLen Shortest password length * @property {Number=} trashEntries Number of entries in trash * @property {Number=} trashGroups Number of groups in trash */ /** * @typedef {VaultInsights} Insights */ /** * Generate insights for a vault instance * @param {Vault} vault The vault instance * @returns {VaultInsights} * @private */ export function generateVaultInsights(vault: any): VaultInsights; } declare module "core/VaultSource" { export = VaultSource; const VaultSource_base: typeof import("eventemitter3"); /** * Vault source class for managing a single vault * within a vault manager * @augments EventEmitter * @memberof module:Buttercup */ class VaultSource extends VaultSource_base { static STATUS_LOCKED: string; static STATUS_PENDING: string; static STATUS_UNLOCKED: string; /** * Rehydrate the vault source from a dehydrated state * @param {String} dehydratedString The dehydrated form of the vault source * @returns {VaultSource} A rehydrated instance * @memberof VaultSource * @static */ static rehydrate(dehydratedString: string): VaultSource; constructor(name: any, type: any, credentialsString: any, config?: {}); _queue: any; _credentials: any; _status: string; _datasource: any; _vault: any; _shares: any[]; _id: any; _name: any; _type: any; _colour: any; _order: any; _meta: any; _vaultManager: any; set colour(arg: string); /** * Source colour * @type {String} * @memberof VaultSource */ get colour(): string; /** * Source ID * @type {String} * @memberof VaultSource * @readonly */ readonly get id(): string; /** * Meta data * @type {Object} * @memberof VaultSource * @readonly */ readonly get meta(): any; /** * Source name * @type {String} * @memberof VaultSource * @readonly */ readonly get name(): string; /** * Source status * @type {String} * @memberof VaultSource * @readonly */ readonly get status(): string; /** * The datasource type * @type {String} * @memberof VaultSource * @readonly */ readonly get type(): string; /** * Vault reference * @type {Vault|null} * @memberof VaultSource * @readonly */ readonly get vault(): import("core/Vault.js"); /** * Change the master vault password * @param {String} oldPassword The original/current password * @param {String} newPassword The new password to change to * @param {Object=} meta Optional metadata * @returns {Promise} * @memberof VaultSource */ changeMasterPassword(oldPassword: string, newPassword: string, meta?: any | undefined): Promise; /** * Check if the vault source can be updated * @returns {Boolean} * @memberof VaultSource */ canBeUpdated(): boolean; /** * Check if the source has an offline copy * @returns {Promise.} A promise which resolves with whether an offline * copy is available or not * @memberof VaultSource */ checkOfflineCopy(): Promise; dehydrate(): Promise; /** * Get offline content, if it exists * @returns {Promise.} A promise a resolves with the content, or null * if it doesn't exist * @memberof VaultSource */ getOfflineContent(): Promise; /** * Detect whether the local archives (in memory) differ from their remote copies * Fetches the remote copies from their datasources and detects differences between * them and their local counterparts. Does not change/update the local items. * @returns {Promise.} A promise that resolves with a boolean - true if * there are differences, false if there is not * @memberof VaultSource */ localDiffersFromRemote(): Promise; lock(): Promise; /** * Merge remote contents * Detects differences between a local and a remote item, and merges the * two copies together. * @returns {Promise.} A promise that resolves with the newly merged archive - * This archive is automatically saved over the original local copy. * @memberof VaultSource */ mergeFromRemote(): Promise; /** * Save the vault to the remote, ensuring that it's first merged and * updated to prevent conflicts or overwrites. * @returns {Promise} * @memberof VaultSource */ save(): Promise; unlock(vaultCredentials: any, config?: {}): Promise; /** * Update the vault * @returns {Promise} A promise that resolves once the update has * completed * @memberof VaultSource */ update({ skipDiff }?: { skipDiff?: boolean; }): Promise; /** * Write the vault to the remote * - This does not perform any merging or sync checks, but simply * writes the vault contents to the remote, overwriting whatever * was there before. * @returns {Promise} A promise that resolves when saving has completed * @memberof VaultSource */ write(): Promise; _applyShares(): void; _enqueueStateChange(cb: any, stack: any): any; _unloadShares(): void; _updateCredentialsFromDatasource(): Promise; _updateInsights(): Promise; _updateVaultCredentials(newCredentials: any): Promise; /** * Wait for the source to enter a non-pending state * @protected * @returns {Promise} * @memberof VaultSource */ protected _waitNonPending(): Promise; } } declare module "core/VaultManager" { export = VaultManager; const VaultManager_base: typeof import("eventemitter3"); /** * @typedef {Object} VaultManagerOptions * @property {Boolean=} autoUpdate Whether or not to auto update unlocked vaults * @property {Number=} autoUpdateDelay Delay in milliseconds between auto-update * checks * @property {StorageInterface=} cacheStorage Storage adapter for storing * cached vault contents for offline access * @property {StorageInterface=} sourceStorage Storage adapter for storing * managed vault details so that they can be rehydrated upon startup */ /** * Vault manager, to manage vault sources and their vaults * @augments EventEmitter * @memberof module:Buttercup */ class VaultManager extends VaultManager_base { /** * Construct a new VaultManager * @param {VaultManagerOptions=} opts Configuration options */ constructor(opts?: VaultManagerOptions | undefined); _sources: any[]; _cacheStorage: any; _sourceStorage: any; _queue: any; _autoUpdateEnabled: boolean; _autoUpdateDelay: number; _autoUpdateTimer: NodeJS.Timeout; _initialised: boolean; /** * Array of vault sources * @type {VaultSource[]} * @readonly * @memberof VaultManager */ readonly get sources(): import("core/VaultSource.js")[]; /** * Array of unlocked vault sources * @type {VaultSource[]} * @readonly * @memberof VaultManager */ readonly get unlockedSources(): import("core/VaultSource.js")[]; /** * @typedef {Object} AddSourceOptions * @property {Number=} order Optional order override */ /** * Add a VaultSource to the VaultManager * - The vault manager will then provide a management * platform for the source, including storage access and * event aggregation. * @param {VaultSource} source The source to add * @param {AddSourceOptions=} opts Options for adding the * source * @returns {Promise} * @memberof VaultManager */ addSource(source: import("core/VaultSource.js"), opts?: { /** * Optional order override */ order?: number | undefined; }): Promise; /** * Dehydrate all sources and write them to storage * @returns {Promise} A promise that resolves once all sources have been dehydrated * @memberof VaultManager */ dehydrate(): Promise; /** * Dehydrate a single archive source * @param {String} sourceID The ID of the source * @returns {Promise} A promise that resolves once the source has been dehydrated * @memberof VaultManager */ dehydrateSource(sourceOrSourceID: any): Promise; /** * Enqueue an asychronous change of state * @param {Function} cb Callback to enqueue * @returns {Promise} * @memberof VaultManager */ enqueueStateChange(cb: Function): Promise; /** * Get the next viable order number for a new source * @returns {Number} The new order * @memberof VaultManager */ getNextOrder(): number; /** * Get a source for an ID * @param {String} sourceID The source ID * @returns {Vaultsource|null} The source with the matching ID or null if not found * @memberof VaultManager */ getSourceForID(sourceID: string): any | null; /** * Get an array of sources that can be updated * @returns {Array.} * @memberof VaultManager */ getUpdateableSources(): Array; /** * Initialise the vault manager * @memberof VaultManager */ initialise(): void; /** * Wait for and interrupt state changes when auto-update is running * @param {Function} cb The callback to execute during the auto-update interruption * @returns {Promise} A promise that resolves when ready * @memberof ArchiveManager * @example * archiveManager.interruptAutoUpdate(() => { * // Do something with auto-updating paused * }); */ interruptAutoUpdate(cb: Function): Promise; /** * Rehydrate sources from storage * @returns {Promise} A promise that resolves once rehydration has completed * @memberof VaultManager * @throws {VError} Rejects if rehydrating from storage fails */ rehydrate(): Promise; /** * Remove a source from the storage * @param {String} sourceID The ID of the source to remove * @returns {Promise} A promise that resolves once the source has been removed * @memberof VaultManager */ removeSource(sourceID: string): Promise; /** * Reorder a source * @param {String} sourceID The ID of the source to reorder * @param {Number} position The 0-based position to move the source to * @memberof VaultManager * @throws {VError} Throws if no source is found */ reorderSource(sourceID: string, position: number): void; /** * Reorder all sources * @memberof VaultManager */ reorderSources(): void; /** * Toggle auto updating of sources * @param {Boolean=} enable Enable or disable auto updating. Leave empty * to invert the setting * @param {Number=} delay Milliseconds between updates * @memberof VaultManager */ toggleAutoUpdating(enable?: boolean | undefined, delay?: number | undefined): void; _autoUpdateSources(): Promise; _startAutoUpdateTimer(): void; _storeDehydratedSource(id: any, dehydratedSource: any): any; } namespace VaultManager { export { VaultManagerOptions }; } type VaultManagerOptions = { /** * Whether or not to auto update unlocked vaults */ autoUpdate?: boolean | undefined; /** * Delay in milliseconds between auto-update * checks */ autoUpdateDelay?: number | undefined; /** * Storage adapter for storing * cached vault contents for offline access */ cacheStorage?: any; /** * Storage adapter for storing * managed vault details so that they can be rehydrated upon startup */ sourceStorage?: any; }; } declare module "datasources/TextDatasource" { export = TextDatasource; /** * @typedef {Object} LoadedVaultData * @property {VaultFormat} Format The vault format class that was detected * when reading encrypted vault contents * @property {Array.} history Decrypted vault data */ /** * Datasource for text input and output * @memberof module:Buttercup */ class TextDatasource { /** * Constructor for the text datasource * @param {Credentials} credentials The credentials and configuration for * the datasource */ constructor(credentials: import("credentials/Credentials.js")); _credentials: import("credentials/Credentials.js"); _content: string; type: string; /** * Datasource credentials * @type {Credentials} * @readonly */ readonly get credentials(): import("credentials/Credentials.js"); /** * Whether the datasource currently has content * Used to check if the datasource has encrypted content that can be * loaded. May be used when attempting to open a vault in offline mode. * @type {Boolean} * @memberof TextDatasource */ get hasContent(): boolean; /** * Get the ID of the datasource * ID to uniquely identify the datasource and its parameters * @returns {String} A hasn of the datasource (unique ID) * @memberof TextDataSource */ getID(): string; /** * Load from the stored content using a password to decrypt * @param {Credentials} credentials The password or Credentials instance to decrypt with * @returns {Promise.} A promise that resolves with decrypted history * @throws {Error} Rejects if content is empty * @memberof TextDatasource */ load(credentials: import("credentials/Credentials.js")): Promise; /** * Save archive contents with a password * @param {Array.} history Archive history to save * @param {Credentials} credentials The Credentials instance to encrypt with * @returns {Promise.} A promise resolving with the encrypted content * @memberof TextDatasource */ save(vaultCommands: any, credentials: import("credentials/Credentials.js")): Promise; /** * Set the text content * @param {String} content The encrypted text content * @returns {TextDatasource} Self * @memberof TextDatasource */ setContent(content: string): TextDatasource; /** * Whether or not the datasource supports the changing of the master password * @returns {Boolean} True if the datasource supports password changing * @memberof TextDataSource */ supportsPasswordChange(): boolean; /** * Whether or not the datasource supports bypassing remote fetch operations * (offline support) * @returns {Boolean} True if content can be set to bypass fetch operations, * false otherwise * @memberof TextDatasource */ supportsRemoteBypass(): boolean; } namespace TextDatasource { export { LoadedVaultData }; } type LoadedVaultData = { /** * The vault format class that was detected * when reading encrypted vault contents */ Format: any; /** * Decrypted vault data */ history: Array; }; } declare module "datasources/FileDatasource" { export = FileDatasource; const FileDatasource_base: typeof import("datasources/TextDatasource.js"); /** * File datasource for loading and saving files * @augments TextDatasource * @memberof module:Buttercup */ class FileDatasource extends FileDatasource_base { /** * Constructor for the file datasource * @param {Credentials} credentials The credentials instance with which to * use to configure the datasource */ constructor(credentials: any); _filename: any; readFile: any; writeFile: any; /** * The file path * @type {String} * @memberof FileDatasource */ get path(): string; } } declare module "datasources/WebDAVDatasource" { export = WebDAVDatasource; const WebDAVDatasource_base: typeof import("datasources/TextDatasource.js"); /** * WebDAV datasource for reading and writing remote archives * @augments TextDatasource * @memberof module:Buttercup */ class WebDAVDatasource extends WebDAVDatasource_base { /** * Constructor for the datasource * @param {Credentials} credentials Credentials for the datasource */ constructor(credentials: any); _path: any; _client: any; /** * The WebDAV client instance * @type {Object} * @memberof WebDAVDatasource */ get client(): any; /** * The remote archive path * @type {String} * @memberof WebDAVDatasource */ get path(): string; } } declare module "datasources/DropboxDatasource" { export = DropboxDatasource; const DropboxDatasource_base: typeof import("datasources/TextDatasource.js"); /** * Datasource for Dropbox archives * @augments TextDatasource * @memberof module:Buttercup */ class DropboxDatasource extends DropboxDatasource_base { /** * Datasource for Dropbox accounts * @param {Credentials} credentials Credentials instance to configure the * datsource with */ constructor(credentials: any); path: any; token: any; client: any; } } declare module "datasources/DatasourceAuthManager" { export = DatasourceAuthManager; /** * Authentication manager * @augments EventEmitter * @memberof module:Buttercup */ class DatasourceAuthManager { /** * Get the shared DatasourceAuthManager instance * @returns {DatasourceAuthManager} The shared auth manager instance * @static * @memberof DatasourceAuthManager */ static getSharedManager(): DatasourceAuthManager; _handlers: {}; /** * Execute auth handlers for a datasource * @param {String} datasourceType The type of datasource (slug) * @param {TextDatasource} datasourceInst The datasource instance * @returns {Promise} A promise that resolves once execution has completed * @throws {Error} Throws if no handlers have been specified * @memberof DatasourceAuthManager */ executeAuthHandlers(datasourceType: string, datasourceInst: any): Promise; /** * Register an auth handler * @param {String} datasourceType The datasource type * @param {Function} handler The handler function * @example * authManager.registerHandler("googledrive", datasource => { * return renewTokens().then(({ accessToken, refreshToken }) => { * datasource.token = accessToken; * datasource.refreshToken = refreshToken; * }); * }); * @memberof DatasourceAuthManager * @throws {Error} Throws if the handler argument is not a function */ registerHandler(datasourceType: string, handler: Function): void; } } declare module "datasources/GoogleDriveDatasource" { export = GoogleDriveDatasource; const GoogleDriveDatasource_base: typeof import("datasources/TextDatasource.js"); /** * Datasource for Google Drive archives * @augments TextDatasource * @memberof module:Buttercup */ class GoogleDriveDatasource extends GoogleDriveDatasource_base { /** * Datasource for Google Drive connections * @param {Credentials} credentials The credentials instance with which to * configure the datasource with */ constructor(credentials: any); fileID: any; authManager: import("datasources/DatasourceAuthManager.js"); /** * Update the OAuth2 tokens * @param {String} accessToken The access token * @param {String=} refreshToken The refresh token * @memberof GoogleDriveDatasource */ updateTokens(accessToken: string, refreshToken?: string | undefined): void; token: string; refreshToken: string; client: any; } } declare module "myButtercup/symbols" { export const API_INSIGHTS: any; export const API_ORG_USERS: any; export const API_OWN_ARCHIVE: any; export const API_OWN_ARCHIVE_DETAILS: any; export const API_OWN_DIGEST: any; export const API_OWN_ORGS: any; export const API_OWN_PASS_CHANGE: any; export const API_OWN_PASS_CHANGE_VERIFY: any; export const API_SHARES: any; export const OAUTH_AUTHORISE_URI: string; export const OAUTH_REDIRECT_URI: string; export const OAUTH_TOKEN_URI: string; } declare module "myButtercup/MyButtercupClient" { export = MyButtercupClient; const MyButtercupClient_base: typeof import("eventemitter3"); /** * My Buttercup client * @augments EventEmitter * @memberof module:Buttercup */ class MyButtercupClient extends MyButtercupClient_base { /** * Exchange an auth code for tokens * @param {String} authCode OAuth2 auth code, retrieved from browser- * based OAuth2 flow using a user's username and password * @param {String} clientID The OAuth2 client ID * @param {String} clientSecret The OAuth2 client secret * @param {String} redirectURI The OAuth2 client redirect URI * @returns {MyButtercupTokenResult} * @memberof MyButtercupClient * @static */ static exchangeAuthCodeForTokens(authCode: string, clientID: string, clientSecret: string, redirectURI: string): MyButtercupTokenResult; /** * Generate an OAuth2 authorisation URL using the client ID of the current * application platform (eg. Buttercup browser extension) * @param {String} clientID The OAuth2 client ID registered on * my.buttercup.pw * @returns {String} The generated URL * @memberof MyButtercupClient * @static */ static generateAuthorisationURL(clientID: string): string; /** * Create a new client instance * @param {String} clientID The client identifier * @param {String} clientSecret The client secret * @param {String} accessToken Access token * @param {String} refreshToken Refresh token */ constructor(clientID: string, clientSecret: string, accessToken: string, refreshToken: string); _accessToken: string; _refreshToken: string; _lastDigest: any; _clientID: string; _clientSecret: string; request: any; /** * The current access token * @type {String} * @readonly */ readonly get accessToken(): string; /** * The last client digest response * @type {MyButtercupDigest|null} * @readonly */ readonly get digest(): MyButtercupDigest; /** * The refresh token * @type {String} * @readonly */ readonly get refreshToken(): string; changePassword(password: any, passwordToken: any): Promise; /** * Fetch user shares * @param {String[]} ids Share IDs * @returns {Promise.>} * @memberof MyButtercupClient */ fetchShares(ids: string[]): Promise; /** * Fetch user vault contents * @returns {Promise.<{ archive: String, updateID: Number}>} The user's * vault contents * @memberof MyButtercupClient */ fetchUserVault(): Promise<{ archive: string; updateID: number; }>; /** * Fetch the user's vault details * @returns {Promise.} The details of the vault * @memberof MyButtercupClient */ fetchUserVaultDetails(): Promise; /** * Fetch and set account digest information * @returns {Promise.} Digest information * @memberof MyButtercupClient */ retrieveDigest(): Promise; /** * Get the list of users available to address for the user * @returns {Promise.} * @memberof MyButtercupClient */ retrieveUsersList(): Promise; /** * Get the list of users for an organisation * (User must be present in organisation, or this method will fail) * @param {Number} orgID The ID of the organisation * @returns {Promise.} * @memberof MyButtercupClient */ retrieveUsersListForOrganisation(orgID: number): Promise; /** * Test if a password token is valid * @param {String} passwordToken The password change token * @returns {Promise} * @memberof MyButtercupClient */ testPasswordChange(passwordToken: string): Promise; /** * Write insights to the remote account * @param {Insights} insights The insights data * @returns {Promise} * @memberof MyButtercupClient */ writeInsights(insights: any): Promise; /** * Write the user vault contents back to the server * @param {String} contents Encrypted vault contents * @param {Number} previousUpdateID The previous update ID received * from the server * @param {Number} newUpdateID The new update ID to set after a * successful write * @returns {Promise} A promise that resolves once the write has * been completed * @memberof MyButtercupClient */ writeUserArchive(contents: string, previousUpdateID: number, newUpdateID: number): Promise; /** * Handle a request failure (processes token expiration etc.) * @param {Error} err The received error from making a request * @throws {Error} Throws if the error was not catchable * @returns {Promise} Returns a promise if an action can be taken * to remedy the situation * @memberof MyButtercupClient * @protected */ protected _handleRequestFailure(err: Error): Promise; /** * Refresh tokens * @memberof MyButtercupClient * @protected * @returns {Promise} * @fires MyButtercupClient#tokensUpdated */ protected _performTokenRefresh(): Promise; } namespace MyButtercupClient { export { MyButtercupShareBase, MyButtercupIncomingShare, MyButtercupEncryptedShare, MyButtercupOrganisation, MyButtercupDigest, MyButtercupUsersListItem, MyButtercupTokenResult, MyButtercupArchiveDetails }; } type MyButtercupDigest = { /** * The ID of the user's archive */ archive_id: number; /** * The RSA public key for the user */ public_key: string; /** * System messages for the user (internal processing) */ messages: Array; /** * An array of new shares to process */ new_shares: Array; /** * An array of user organisations */ organisations: Array; }; type MyButtercupArchiveDetails = { /** * The remote vault ID */ id: number; /** * The current update ID for the vault */ updateID: number; /** * The creation date */ created: string; /** * The last update date */ lastUpdate: string; }; type MyButtercupUsersListItem = { /** * The ID of the user */ user_id: number; /** * The organisation ID the user was found in */ organisation_id: number; /** * The name of the user */ name: string; /** * The public key for the user */ public_key: string; }; type MyButtercupTokenResult = { /** * An OAuth2 access token for API requests */ accessToken: string; /** * An OAuth2 refresh token */ refreshToken: string; }; type MyButtercupShareBase = { /** * The share ID */ id: string; /** * The share title */ title: string; /** * Permission to read */ perm_read: boolean; /** * Permission to write changes */ perm_write: boolean; /** * Permission to share with others, remove share access etc. */ perm_manage: boolean; }; type MyButtercupIncomingShare = { /** * The share ID */ id: string; /** * The share title */ title: string; /** * Permission to read */ perm_read: boolean; /** * Permission to write changes */ perm_write: boolean; /** * Permission to share with others, remove share access etc. */ perm_manage: boolean; }; type MyButtercupEncryptedShare = { /** * The share ID */ id: string; /** * The share title */ title: string; /** * Permission to read */ perm_read: boolean; /** * Permission to write changes */ perm_write: boolean; /** * Permission to share with others, remove share access etc. */ perm_manage: boolean; }; type MyButtercupOrganisation = { /** * The organisation's ID */ id: number; /** * The organisation name */ name: string; /** * The creation date */ created: string; }; } declare module "myButtercup/update" { /** * Generate a new update ID * @returns {Number} A randomly generated ID */ export function generateNewUpdateID(): number; } declare module "datasources/MyButtercupDatasource" { export = MyButtercupDatasource; const MyButtercupDatasource_base: typeof import("datasources/TextDatasource.js"); /** * My Buttercup datasource * @augments TextDatasource * @memberof module:Buttercup */ class MyButtercupDatasource extends MyButtercupDatasource_base { /** * Constructor for the datasource * @param {Credentials} credentials Credentials for the datasource * @memberof MyButtercupDatasource */ constructor(credentials: import("credentials/Credentials.js")); accessToken: any; refreshToken: any; _clientID: any; _clientSecret: any; _client: import("myButtercup/MyButtercupClient.js"); _vaultID: any; _updateID: number; /** * @type {MyButtercupClient} * @readonly * @memberof MyButtercupDatasource */ readonly get client(): import("myButtercup/MyButtercupClient.js"); /** * Change the master password for the vault * (Called with a preflight check to ensure that the datasource is * ready to change - if not ready, the method will return false) * @param {*} newCredentials * @param {*} preflight * @returns {Promise.} A promise that resolves * with a boolean value during preflight, or with simply undefined * if performing the final change action. * @example * const creds = Credentials.fromPassword("test"); * const isReady = await tds.changePassword( * creds, * true // preflight * ); * if (!isReady) { * throw new Error("Datasource unable to change password"); * } * await tds.changePassword(creds, false); */ changePassword(newCredentials: any, preflight: any): Promise; /** * Override for history difference checking * @see Workspace#localDiffersFromRemote * @param {Credentials} masterCredentials Master service credentials * @param {String[]} archiveHistory Archive history lines * @returns {Promise.} True if differing, false otherwise * @memberof MyButtercupDatasource */ localDiffersFromRemote(masterCredentials: import("credentials/Credentials.js"), archiveHistory: string[]): Promise; /** * Whether or not the datasource supports the changing of the master password * @returns {Boolean} True if it supports changing the master password * @memberof WebDAVDatasource */ supportsChangePassword(): boolean; /** * Update vault/account insights * @param {Insights} insights Insights to update * @returns {Promise} * @memberof MyButtercupDatasource */ updateInsights(insights: any): Promise; /** * Update the OAuth2 tokens * @param {String} accessToken The access token * @param {String} refreshToken The refresh token * @memberof MyButtercupDatasource */ updateTokens(accessToken: string, refreshToken: string, updateClientTokens?: boolean): void; /** * Create a new MyButtercupClient instance and attach * event listeners * @protected * @memberof MyButtercupDatasource * @fires MyButtercupDatasource#updatedClient */ protected _createNewClient(): void; _onTokensUpdated: () => void; } } declare module "tools/vaultSearch" { /** * Find entry instances by filtering with a compare function * @param {Array.} groups The groups to check in * @param {Function} compareFn The callback comparison function, return true to keep and false * to strip * @returns {Array.} An array of found entries */ export function findEntriesByCheck(groups: Array, compareFn: Function): Array; /** * Find group instances within groups that satisfy some check * @param {Array.} groups The groups to check within * @param {Function} compareFn A comparision function - return true to keep, false to strip * @returns {Array.} An array of found groups */ export function findGroupsByCheck(groups: Array, compareFn: Function): Array; /** * Get all entries within a collection of groups * @param {Array.} groups An array of groups * @returns {Array.} An array of entries */ export function getAllEntries(groups: Array): Array; } declare module "search/EntryFinder" { export = EntryFinder; /** * @typedef {Object} EntrySearchInfo * @property {Entry} entry The entry * @property {Archive} archive The associated archive */ /** * Entry searching class */ class EntryFinder { /** * @param {Array.|Archive} target The archive or archives to search */ constructor(target: Array | any); _items: EntrySearchInfo[]; _fuse: Fuse; _lastResult: any[]; /** * All items available for searching * @type {Array.} */ get items(): EntrySearchInfo[]; /** * The last result * @type {Array.} */ get lastResult(): EntrySearchInfo[]; /** * Initialise the searching mechanism */ initSearcher(): void; /** * Search and get results * @param {String} term The search term * @returns {Array.} The results */ search(term: string): Array; } namespace EntryFinder { export { EntrySearchInfo }; } type EntrySearchInfo = { /** * The entry */ entry: any; /** * The associated archive */ archive: any; }; } declare module "index.common" { export const DEFAULT_ENTRY_TYPE: string; export const DEFAULT_FIELD_TYPE: string; export const ENTRY_TYPE_CREDITCARD: string; export const ENTRY_TYPE_LOGIN: string; export const ENTRY_TYPE_NOTE: string; export const ENTRY_TYPE_SSHKEY: string; export const ENTRY_TYPE_WEBSITE: string; export const ENTRY_TYPES: any; export const ENTRY_URL_TYPE_ANY: string; export const ENTRY_URL_TYPE_GENERAL: string; export const ENTRY_URL_TYPE_ICON: string; export const ENTRY_URL_TYPE_LOGIN: string; export const FIELD_VALUE_TYPE_NOTE: string; export const FIELD_VALUE_TYPE_OTP: string; export const FIELD_VALUE_TYPE_PASSWORD: string; export const FIELD_VALUE_TYPE_TEXT: string; export const FIELD_VALUE_TYPES: any; export const VaultManager: typeof import("core/VaultManager.js"); export const VaultSource: typeof import("core/VaultSource.js"); export const Vault: typeof import("core/Vault.js"); export const Group: typeof import("core/Group.js"); export const Entry: typeof import("core/Entry.js"); export const Credentials: typeof import("credentials/Credentials.js"); export const TextDatasource: typeof import("datasources/TextDatasource.js"); export const FileDatasource: typeof import("datasources/FileDatasource.js"); export const WebDAVDatasource: typeof import("datasources/WebDAVDatasource.js"); export const DropboxDatasource: typeof import("datasources/DropboxDatasource.js"); export const GoogleDriveDatasource: typeof import("datasources/GoogleDriveDatasource.js"); export const MyButtercupDatasource: typeof import("datasources/MyButtercupDatasource.js"); export const DatasourceAuthManager: typeof import("datasources/DatasourceAuthManager.js"); export const registerDatasource: (datasourceType: string, DSClass: any) => void; export const MyButtercupClient: typeof import("myButtercup/MyButtercupClient.js"); export const StorageInterface: typeof import("storage/StorageInterface.js"); export const MemoryStorageInterface: typeof import("storage/MemoryStorageInterface.js"); export const EntryFinder: typeof import("search/EntryFinder.js"); export const consumeEntryFacade: (entry: import("core/Entry.js"), facade: import("facades/entry.js").EntryFacade) => void; export const consumeGroupFacade: (group: any, facade: import("facades/vault.js").GroupFacade) => void; export const consumeVaultFacade: (vault: any, facade: import("facades/vault.js").VaultFacade) => void; export const createEntryFacade: (entry?: import("core/Entry.js"), { type }?: import("facades/entry.js").CreateEntryFacadeOptions) => import("facades/entry.js").EntryFacade; export const createFieldDescriptor: (entry: any, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any) => import("facades/tools.js").EntryFacadeField; export const createGroupFacade: (group: any, parentID?: string) => { type: string; id: any; title: any; attributes: any; parentID: string; }; export const createVaultFacade: (vault: any) => import("facades/vault.js").VaultFacade; export const isOTPURI: (str: string) => boolean; export const isVaultFacade: (obj: any) => boolean; export const getSharedAppEnv: () => any; export const getEntryURLs: (properties: any, preference?: any) => any[]; } declare module "env/native/crypto" { export function getCryptoResources(): { "crypto/v1/decryptBuffer": typeof decryptData; "crypto/v1/encryptBuffer": typeof encryptData; "crypto/v1/decryptText": typeof decryptData; "crypto/v1/encryptText": typeof encryptData; "crypto/v1/setDerivationRounds": typeof setDerivationRounds; }; function decryptData(data: any, password: any): Promise; function encryptData(data: any, password: any): Promise; function setDerivationRounds(rounds?: any): void; export {}; } declare module "env/native/compression" { export function getCompressionResources(): { "compression/v1/compressText": typeof compress; "compression/v1/decompressText": typeof decompress; }; /** * Compress text using GZIP * @param {String} text The text to compress * @returns {String} Compressed text */ function compress(text: string): string; /** * Decompress a compressed string (GZIP) * @param {String} text The compressed text * @returns {String} Decompressed text */ function decompress(text: string): string; export {}; } declare module "env/native/net" { export function getNetResources(): { "net/webdav/v1/newClient": any; }; } declare module "env/native/index" { export function applyNativeConfiguration(appEnv: any): void; } declare module "index.node" { const _exports: { DEFAULT_ENTRY_TYPE: string; DEFAULT_FIELD_TYPE: string; ENTRY_TYPE_CREDITCARD: string; ENTRY_TYPE_LOGIN: string; ENTRY_TYPE_NOTE: string; ENTRY_TYPE_SSHKEY: string; ENTRY_TYPE_WEBSITE: string; ENTRY_TYPES: any; ENTRY_URL_TYPE_ANY: string; ENTRY_URL_TYPE_GENERAL: string; ENTRY_URL_TYPE_ICON: string; ENTRY_URL_TYPE_LOGIN: string; FIELD_VALUE_TYPE_NOTE: string; FIELD_VALUE_TYPE_OTP: string; FIELD_VALUE_TYPE_PASSWORD: string; FIELD_VALUE_TYPE_TEXT: string; FIELD_VALUE_TYPES: any; VaultManager: typeof import("core/VaultManager.js"); VaultSource: typeof import("core/VaultSource.js"); Vault: typeof import("core/Vault.js"); Group: typeof import("core/Group.js"); Entry: typeof import("core/Entry.js"); Credentials: typeof import("credentials/Credentials.js"); TextDatasource: typeof import("datasources/TextDatasource.js"); FileDatasource: typeof import("datasources/FileDatasource.js"); WebDAVDatasource: typeof import("datasources/WebDAVDatasource.js"); DropboxDatasource: typeof import("datasources/DropboxDatasource.js"); GoogleDriveDatasource: typeof import("datasources/GoogleDriveDatasource.js"); MyButtercupDatasource: typeof import("datasources/MyButtercupDatasource.js"); DatasourceAuthManager: typeof import("datasources/DatasourceAuthManager.js"); registerDatasource: (datasourceType: string, DSClass: any) => void; MyButtercupClient: typeof import("myButtercup/MyButtercupClient.js"); StorageInterface: typeof import("storage/StorageInterface.js"); MemoryStorageInterface: typeof import("storage/MemoryStorageInterface.js"); EntryFinder: typeof import("search/EntryFinder.js"); consumeEntryFacade: (entry: import("core/Entry.js"), facade: import("facades/entry.js").EntryFacade) => void; consumeGroupFacade: (group: any, facade: import("facades/vault.js").GroupFacade) => void; consumeVaultFacade: (vault: any, facade: import("facades/vault.js").VaultFacade) => void; createEntryFacade: (entry?: import("core/Entry.js"), { type }?: import("facades/entry.js").CreateEntryFacadeOptions) => import("facades/entry.js").EntryFacade; createFieldDescriptor: (entry: any, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any) => import("facades/tools.js").EntryFacadeField; createGroupFacade: (group: any, parentID?: string) => { type: string; id: any; title: any; attributes: any; parentID: string; }; createVaultFacade: (vault: any) => import("facades/vault.js").VaultFacade; isOTPURI: (str: string) => boolean; isVaultFacade: (obj: any) => boolean; getSharedAppEnv: () => any; getEntryURLs: (properties: any, preference?: any) => any[]; } & { init: typeof init; }; export = _exports; /** * Initialise the node/native environment * @memberof module:Buttercup */ function init(): void; } declare module "env/web/crypto" { export function getCryptoResources(): { "crypto/v1/decryptBuffer": typeof decryptData; "crypto/v1/encryptBuffer": typeof encryptData; "crypto/v1/decryptText": typeof decryptData; "crypto/v1/encryptText": typeof encryptData; "crypto/v1/setDerivationRounds": typeof setDerivationRounds; }; function decryptData(data: any, password: any): any; function encryptData(data: any, password: any): any; function setDerivationRounds(rounds?: any): void; export {}; } declare module "env/web/compression" { export function getCompressionResources(): { "compression/v1/compressText": typeof compress; "compression/v1/decompressText": typeof decompress; }; /** * Compress text using GZIP * @param {String} text The text to compress * @returns {String} Compressed text */ function compress(text: string): string; /** * Decompress a compressed string (GZIP) * @param {String} text The compressed text * @returns {String} Decompressed text */ function decompress(text: string): string; export {}; } declare module "env/web/net" { export function getNetResources(): { "net/webdav/v1/newClient": any; }; } declare module "env/web/index" { export function applyWebConfiguration(appEnv: any): void; } declare module "web/LocalStorageInterface" { export = LocalStorageInterface; const LocalStorageInterface_base: typeof import("storage/StorageInterface.js"); /** * Interface for localStorage * @augments StorageInterface */ class LocalStorageInterface extends LocalStorageInterface_base { _storage: Storage; get storage(): Storage; } } declare module "web/index" { export const LocalStorageInterface: typeof import("web/LocalStorageInterface.js"); } declare module "index.web" { const _exports: { DEFAULT_ENTRY_TYPE: string; DEFAULT_FIELD_TYPE: string; ENTRY_TYPE_CREDITCARD: string; ENTRY_TYPE_LOGIN: string; ENTRY_TYPE_NOTE: string; ENTRY_TYPE_SSHKEY: string; ENTRY_TYPE_WEBSITE: string; ENTRY_TYPES: any; ENTRY_URL_TYPE_ANY: string; ENTRY_URL_TYPE_GENERAL: string; ENTRY_URL_TYPE_ICON: string; ENTRY_URL_TYPE_LOGIN: string; FIELD_VALUE_TYPE_NOTE: string; FIELD_VALUE_TYPE_OTP: string; FIELD_VALUE_TYPE_PASSWORD: string; FIELD_VALUE_TYPE_TEXT: string; FIELD_VALUE_TYPES: any; VaultManager: typeof import("core/VaultManager.js"); VaultSource: typeof import("core/VaultSource.js"); Vault: typeof import("core/Vault.js"); Group: typeof import("core/Group.js"); Entry: typeof import("core/Entry.js"); Credentials: typeof import("credentials/Credentials.js"); TextDatasource: typeof import("datasources/TextDatasource.js"); FileDatasource: typeof import("datasources/FileDatasource.js"); WebDAVDatasource: typeof import("datasources/WebDAVDatasource.js"); DropboxDatasource: typeof import("datasources/DropboxDatasource.js"); GoogleDriveDatasource: typeof import("datasources/GoogleDriveDatasource.js"); MyButtercupDatasource: typeof import("datasources/MyButtercupDatasource.js"); DatasourceAuthManager: typeof import("datasources/DatasourceAuthManager.js"); registerDatasource: (datasourceType: string, DSClass: any) => void; MyButtercupClient: typeof import("myButtercup/MyButtercupClient.js"); StorageInterface: typeof import("storage/StorageInterface.js"); MemoryStorageInterface: typeof import("storage/MemoryStorageInterface.js"); EntryFinder: typeof import("search/EntryFinder.js"); consumeEntryFacade: (entry: import("core/Entry.js"), facade: import("facades/entry.js").EntryFacade) => void; consumeGroupFacade: (group: any, facade: import("facades/vault.js").GroupFacade) => void; consumeVaultFacade: (vault: any, facade: import("facades/vault.js").VaultFacade) => void; createEntryFacade: (entry?: import("core/Entry.js"), { type }?: import("facades/entry.js").CreateEntryFacadeOptions) => import("facades/entry.js").EntryFacade; createFieldDescriptor: (entry: any, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any) => import("facades/tools.js").EntryFacadeField; createGroupFacade: (group: any, parentID?: string) => { type: string; id: any; title: any; attributes: any; parentID: string; }; createVaultFacade: (vault: any) => import("facades/vault.js").VaultFacade; isOTPURI: (str: string) => boolean; isVaultFacade: (obj: any) => boolean; getSharedAppEnv: () => any; getEntryURLs: (properties: any, preference?: any) => any[]; } & { LocalStorageInterface: typeof import("web/LocalStorageInterface.js"); } & { init: typeof init; }; export = _exports; /** * Initialise the web environment * @memberof module:Buttercup */ function init(): void; } declare module "test" { export {}; } declare module "facades/hash" { /** * Generate a hash of a vault facade (useful for detecting * if the vault differs from another copy) * @param {VaultFacade} vaultFacade A facade instance * @returns {String} Hash string * @deprecated Poor performance - rely on `VaultFacade#_tag` instead */ export function hashVaultFacade(vaultFacade: any): string; }