1 | declare module "storage/StorageInterface" {
|
2 | export = StorageInterface;
|
3 | /**
|
4 | * Storage Interface (stub only)
|
5 | * @see MemoryStorageInterface
|
6 | * @memberof module:Buttercup
|
7 | */
|
8 | class StorageInterface {
|
9 | /**
|
10 | * Get all keys as an array
|
11 | * @memberof StorageInterface
|
12 | */
|
13 | getAllKeys(): Promise<any[]>;
|
14 | /**
|
15 | * Get a value for a key
|
16 | * @memberof StorageInterface
|
17 | */
|
18 | getValue(): Promise<any>;
|
19 | /**
|
20 | * Remove a value for a key
|
21 | * @memberof StorageInterface
|
22 | */
|
23 | removeKey(): Promise<void>;
|
24 | /**
|
25 | * Set a value for a key
|
26 | * @memberof StorageInterface
|
27 | */
|
28 | setValue(): Promise<void>;
|
29 | }
|
30 | }
|
31 | declare module "storage/MemoryStorageInterface" {
|
32 | export = MemoryStorageInterface;
|
33 | const MemoryStorageInterface_base: typeof import("storage/StorageInterface.js");
|
34 | /**
|
35 | * Storage interface for memory storage
|
36 | * @augments StorageInterface
|
37 | * @memberof module:Buttercup
|
38 | */
|
39 | class MemoryStorageInterface extends MemoryStorageInterface_base {
|
40 | _store: {};
|
41 | }
|
42 | }
|
43 | declare module "env/core/prop" {
|
44 | export function assignObjImmutableProp(obj: any, name: any, method: any): void;
|
45 | }
|
46 | declare module "env/core/appEnv" {
|
47 | export type AppEnv = any;
|
48 | /**
|
49 | * Internal private API
|
50 | */
|
51 | export type AppEnvIntPrv = {
|
52 | /**
|
53 | * Index of set environment properties
|
54 | */
|
55 | properties: any;
|
56 | };
|
57 | export type GetPropertyOptions = {
|
58 | /**
|
59 | * The default value to return (default: null)
|
60 | */
|
61 | defaultValue?: any | undefined;
|
62 | /**
|
63 | * Fail if the property doesn't exist (default: true)
|
64 | */
|
65 | failIfNotExist?: boolean | undefined;
|
66 | };
|
67 | /**
|
68 | * Create a new application environment
|
69 | * @returns {AppEnv}
|
70 | */
|
71 | export function createAppEnv(): AppEnv;
|
72 | }
|
73 | declare module "env/core/global" {
|
74 | export function getGlobal(): (Window & typeof globalThis) | (NodeJS.Global & typeof globalThis);
|
75 | }
|
76 | declare module "env/core/singleton" {
|
77 | /**
|
78 | * Get the shared app-environment configurator
|
79 | * (provides a controller for handling the substitution of
|
80 | * functions that need to work differently on different
|
81 | * environments)
|
82 | * @returns {AppEnv}
|
83 | * @memberof module:Buttercup
|
84 | */
|
85 | export function getSharedAppEnv(): any;
|
86 | }
|
87 | declare module "env/appEnv" {
|
88 | export const getSharedAppEnv: () => any;
|
89 | }
|
90 | declare module "io/VaultFormat" {
|
91 | export = VaultFormat;
|
92 | const VaultFormat_base: typeof import("eventemitter3");
|
93 | class VaultFormat extends VaultFormat_base {
|
94 | static encodeRaw(): void;
|
95 | static extractSharesFromHistory(): void;
|
96 | static isEncrypted(): void;
|
97 | static parseEncrypted(): void;
|
98 | static prepareHistoryForMerge(): void;
|
99 | constructor(source?: {});
|
100 | dirty: boolean;
|
101 | history: any[];
|
102 | _readOnly: boolean;
|
103 | source: any;
|
104 | get readOnly(): boolean;
|
105 | clear(): void;
|
106 | cloneEntry(): void;
|
107 | cloneGroup(): void;
|
108 | createEntry(): void;
|
109 | createGroup(): void;
|
110 | deleteEntry(): void;
|
111 | deleteEntryAttribute(): void;
|
112 | deleteEntryProperty(): void;
|
113 | deleteGroup(): void;
|
114 | deleteGroupAttribute(): void;
|
115 | deleteVaultAttribute(): void;
|
116 | erase(): void;
|
117 | execute(): void;
|
118 | generateID(): void;
|
119 | getFormat(): typeof VaultFormat;
|
120 | initialise(): void;
|
121 | moveEntry(): void;
|
122 | moveGroup(): void;
|
123 | optimise(): void;
|
124 | setEntryAttribute(): void;
|
125 | setEntryProperty(): void;
|
126 | setGroupAttribute(): void;
|
127 | setGroupTitle(): void;
|
128 | setVaultAttribute(): void;
|
129 | }
|
130 | }
|
131 | declare module "tools/rawVaultSearch" {
|
132 | export type FoundGroupResult = {
|
133 | /**
|
134 | * The found group dataset
|
135 | */
|
136 | group: any;
|
137 | /**
|
138 | * The index the group was located at
|
139 | */
|
140 | index: number;
|
141 | };
|
142 | export function findEntryByID(groups: any, id: any): any;
|
143 | export function findGroupByCheck(groups: any, checkFn: any): any;
|
144 | export function findGroupByID(groups: any, id: any): any;
|
145 | export function findGroupByTitle(groups: any, title: any): any;
|
146 | /**
|
147 | * @typedef {Object} FoundGroupResult
|
148 | * @property {Object} group The found group dataset
|
149 | * @property {Number} index The index the group was located at
|
150 | */
|
151 | /**
|
152 | * Find a raw group that contains an entry with an ID
|
153 | * @param {Array.<Object>} groups An array of raw groups
|
154 | * @param {String} id The entry ID to search for
|
155 | * @returns {FoundGroupResult} The parent group of the found entry
|
156 | */
|
157 | export function findGroupContainingEntryID(groups: Array<any>, id: string): FoundGroupResult;
|
158 | /**
|
159 | * Find a raw group that contains a group with an ID
|
160 | * @param {Object} group The group/archive to search in
|
161 | * @param {String} id The group ID to search for
|
162 | * @returns {FoundGroupResult} The parent of the located group ID
|
163 | */
|
164 | export function findGroupContainingGroupID(group: any, id: string): FoundGroupResult;
|
165 | }
|
166 | declare module "tools/uuid" {
|
167 | /**
|
168 | * Generate a UUID (v4)
|
169 | * @returns {String} The new UUID
|
170 | */
|
171 | export function generateUUID(): string;
|
172 | }
|
173 | declare module "tools/encoding" {
|
174 | export const ENCODED_STRING_PREFIX: "utf8+base64:";
|
175 | /**
|
176 | * Decode an encoded property value
|
177 | * @param {String} value The encoded value
|
178 | * @returns {String} The decoded value
|
179 | */
|
180 | export function decodeStringValue(value: string): string;
|
181 | /**
|
182 | * Encode a raw value into safe storage form
|
183 | * Uses base64 for encoding
|
184 | * @param {String} value The raw value to encode
|
185 | * @returns {String} The encoded result
|
186 | */
|
187 | export function encodeStringValue(value: string): string;
|
188 | /**
|
189 | * Get a unique identifier (UUID v4)
|
190 | * @returns {String} A unique identifier
|
191 | */
|
192 | export function getUniqueID(): string;
|
193 | /**
|
194 | * Check if a string value is encoded
|
195 | * @param {String} text The value to check
|
196 | * @returns {Boolean} True if the text is encoded
|
197 | */
|
198 | export function isEncoded(text: string): boolean;
|
199 | }
|
200 | declare module "io/formatA/tools" {
|
201 | export type EntryHistoryItem = {
|
202 | /**
|
203 | * The property/attribute name
|
204 | */
|
205 | property: string;
|
206 | /**
|
207 | * Either "property" or "attribute"
|
208 | */
|
209 | propertyType: string;
|
210 | /**
|
211 | * The original value or null if it did not exist
|
212 | * before this change
|
213 | */
|
214 | originalValue: string | null;
|
215 | /**
|
216 | * The new value or null if it was deleted
|
217 | */
|
218 | newValue: string | null;
|
219 | };
|
220 | export namespace COMMAND_ARGUMENT {
|
221 | export namespace ItemID {
|
222 | export const test: RegExp;
|
223 | export function wrap(txt: any): any;
|
224 | export const encode: boolean;
|
225 | }
|
226 | export namespace ItemIDOrRoot {
|
227 | const test_1: RegExp;
|
228 | export { test_1 as test };
|
229 | export function wrap_1(txt: any): any;
|
230 | export { wrap_1 as wrap };
|
231 | const encode_1: boolean;
|
232 | export { encode_1 as encode };
|
233 | }
|
234 | export namespace StringKey {
|
235 | const test_2: RegExp;
|
236 | export { test_2 as test };
|
237 | export function wrap_2(txt: any): string;
|
238 | export { wrap_2 as wrap };
|
239 | const encode_2: boolean;
|
240 | export { encode_2 as encode };
|
241 | }
|
242 | export namespace StringValue {
|
243 | const test_3: RegExp;
|
244 | export { test_3 as test };
|
245 | export function wrap_3(txt: any): string;
|
246 | export { wrap_3 as wrap };
|
247 | const encode_3: boolean;
|
248 | export { encode_3 as encode };
|
249 | }
|
250 | }
|
251 | export namespace COMMAND_MANIFEST {
|
252 | export namespace ArchiveID {
|
253 | export const s: string;
|
254 | export const d: boolean;
|
255 | export const args: {
|
256 | test: RegExp;
|
257 | wrap: (txt: any) => any;
|
258 | encode: boolean;
|
259 | }[];
|
260 | }
|
261 | export namespace Comment {
|
262 | const s_1: string;
|
263 | export { s_1 as s };
|
264 | const d_1: boolean;
|
265 | export { d_1 as d };
|
266 | const args_1: {
|
267 | test: RegExp;
|
268 | wrap: (txt: any) => string;
|
269 | encode: boolean;
|
270 | }[];
|
271 | export { args_1 as args };
|
272 | }
|
273 | export namespace CreateEntry {
|
274 | const s_2: string;
|
275 | export { s_2 as s };
|
276 | const d_2: boolean;
|
277 | export { d_2 as d };
|
278 | const args_2: {
|
279 | test: RegExp;
|
280 | wrap: (txt: any) => any;
|
281 | encode: boolean;
|
282 | }[];
|
283 | export { args_2 as args };
|
284 | }
|
285 | export namespace CreateGroup {
|
286 | const s_3: string;
|
287 | export { s_3 as s };
|
288 | const d_3: boolean;
|
289 | export { d_3 as d };
|
290 | const args_3: {
|
291 | test: RegExp;
|
292 | wrap: (txt: any) => any;
|
293 | encode: boolean;
|
294 | }[];
|
295 | export { args_3 as args };
|
296 | }
|
297 | export namespace DeleteArchiveAttribute {
|
298 | const s_4: string;
|
299 | export { s_4 as s };
|
300 | const d_4: boolean;
|
301 | export { d_4 as d };
|
302 | const args_4: {
|
303 | test: RegExp;
|
304 | wrap: (txt: any) => string;
|
305 | encode: boolean;
|
306 | }[];
|
307 | export { args_4 as args };
|
308 | }
|
309 | export namespace DeleteEntry {
|
310 | const s_5: string;
|
311 | export { s_5 as s };
|
312 | const d_5: boolean;
|
313 | export { d_5 as d };
|
314 | const args_5: {
|
315 | test: RegExp;
|
316 | wrap: (txt: any) => any;
|
317 | encode: boolean;
|
318 | }[];
|
319 | export { args_5 as args };
|
320 | }
|
321 | export namespace DeleteEntryAttribute {
|
322 | const s_6: string;
|
323 | export { s_6 as s };
|
324 | const d_6: boolean;
|
325 | export { d_6 as d };
|
326 | const args_6: {
|
327 | test: RegExp;
|
328 | wrap: (txt: any) => any;
|
329 | encode: boolean;
|
330 | }[];
|
331 | export { args_6 as args };
|
332 | }
|
333 | export namespace DeleteEntryMeta {
|
334 | const s_7: string;
|
335 | export { s_7 as s };
|
336 | const d_7: boolean;
|
337 | export { d_7 as d };
|
338 | const args_7: {
|
339 | test: RegExp;
|
340 | wrap: (txt: any) => any;
|
341 | encode: boolean;
|
342 | }[];
|
343 | export { args_7 as args };
|
344 | }
|
345 | export namespace DeleteEntryProperty {
|
346 | const s_8: string;
|
347 | export { s_8 as s };
|
348 | const d_8: boolean;
|
349 | export { d_8 as d };
|
350 | const args_8: {
|
351 | test: RegExp;
|
352 | wrap: (txt: any) => any;
|
353 | encode: boolean;
|
354 | }[];
|
355 | export { args_8 as args };
|
356 | }
|
357 | export namespace DeleteGroup {
|
358 | const s_9: string;
|
359 | export { s_9 as s };
|
360 | const d_9: boolean;
|
361 | export { d_9 as d };
|
362 | const args_9: {
|
363 | test: RegExp;
|
364 | wrap: (txt: any) => any;
|
365 | encode: boolean;
|
366 | }[];
|
367 | export { args_9 as args };
|
368 | }
|
369 | export namespace DeleteGroupAttribute {
|
370 | const s_10: string;
|
371 | export { s_10 as s };
|
372 | const d_10: boolean;
|
373 | export { d_10 as d };
|
374 | const args_10: {
|
375 | test: RegExp;
|
376 | wrap: (txt: any) => any;
|
377 | encode: boolean;
|
378 | }[];
|
379 | export { args_10 as args };
|
380 | }
|
381 | export namespace Format {
|
382 | const s_11: string;
|
383 | export { s_11 as s };
|
384 | const d_11: boolean;
|
385 | export { d_11 as d };
|
386 | const args_11: {
|
387 | test: RegExp;
|
388 | wrap: (txt: any) => string;
|
389 | encode: boolean;
|
390 | }[];
|
391 | export { args_11 as args };
|
392 | }
|
393 | export namespace MoveEntry {
|
394 | const s_12: string;
|
395 | export { s_12 as s };
|
396 | const d_12: boolean;
|
397 | export { d_12 as d };
|
398 | const args_12: {
|
399 | test: RegExp;
|
400 | wrap: (txt: any) => any;
|
401 | encode: boolean;
|
402 | }[];
|
403 | export { args_12 as args };
|
404 | }
|
405 | export namespace MoveGroup {
|
406 | const s_13: string;
|
407 | export { s_13 as s };
|
408 | const d_13: boolean;
|
409 | export { d_13 as d };
|
410 | const args_13: {
|
411 | test: RegExp;
|
412 | wrap: (txt: any) => any;
|
413 | encode: boolean;
|
414 | }[];
|
415 | export { args_13 as args };
|
416 | }
|
417 | export namespace Pad {
|
418 | const s_14: string;
|
419 | export { s_14 as s };
|
420 | const d_14: boolean;
|
421 | export { d_14 as d };
|
422 | const args_14: {
|
423 | test: RegExp;
|
424 | wrap: (txt: any) => any;
|
425 | encode: boolean;
|
426 | }[];
|
427 | export { args_14 as args };
|
428 | }
|
429 | export namespace SetArchiveAttribute {
|
430 | const s_15: string;
|
431 | export { s_15 as s };
|
432 | const d_15: boolean;
|
433 | export { d_15 as d };
|
434 | const args_15: {
|
435 | test: RegExp;
|
436 | wrap: (txt: any) => string;
|
437 | encode: boolean;
|
438 | }[];
|
439 | export { args_15 as args };
|
440 | }
|
441 | export namespace SetEntryAttribute {
|
442 | const s_16: string;
|
443 | export { s_16 as s };
|
444 | const d_16: boolean;
|
445 | export { d_16 as d };
|
446 | const args_16: {
|
447 | test: RegExp;
|
448 | wrap: (txt: any) => any;
|
449 | encode: boolean;
|
450 | }[];
|
451 | export { args_16 as args };
|
452 | }
|
453 | export namespace SetEntryMeta {
|
454 | const s_17: string;
|
455 | export { s_17 as s };
|
456 | const d_17: boolean;
|
457 | export { d_17 as d };
|
458 | const args_17: {
|
459 | test: RegExp;
|
460 | wrap: (txt: any) => any;
|
461 | encode: boolean;
|
462 | }[];
|
463 | export { args_17 as args };
|
464 | }
|
465 | export namespace SetEntryProperty {
|
466 | const s_18: string;
|
467 | export { s_18 as s };
|
468 | const d_18: boolean;
|
469 | export { d_18 as d };
|
470 | const args_18: {
|
471 | test: RegExp;
|
472 | wrap: (txt: any) => any;
|
473 | encode: boolean;
|
474 | }[];
|
475 | export { args_18 as args };
|
476 | }
|
477 | export namespace SetGroupAttribute {
|
478 | const s_19: string;
|
479 | export { s_19 as s };
|
480 | const d_19: boolean;
|
481 | export { d_19 as d };
|
482 | const args_19: {
|
483 | test: RegExp;
|
484 | wrap: (txt: any) => any;
|
485 | encode: boolean;
|
486 | }[];
|
487 | export { args_19 as args };
|
488 | }
|
489 | export namespace SetGroupTitle {
|
490 | const s_20: string;
|
491 | export { s_20 as s };
|
492 | const d_20: boolean;
|
493 | export { d_20 as d };
|
494 | const args_20: {
|
495 | test: RegExp;
|
496 | wrap: (txt: any) => any;
|
497 | encode: boolean;
|
498 | }[];
|
499 | export { args_20 as args };
|
500 | }
|
501 | }
|
502 | export class InigoCommand {
|
503 | static Command: {
|
504 | ArchiveID: {
|
505 | s: string;
|
506 | d: boolean;
|
507 | args: {
|
508 | test: RegExp;
|
509 | wrap: (txt: any) => any;
|
510 | encode: boolean;
|
511 | }[];
|
512 | };
|
513 | Comment: {
|
514 | s: string;
|
515 | d: boolean;
|
516 | args: {
|
517 | test: RegExp;
|
518 | wrap: (txt: any) => string;
|
519 | encode: boolean;
|
520 | }[];
|
521 | };
|
522 | CreateEntry: {
|
523 | s: string;
|
524 | d: boolean;
|
525 | args: {
|
526 | test: RegExp;
|
527 | wrap: (txt: any) => any;
|
528 | encode: boolean;
|
529 | }[];
|
530 | };
|
531 | CreateGroup: {
|
532 | s: string;
|
533 | d: boolean;
|
534 | args: {
|
535 | test: RegExp;
|
536 | wrap: (txt: any) => any;
|
537 | encode: boolean;
|
538 | }[];
|
539 | };
|
540 | DeleteArchiveAttribute: {
|
541 | s: string;
|
542 | d: boolean;
|
543 | args: {
|
544 | test: RegExp;
|
545 | wrap: (txt: any) => string;
|
546 | encode: boolean;
|
547 | }[];
|
548 | };
|
549 | DeleteEntry: {
|
550 | s: string;
|
551 | d: boolean;
|
552 | args: {
|
553 | test: RegExp;
|
554 | wrap: (txt: any) => any;
|
555 | encode: boolean;
|
556 | }[];
|
557 | };
|
558 | DeleteEntryAttribute: {
|
559 | s: string;
|
560 | d: boolean;
|
561 | args: {
|
562 | test: RegExp;
|
563 | wrap: (txt: any) => any;
|
564 | encode: boolean;
|
565 | }[];
|
566 | };
|
567 | DeleteEntryMeta: {
|
568 | s: string;
|
569 | d: boolean;
|
570 | args: {
|
571 | test: RegExp;
|
572 | wrap: (txt: any) => any;
|
573 | encode: boolean;
|
574 | }[];
|
575 | };
|
576 | DeleteEntryProperty: {
|
577 | s: string;
|
578 | d: boolean;
|
579 | args: {
|
580 | test: RegExp;
|
581 | wrap: (txt: any) => any;
|
582 | encode: boolean;
|
583 | }[];
|
584 | };
|
585 | DeleteGroup: {
|
586 | s: string;
|
587 | d: boolean;
|
588 | args: {
|
589 | test: RegExp;
|
590 | wrap: (txt: any) => any;
|
591 | encode: boolean;
|
592 | }[];
|
593 | };
|
594 | DeleteGroupAttribute: {
|
595 | s: string;
|
596 | d: boolean;
|
597 | args: {
|
598 | test: RegExp;
|
599 | wrap: (txt: any) => any;
|
600 | encode: boolean;
|
601 | }[];
|
602 | };
|
603 | Format: {
|
604 | s: string;
|
605 | d: boolean;
|
606 | args: {
|
607 | test: RegExp;
|
608 | wrap: (txt: any) => string;
|
609 | encode: boolean;
|
610 | }[];
|
611 | };
|
612 | MoveEntry: {
|
613 | s: string;
|
614 | d: boolean;
|
615 | args: {
|
616 | test: RegExp;
|
617 | wrap: (txt: any) => any;
|
618 | encode: boolean;
|
619 | }[];
|
620 | };
|
621 | MoveGroup: {
|
622 | s: string;
|
623 | d: boolean;
|
624 | args: {
|
625 | test: RegExp;
|
626 | wrap: (txt: any) => any;
|
627 | encode: boolean;
|
628 | }[];
|
629 | };
|
630 | Pad: {
|
631 | s: string;
|
632 | d: boolean;
|
633 | args: {
|
634 | test: RegExp;
|
635 | wrap: (txt: any) => any;
|
636 | encode: boolean;
|
637 | }[];
|
638 | };
|
639 | SetArchiveAttribute: {
|
640 | s: string;
|
641 | d: boolean;
|
642 | args: {
|
643 | test: RegExp;
|
644 | wrap: (txt: any) => string;
|
645 | encode: boolean;
|
646 | }[];
|
647 | };
|
648 | SetEntryAttribute: {
|
649 | s: string;
|
650 | d: boolean;
|
651 | args: {
|
652 | test: RegExp;
|
653 | wrap: (txt: any) => any;
|
654 | encode: boolean;
|
655 | }[];
|
656 | };
|
657 | SetEntryMeta: {
|
658 | s: string;
|
659 | d: boolean;
|
660 | args: {
|
661 | test: RegExp;
|
662 | wrap: (txt: any) => any;
|
663 | encode: boolean;
|
664 | }[];
|
665 | };
|
666 | SetEntryProperty: {
|
667 | s: string;
|
668 | d: boolean;
|
669 | args: {
|
670 | test: RegExp;
|
671 | wrap: (txt: any) => any;
|
672 | encode: boolean;
|
673 | }[];
|
674 | };
|
675 | SetGroupAttribute: {
|
676 | s: string;
|
677 | d: boolean;
|
678 | args: {
|
679 | test: RegExp;
|
680 | wrap: (txt: any) => any;
|
681 | encode: boolean;
|
682 | }[];
|
683 | };
|
684 | SetGroupTitle: {
|
685 | s: string;
|
686 | d: boolean;
|
687 | args: {
|
688 | test: RegExp;
|
689 | wrap: (txt: any) => any;
|
690 | encode: boolean;
|
691 | }[];
|
692 | };
|
693 | };
|
694 | static create(cmd: any): InigoCommand;
|
695 | static generatePaddingCommand(): string;
|
696 | constructor(cmdKey: any);
|
697 | _commandKey: any;
|
698 | _commandArgs: any[];
|
699 | addArgument(arg: any): InigoCommand;
|
700 | generateCommand(): string;
|
701 | }
|
702 | /**
|
703 | * Extract command components from a string
|
704 | * @param {String} command The command to extract from
|
705 | * String[]} The separated parts
{ |
706 | */
|
707 | export function extractCommandComponents(cmd: any): string[];
|
708 | /**
|
709 | * @typedef {Object} EntryHistoryItem
|
710 | * @property {String} property The property/attribute name
|
711 | * @property {String} propertyType Either "property" or "attribute"
|
712 | * @property {String|null} originalValue The original value or null if it did not exist
|
713 | * before this change
|
714 | * @property {String|null} newValue The new value or null if it was deleted
|
715 | */
|
716 | /**
|
717 | * Generate a new entry history item
|
718 | * @param {String} property The property/attribute name
|
719 | * @param {String} propertyType Either "property" or "attribute"
|
720 | * @param {String|null} originalValue The original value or null if it did not exist
|
721 | * before this change
|
722 | * @param {String|null} newValue The new value or null if it was deleted
|
723 | * @returns {EntryHistoryItem}
|
724 | */
|
725 | export function generateEntryHistoryItem(property: string, propertyType: string, originalValue?: string | null, newValue?: string | null): EntryHistoryItem;
|
726 | export function historyArrayToString(historyArray: any): any;
|
727 | export function historyStringToArray(historyString: any): any;
|
728 | /**
|
729 | * Strip destructive commands from a history collection
|
730 | * @param {Array.<String>} history The history
|
731 | * @returns {Array.<String>} The history minus any destructive commands
|
732 | */
|
733 | export function stripDestructiveCommands(history: Array<string>): Array<string>;
|
734 | }
|
735 | declare module "io/formatA/commands" {
|
736 | export function executeArchiveID(vault: any, opts: any, id: any): void;
|
737 | export function executeComment(): void;
|
738 | export function executeCreateEntry(archive: any, opts: any, groupID: any, entryID: any): void;
|
739 | export function executeCreateGroup(archive: any, opts: any, parentID: any, newID: any): void;
|
740 | export function executeDeleteArchiveAttribute(archive: any, opts: any, attribute: any): void;
|
741 | export function executeDeleteEntry(archive: any, opts: any, entryID: any): void;
|
742 | export function executeDeleteEntryAttribute(archive: any, opts: any, entryID: any, attribute: any): void;
|
743 | export function executeDeleteEntryProperty(archive: any, opts: any, entryID: any, property: any): void;
|
744 | export function executeDeleteGroup(archive: any, opts: any, groupID: any): void;
|
745 | export function executeDeleteGroupAttribute(archive: any, opts: any, groupID: any, attribute: any): void;
|
746 | export function executeFormat(archive: any, opts: any, format: any): void;
|
747 | export function executeMoveEntry(archive: any, opts: any, entryID: any, groupID: any): void;
|
748 | export function executeMoveGroup(archive: any, opts: any, groupID: any, targetGroupID: any): void;
|
749 | export function executePad(): void;
|
750 | export function executeSetArchiveAttribute(archive: any, opts: any, attribute: any, value: any): void;
|
751 | export function executeSetEntryAttribute(archive: any, opts: any, entryID: any, attribute: any, value: any): void;
|
752 | export function executeSetEntryProperty(archive: any, opts: any, entryID: any, property: any, value: any): void;
|
753 | export function executeSetGroupAttribute(archive: any, opts: any, groupID: any, attribute: any, value: any): void;
|
754 | export function executeTitleGroup(archive: any, opts: any, groupID: any, title: any): void;
|
755 | }
|
756 | declare module "io/formatA/describe" {
|
757 | /**
|
758 | * Describe a vault dataset - to history commands
|
759 | * @param {Object} dataset The vault dataset
|
760 | * @param {String} parentGroupID The ID of the parent group
|
761 | * @returns {Array.<String>} An array of commands
|
762 | */
|
763 | export function describeVaultDataset(dataset: any, parentGroupID: string): Array<string>;
|
764 | }
|
765 | declare module "io/formatA/Flattener" {
|
766 | export = Flattener;
|
767 | /**
|
768 | * Flattener class for flattening archive history sets
|
769 | */
|
770 | class Flattener {
|
771 | /**
|
772 | * Minimum history lines before flattening can occur
|
773 | * @type {Number}
|
774 | * @static
|
775 | * @memberof Flattener
|
776 | */
|
777 | static FLATTENING_MIN_LINES: number;
|
778 | /**
|
779 | * Number of lines to preserve (most recent)
|
780 | * @type {Number}
|
781 | * @static
|
782 | * @memberof Flattener
|
783 | */
|
784 | static PRESERVE_LINES: number;
|
785 | constructor(format: any);
|
786 | format: any;
|
787 | /**
|
788 | * Check if the dataset can be flattened
|
789 | * @returns {Boolean} True if it can be flattened
|
790 | * Flattener
|
791 | */
|
792 | canBeFlattened(): boolean;
|
793 | /**
|
794 | * Flatten a dataset
|
795 | * @param {Boolean=} force Force flattening even if it is detected to be unnecessary
|
796 | * @returns {Boolean} True if flattening occurred, false otherwise
|
797 | * @memberof Flattener
|
798 | */
|
799 | flatten(force?: boolean | undefined): boolean;
|
800 | }
|
801 | }
|
802 | declare module "io/formatA/signing" {
|
803 | /**
|
804 | * Get the current format
|
805 | * @returns {String} The format
|
806 | */
|
807 | export function getFormat(): string;
|
808 | /**
|
809 | * Get the current signature
|
810 | * @returns {String} The signature
|
811 | */
|
812 | export function getSignature(): string;
|
813 | /**
|
814 | * Detect if a string has a valid signature
|
815 | * @param {String} text The text to check
|
816 | * @returns {Boolean} True if a valid signature is detected
|
817 | */
|
818 | export function hasValidSignature(text: string): boolean;
|
819 | /**
|
820 | * Sign some text
|
821 | * @param {String} text The text to sign
|
822 | * @returns {String} The signed text
|
823 | */
|
824 | export function sign(text: string): string;
|
825 | /**
|
826 | * Strip the signature from some text
|
827 | * @param {String} text The text to strip the signature from
|
828 | * @returns {String} The text with the signature removed
|
829 | */
|
830 | export function stripSignature(text: string): string;
|
831 | /**
|
832 | * Check if vault contents are in encrypted form
|
833 | * @param {String} contents The vault contents
|
834 | * @returns {Boolean} True if encrypted, false otherwise
|
835 | */
|
836 | export function vaultContentsEncrypted(contents: string): boolean;
|
837 | }
|
838 | declare module "credentials/channel" {
|
839 | export function credentialsAllowsPurpose(id: any, purpose: any): any;
|
840 | export function getCredentials(id: any): any;
|
841 | export function removeCredentials(id: any): void;
|
842 | export function setCredentials(id: any, value: any): void;
|
843 | }
|
844 | declare module "io/VaultFormatA" {
|
845 | export = VaultFormatA;
|
846 | const VaultFormatA_base: typeof import("io/VaultFormat.js");
|
847 | class VaultFormatA extends VaultFormatA_base {
|
848 | static encodeRaw(rawContent: any, credentials: any): Promise<string>;
|
849 | /**
|
850 | * Extract shares from a history collection
|
851 | * @param {String[]} history A history collection, containing shares
|
852 | * @returns {Object} The resulting separated histories. The object will
|
853 | * always contain a `base` property containing the non-share history.
|
854 | * Each share detected is set on the object under its share ID - being
|
855 | * set to an array of history lines (non-prefixed) for that share.
|
856 | */
|
857 | static extractSharesFromHistory(history: string[]): any;
|
858 | static isEncrypted(contents: any): boolean;
|
859 | static parseEncrypted(encryptedContent: any, credentials: any): Promise<string[]>;
|
860 | static prepareHistoryForMerge(history: any): string[];
|
861 | constructor(source?: {});
|
862 | _executeCommand(command: any): void;
|
863 | _pad(): void;
|
864 | _processCommandParameters(commandKey: any, parameters: any): any;
|
865 | }
|
866 | }
|
867 | declare module "io/formatRouter" {
|
868 | export function detectFormat(encryptedContent: any): typeof import("io/VaultFormatA.js");
|
869 | export function getDefaultFormat(): typeof import("io/VaultFormatA.js");
|
870 | }
|
871 | declare module "search/groups" {
|
872 | export function findGroupByID(parentGroups: any, groupID: any): any;
|
873 | export function findGroupsByTitle(parentGroups: any, title: any): any[];
|
874 | }
|
875 | declare module "search/entries" {
|
876 | export function findEntriesByProperty(parentGroups: any, property: any, value: any): any[];
|
877 | export function findEntryByID(parentGroups: any, id: any): any;
|
878 | }
|
879 | declare module "tools/permissions" {
|
880 | export const PERM_MANAGE: "archive/member/manage";
|
881 | export const PERM_READ: "archive/member/read";
|
882 | export const PERM_WRITE: "archive/member/write";
|
883 | }
|
884 | declare module "core/VaultItem" {
|
885 | export = VaultItem;
|
886 | /**
|
887 | * Base vault member class (for Entry, Group etc.)
|
888 | */
|
889 | class VaultItem {
|
890 | /**
|
891 | * Constructor for the vault member base class
|
892 | * @param {Vault} vault Vault reference
|
893 | * @param {Object} source Remote source object reference
|
894 | */
|
895 | constructor(vault: any, source: any);
|
896 | /**
|
897 | * Reference to the containing vault
|
898 | * @protected
|
899 | * @memberof VaultItem
|
900 | */
|
901 | protected _vault: any;
|
902 | _source: any;
|
903 | /**
|
904 | * The ID of the entry or group
|
905 | * @readonly
|
906 | * @type {String}
|
907 | * VaultItem
|
908 | */
|
909 | readonly get id(): string;
|
910 | /**
|
911 | * The current granted permissions
|
912 | * @type {Array.<String>}
|
913 | * @memberof VaultItem
|
914 | */
|
915 | get permissions(): string[];
|
916 | /**
|
917 | * The vault this item belongs to
|
918 | * @readonly
|
919 | * @type {Vault}
|
920 | * @memberof VaultItem
|
921 | */
|
922 | readonly get vault(): any;
|
923 | /**
|
924 | * Grant a new permission to the member
|
925 | * @param {String} perm The permission to grant
|
926 | * @memberof VaultItem
|
927 | */
|
928 | grantPermission(perm: string): void;
|
929 | /**
|
930 | * Check if the member has a permission
|
931 | * @param {String} perm The permission to check for
|
932 | * @returns {Boolean}
|
933 | * @memberof VaultItem
|
934 | */
|
935 | hasPermission(perm: string): boolean;
|
936 | /**
|
937 | * Revoke all permissions
|
938 | * @memberof VaultItem
|
939 | */
|
940 | revokeAllPermissions(): void;
|
941 | /**
|
942 | * Revoke a single permission
|
943 | * @param {String} perm The permission to revoke
|
944 | * @memberof VaultItem
|
945 | */
|
946 | revokePermission(perm: string): void;
|
947 | /**
|
948 | * Clean up all of the data in the vault item
|
949 | * @protected
|
950 | * @memberof VaultItem
|
951 | */
|
952 | protected _cleanUp(): void;
|
953 | }
|
954 | }
|
955 | declare module "tools/polyfill" {
|
956 | export function objectValues(obj: any): any[];
|
957 | }
|
958 | declare module "tools/entry" {
|
959 | export const ENTRY_URL_TYPE_ANY: "any";
|
960 | export const ENTRY_URL_TYPE_GENERAL: "general";
|
961 | export const ENTRY_URL_TYPE_ICON: "icon";
|
962 | export const ENTRY_URL_TYPE_LOGIN: "login";
|
963 | /**
|
964 | * Get URLs from an entry's properties
|
965 | * Allows for preferential sorting
|
966 | * @param {Object} properties The entry properties
|
967 | * @param {*} preference
|
968 | */
|
969 | export function getEntryURLs(properties: any, preference?: any): any[];
|
970 | /**
|
971 | * Check if a property name is valid
|
972 | * @param {String} name The name to check
|
973 | * @returns {Boolean} True if the name is valid
|
974 | */
|
975 | export function isValidProperty(name: string): boolean;
|
976 | }
|
977 | declare module "core/Entry" {
|
978 | export = Entry;
|
979 | const Entry_base: typeof import("core/VaultItem.js");
|
980 | /**
|
981 | * Entry class - some secret item, login or perhaps
|
982 | * even a credit card
|
983 | * @augments VaultItem
|
984 | * @memberof module:Buttercup
|
985 | */
|
986 | class Entry extends Entry_base {
|
987 | static Attributes: Readonly<{
|
988 | FacadeType: string;
|
989 | FieldTypePrefix: string;
|
990 | }>;
|
991 | /**
|
992 | * Create a new Entry instance within a vault
|
993 | * and group
|
994 | * @param {Vault} vault The target vault instance
|
995 | * @param {String} parentGroupID The target group to
|
996 | * create the entry in (cannot be vault-level)
|
997 | * @returns {Entry}
|
998 | * @memberof Entry
|
999 | * @static
|
1000 | */
|
1001 | static createNew(vault: any, parentGroupID: string): Entry;
|
1002 | constructor(vault: any, source: any);
|
1003 | /**
|
1004 | * Get the instance type
|
1005 | * @type {String}
|
1006 | *
|
1007 | * Entry
|
1008 | */
|
1009 | readonly get type(): string;
|
1010 | /**
|
1011 | * Delete the entry - either trashes the entry, or removes it completely.
|
1012 | * If the entry is in the trash already, it is removed (including if there is no
|
1013 | * trash group). If the entry is in a normal group and a trash group exists, it
|
1014 | * is moved there instead of being deleted.
|
1015 | * @param {Boolean=} skipTrash Skip the trash and force-delete the entry
|
1016 | * @see moveToGroup
|
1017 | * @see Vault.getTrashGroup
|
1018 | * @returns {Boolean} Whether or not the item was deleted
|
1019 | * @memberof Entry
|
1020 | */
|
1021 | delete(skipTrash?: boolean | undefined): boolean;
|
1022 | /**
|
1023 | * Delete an attribute
|
1024 | * @param {String} attribute The attribute name
|
1025 | * @throws {Error} Throws if the attribute doesn't exist, or cannot be deleted
|
1026 | * @memberof Entry
|
1027 | * @returns {Entry} Self
|
1028 | */
|
1029 | deleteAttribute(attribute: string): Entry;
|
1030 | /**
|
1031 | * Delete a property
|
1032 | * @throws {Error} Throws if property doesn't exist, or cannot be deleted
|
1033 | * @param {String} property The property to delete
|
1034 | * @memberof Entry
|
1035 | * @returns {Entry} Self
|
1036 | */
|
1037 | deleteProperty(property: string): Entry;
|
1038 | /**
|
1039 | * Get an attribute
|
1040 | * If no attribute name is specified, an object with all attributes and their
|
1041 | * values is returned.
|
1042 | * @param {String=} attribute The name of the attribute to fetch
|
1043 | * @returns {String|undefined|Object} The attribute value or an object
|
1044 | * containing all attribute keys and their values if no attribute name
|
1045 | * is provided
|
1046 | * @memberof Entry
|
1047 | */
|
1048 | getAttribute(attribute?: string | undefined): string | undefined | any;
|
1049 | /**
|
1050 | * Get an array of all history changes made to the entry
|
1051 | * @returns {Array.<EntryHistoryItem>}
|
1052 | * @memberof Entry
|
1053 | */
|
1054 | getChanges(): Array<any>;
|
1055 | /**
|
1056 | * Get the containing group for the entry
|
1057 | * @returns {Group|null} The parent group
|
1058 | * @memberof Entry
|
1059 | * @throws {Error} Throws if no parent group found
|
1060 | */
|
1061 | getGroup(): import("core/Group.js") | null;
|
1062 | /**
|
1063 | * Get a property value
|
1064 | * If no property name is specified, an object with all properties and their
|
1065 | * values is returned.
|
1066 | * @param {String=} property The name of the property to fetch
|
1067 | * @returns {String|undefined|Object} The property value or an object with all
|
1068 | * values if no property specified
|
1069 | * @memberof Entry
|
1070 | */
|
1071 | getProperty(property?: string | undefined): string | undefined | any;
|
1072 | /**
|
1073 | * Get property values via RegExp expressions.
|
1074 | * If no property expression is specified, it returns the empty behavior of
|
1075 | * {@see Entry.getProperty}.
|
1076 | * @param {RegExp|String} propertyExpression
|
1077 | * @returns {Object} A key-value object of the matching properties
|
1078 | * @memberof Entry
|
1079 | */
|
1080 | getProperties(propertyExpression: RegExp | string): any;
|
1081 | /**
|
1082 | * Get an array of URLs from the Entry
|
1083 | * Returns an array of detected URL values in the Entry's properties. The
|
1084 | * types of URLs can be configured by providing a preference:
|
1085 | * - "general" - General URLs (of any type, preferring "URL" named props)
|
1086 | * - "login" - Prefer URLs whose key has "login" in it
|
1087 | * - "icon" - Return only icon-like URLs
|
1088 | * - "any" - Return all found URLs
|
1089 | * @param {String=} urlTypePreference The URL type preference
|
1090 | * @returns {Array.<String>} An array of URLs
|
1091 | * @memberof Entry
|
1092 | */
|
1093 | getURLs(urlTypePreference?: string | undefined): Array<string>;
|
1094 | /**
|
1095 | * Check if the entry is in the trash
|
1096 | * @returns {Boolean} Whether or not the entry is in the trash
|
1097 | * @memberof Entry
|
1098 | */
|
1099 | isInTrash(): boolean;
|
1100 | /**
|
1101 | * Move the entry to another group
|
1102 | * @params {Group} group The target group
|
1103 | * @returns {Entry} Returns self
|
1104 | * @param {Group} group The target group
|
1105 | * @memberof Entry
|
1106 | */
|
1107 | moveToGroup(group: any): Entry;
|
1108 | /**
|
1109 | * Set an attribute on the entry
|
1110 | * @param {String} attribute The name of the attribute
|
1111 | * @param {String} value The value to set
|
1112 | * @returns {Entry} Returns self
|
1113 | * @memberof Entry
|
1114 | */
|
1115 | setAttribute(attribute: string, value: string): Entry;
|
1116 | /**
|
1117 | * Set a property on the entry
|
1118 | * @param {String} property The property name
|
1119 | * @param {String=} value The property value
|
1120 | * @returns {Entry} Returns self
|
1121 | * @memberof Entry
|
1122 | */
|
1123 | setProperty(property: string, value?: string | undefined): Entry;
|
1124 | }
|
1125 | }
|
1126 | declare module "tools/sharing" {
|
1127 | export function mergeHistories(initial: any, incoming: any): void;
|
1128 | /**
|
1129 | * Move a group between archives
|
1130 | * @param {Group} movingGroup The group to move
|
1131 | * @param {Group|Vault} targetGroup The group to move to
|
1132 | * @throws {Error} Throws if the remote type is not recognised
|
1133 | */
|
1134 | export function moveGroupBetweenVaults(movingGroup: any, targetGroup: any | any): void;
|
1135 | /**
|
1136 | * Prepend the share prefix to every line that doesn't have it
|
1137 | * @param {String[]} history Array of history lines
|
1138 | * @returns {String[]} Prefixed history lines
|
1139 | */
|
1140 | export function prependSharePrefix(history: string[], shareID: any): string[];
|
1141 | /**
|
1142 | * Remove the share prefix to every line that has it
|
1143 | * @param {String[]} history Array of history lines
|
1144 | * @returns {String[]} Non-prefixed history lines
|
1145 | */
|
1146 | export function removeSharePrefix(history: string[]): string[];
|
1147 | }
|
1148 | declare module "core/Group" {
|
1149 | export = Group;
|
1150 | const Group_base: typeof import("core/VaultItem.js");
|
1151 | /**
|
1152 | * Group class - contains Entrys
|
1153 | * @augments VaultItem
|
1154 | * @memberof module:Buttercup
|
1155 | */
|
1156 | class Group extends Group_base {
|
1157 | static Attribute: Readonly<{
|
1158 | Role: string;
|
1159 | }>;
|
1160 | /**
|
1161 | * Create a new Group instance within a vault and maybe a group
|
1162 | * @param {Vault} vault The vault to add the group to
|
1163 | * @param {String=} parentID Optional parent group ID. If no
|
1164 | * value is specified the group is added to the root of the
|
1165 | * vault.
|
1166 | * @returns {Group}
|
1167 | * @memberof Group
|
1168 | * @static
|
1169 | */
|
1170 | static createNew(vault: any, parentID?: string | undefined): Group;
|
1171 | constructor(vault: any, source: any);
|
1172 | /**
|
1173 | * The type of the instance
|
1174 | * @type {String}
|
1175 | *
|
1176 | * Group
|
1177 | */
|
1178 | readonly get type(): string;
|
1179 | /**
|
1180 | * Create a new entry with a title
|
1181 | * @param {String=} title The title of the new entry
|
1182 | * @returns {Entry} The new entry
|
1183 | * @memberof Group
|
1184 | */
|
1185 | createEntry(title?: string | undefined): import("core/Entry.js");
|
1186 | /**
|
1187 | * Create a child group
|
1188 | * @param {string=} title Optionally set a title
|
1189 | * @returns {Group} The new child group
|
1190 | * @memberof Group
|
1191 | */
|
1192 | createGroup(title?: string | undefined): Group;
|
1193 | /**
|
1194 | * Delete the group
|
1195 | * If there is a trash group available, the group is moved there. If the group
|
1196 | * is already in the trash, it is deleted permanently.
|
1197 | * @param {Boolean=} skipTrash Skip the trash
|
1198 | * @returns {Boolean} True when deleted, false when moved to trash
|
1199 | * @memberof Group
|
1200 | */
|
1201 | delete(skipTrash?: boolean | undefined): boolean;
|
1202 | /**
|
1203 | * Delete an attribute
|
1204 | * @param {String} attr The name of the attribute
|
1205 | * @returns {Group} Returns self
|
1206 | * @memberof Group
|
1207 | */
|
1208 | deleteAttribute(attr: string): Group;
|
1209 | /**
|
1210 | * Find an entry by its ID
|
1211 | * @param {String} id The ID to search for
|
1212 | * @returns {null|Entry} Null if not found, or the Entry instance
|
1213 | * @memberof Group
|
1214 | */
|
1215 | findEntryByID(id: string): null | import("core/Entry.js");
|
1216 | /**
|
1217 | * Find all entries that match a certain property
|
1218 | * @name findEntriesByProperty
|
1219 | * @param {RegExp|String} property The property to search with
|
1220 | * @param {RegExp|String} value The value to search for
|
1221 | * @returns {Array.<Entry>} An array of found extries
|
1222 | * @memberof Group
|
1223 | */
|
1224 | findEntriesByProperty(property: RegExp | string, value: RegExp | string): Array<import("core/Entry.js")>;
|
1225 | /**
|
1226 | * Find a group by its ID
|
1227 | * @param {String} id The group ID to search for
|
1228 | * @returns {Group|null} The group or null if not found
|
1229 | * @memberof Group
|
1230 | */
|
1231 | findGroupByID(id: string): Group | null;
|
1232 | /**
|
1233 | * Find groups by their title
|
1234 | * @name findGroupsByTitle
|
1235 | * @param {String|RegExp} title The group title
|
1236 | * @returns {Array.<Group>} An array of groups
|
1237 | * @memberof Group
|
1238 | */
|
1239 | findGroupsByTitle(title: string | RegExp): Array<Group>;
|
1240 | /**
|
1241 | * Get an attribute
|
1242 | * @param {String=} attribute The name of the attribute. If none provided
|
1243 | * the entire attributes object is returned.
|
1244 | * @returns {String|undefined|Object} Returns the attribute or undefined if not found.
|
1245 | * If no attribute name is provided an object containing all attributes is returned.
|
1246 | * @memberof Group
|
1247 | */
|
1248 | getAttribute(attribute?: string | undefined): string | undefined | any;
|
1249 | /**
|
1250 | * Get the entries within the group
|
1251 | * @returns {Array.<Entry>} An array of entries
|
1252 | * @memberof Group
|
1253 | */
|
1254 | getEntries(): Array<import("core/Entry.js")>;
|
1255 | /**
|
1256 | * Get the groups within the group
|
1257 | * @returns {Array.<Group>} An array of child groups
|
1258 | * @memberof Group
|
1259 | */
|
1260 | getGroups(): Array<Group>;
|
1261 | /**
|
1262 | * Get the parent group
|
1263 | * @returns {Group|null} Returns the parent group instance or null if the parent
|
1264 | * is the archive
|
1265 | * @throws {Error} Throws if no parent could be found (detached)
|
1266 | * @memberof Group
|
1267 | */
|
1268 | getParentGroup(): Group | null;
|
1269 | /**
|
1270 | * Get the group title
|
1271 | * @returns {String} The title of the group
|
1272 | * @memberof Group
|
1273 | */
|
1274 | getTitle(): string;
|
1275 | /**
|
1276 | * Check if the group is in the trash
|
1277 | * @returns {Boolean} Whether or not the group is within the trash group
|
1278 | * @memberof Group
|
1279 | */
|
1280 | isInTrash(): boolean;
|
1281 | /**
|
1282 | * Check if the group is used for trash
|
1283 | * @returns {Boolean} Whether or not the group is the trash group
|
1284 | * @memberof Group
|
1285 | */
|
1286 | isTrash(): boolean;
|
1287 | /**
|
1288 | * Move the group to another group or archive
|
1289 | * @param {Group|Vault} target The destination Group or Vault instance
|
1290 | * @returns {Group} Self
|
1291 | * @memberof Group
|
1292 | */
|
1293 | moveTo(target: Group | any): Group;
|
1294 | /**
|
1295 | * Set an attribute
|
1296 | * @param {string} attribute The name of the attribute
|
1297 | * @param {string} value The value to set
|
1298 | * @returns {Group} Returns self
|
1299 | * @memberof Group
|
1300 | */
|
1301 | setAttribute(attribute: string, value: string): Group;
|
1302 | /**
|
1303 | * Set the group title
|
1304 | * @param {String} title The title of the group
|
1305 | * @returns {Group} Returns self
|
1306 | */
|
1307 | setTitle(title: string): Group;
|
1308 | }
|
1309 | }
|
1310 | declare module "core/Vault" {
|
1311 | export = Vault;
|
1312 | const Vault_base: typeof import("eventemitter3");
|
1313 | /**
|
1314 | * Vault class - Contains Groups and Entrys
|
1315 | * @augments EventEmitter
|
1316 | * @memberof module:Buttercup
|
1317 | */
|
1318 | class Vault extends Vault_base {
|
1319 | /**
|
1320 | * Create a new archive instance from a list of commands (history)
|
1321 | * @param {Array.<String>} history The command list
|
1322 | * @param {VaultFormat=} format Optional vault format override
|
1323 | * @returns {Vault} The vault instance
|
1324 | * @static
|
1325 | * @memberof Vault
|
1326 | */
|
1327 | static createFromHistory(history: Array<string>, format?: any): Vault;
|
1328 | /**
|
1329 | * Create a Vault with the default template
|
1330 | * @returns {Vault} The new vault
|
1331 | * @memberof Vault
|
1332 | * @static
|
1333 | */
|
1334 | static createWithDefaults(): Vault;
|
1335 | /**
|
1336 | * Create a new Vault instance
|
1337 | * @param {VaultFormat=} Format Optional vault format specification.
|
1338 | * Will use the default system format (recommended) if not
|
1339 | * specified.
|
1340 | */
|
1341 | constructor(Format?: any);
|
1342 | /**
|
1343 | * Object form of the vault - The "dataset"
|
1344 | * (do not use directly)
|
1345 | * @protected
|
1346 | * @memberof Vault
|
1347 | */
|
1348 | protected _dataset: {};
|
1349 | /**
|
1350 | * The ID of the Vault
|
1351 | * @type {String}
|
1352 | * @readonly
|
1353 | * @memberof Vault
|
1354 | */
|
1355 | readonly get id(): string;
|
1356 | /**
|
1357 | * Whether the Vault is in read-only mode
|
1358 | * or not
|
1359 | * @type {Boolean}
|
1360 | * @readonly
|
1361 | * @memberof Vault
|
1362 | */
|
1363 | readonly get readOnly(): boolean;
|
1364 | /**
|
1365 | * The type of the instance
|
1366 | * @type {String}
|
1367 | * @readonly
|
1368 | * @memberof Vault
|
1369 | */
|
1370 | readonly get type(): string;
|
1371 | format: any;
|
1372 | /**
|
1373 | * Create a new group
|
1374 | * @param {String=} title The title for the group
|
1375 | * @returns {Group} The newly created group
|
1376 | * @memberof Vault
|
1377 | */
|
1378 | createGroup(title?: string | undefined): import("core/Group.js");
|
1379 | /**
|
1380 | * Delete an attribute
|
1381 | * @param {String} attribute The name of the attribute to delete
|
1382 | * @returns {Vault} Self
|
1383 | * @memberof Vault
|
1384 | */
|
1385 | deleteAttribute(attribute: string): Vault;
|
1386 | /**
|
1387 | * Remove all entries and groups from the trash (permanent)
|
1388 | * - does nothing if no trash group
|
1389 | * @returns {Vault} Self
|
1390 | * @memberof Vault
|
1391 | */
|
1392 | emptyTrash(): Vault;
|
1393 | /**
|
1394 | * Find an entry by its ID
|
1395 | * @param {String} id The ID to search for
|
1396 | * @returns {null|Entry} Null if not found, or the Entry instance
|
1397 | * @memberof Vault
|
1398 | */
|
1399 | findEntryByID(id: string): null | any;
|
1400 | /**
|
1401 | * Find all entries that match a certain property
|
1402 | * @name findEntriesByProperty
|
1403 | * @param {RegExp|String} property The property to search with
|
1404 | * @param {RegExp|String} value The value to search for
|
1405 | * @returns {Array.<Entry>} An array of found extries
|
1406 | * @memberof Vault
|
1407 | */
|
1408 | findEntriesByProperty(property: RegExp | string, value: RegExp | string): Array<any>;
|
1409 | /**
|
1410 | * Find a group by its ID
|
1411 | * @param {String} id The group ID to search for
|
1412 | * @returns {Group|null} The group or null if not found
|
1413 | * @memberof Vault
|
1414 | */
|
1415 | findGroupByID(id: string): import("core/Group.js") | null;
|
1416 | /**
|
1417 | * Find groups by their title
|
1418 | * @name findGroupsByTitle
|
1419 | * @param {String|RegExp} title The group title
|
1420 | * @returns {Array.<Group>} An array of groups
|
1421 | * @memberof Vault
|
1422 | */
|
1423 | findGroupsByTitle(title: string | RegExp): Array<import("core/Group.js")>;
|
1424 | /**
|
1425 | * Get the value of an attribute
|
1426 | * @param {String=} attributeName The attribute to get
|
1427 | * @returns {undefined|String|Object} The value of the attribute or undefined if not
|
1428 | * set. Returns an object if no attribute name is given.
|
1429 | * @memberof Vault
|
1430 | */
|
1431 | getAttribute(attributeName?: string | undefined): undefined | string | any;
|
1432 | /**
|
1433 | * Get the top-level groups in the vault
|
1434 | * @returns {Array.<Group>}
|
1435 | * @memberof Vault
|
1436 | */
|
1437 | getGroups(): Array<import("core/Group.js")>;
|
1438 | /**
|
1439 | * Get the trash group
|
1440 | * @returns {Group|null} The trash group or null if it doesn't
|
1441 | * exist
|
1442 | * @memberof Vault
|
1443 | */
|
1444 | getTrashGroup(): import("core/Group.js") | null;
|
1445 | /**
|
1446 | * Set an attribute on the vault
|
1447 | * @param {String} attribute The attribute to set
|
1448 | * @param {String} value The value to set for the attribute
|
1449 | * @returns {Vault} Self
|
1450 | * @memberof Vault
|
1451 | */
|
1452 | setAttribute(attribute: string, value: string): Vault;
|
1453 | }
|
1454 | }
|
1455 | declare module "credentials/Credentials" {
|
1456 | export = Credentials;
|
1457 | /**
|
1458 | * Secure credentials storage/transfer class
|
1459 | * - Allows for the safe transfer of credentials within the
|
1460 | * Buttercup application environment. Will not allow
|
1461 | * credentials to be shared or transferred outside of the
|
1462 | * environment. Credential properties are stored in memory
|
1463 | * and are inaccessible to public functions.
|
1464 | * @memberof module:Buttercup
|
1465 | */
|
1466 | class Credentials {
|
1467 | static PURPOSE_DECRYPT_VAULT: string;
|
1468 | static PURPOSE_ENCRYPT_VAULT: string;
|
1469 | static PURPOSE_SECURE_EXPORT: string;
|
1470 | /**
|
1471 | * Get all available purposes
|
1472 | * @returns {Array.<String>}
|
1473 | * @memberof Credentials
|
1474 | * @static
|
1475 | */
|
1476 | static allPurposes(): Array<string>;
|
1477 | /**
|
1478 | * Create a new Credentials instance using an existing Credentials
|
1479 | * instance - This can be used to reset a credentials's purposes.
|
1480 | * @param {Credentials} credentials A credentials instance
|
1481 | * @param {String} masterPassword The master password used to
|
1482 | * encrypt the instance being cloned
|
1483 | * @returns {Credentials}
|
1484 | * @memberof Credentials
|
1485 | * @static
|
1486 | * @throws {Error} Throws if no master password provided
|
1487 | * @throws {Error} Throws if master password does not match
|
1488 | * original
|
1489 | */
|
1490 | static fromCredentials(credentials: Credentials, masterPassword: string): Credentials;
|
1491 | /**
|
1492 | * Create a new Credentials instance from a Datasource configuration
|
1493 | * @param {Object} datasourceConfig The configuration for the
|
1494 | * datasource - this usually includes the credential data used for
|
1495 | * authenticating against the datasource host platform.
|
1496 | * @param {String|null=} masterPassword Optional master password to
|
1497 | * store alongside the credentials. Used to create secure strings.
|
1498 | * @returns {Credentials}
|
1499 | * @memberof Credentials
|
1500 | * @static
|
1501 | */
|
1502 | static fromDatasource(datasourceConfig: any, masterPassword?: (string | null) | undefined): Credentials;
|
1503 | /**
|
1504 | * Create a new Credentials instance from a password
|
1505 | * - uses the single password value as the master password stored
|
1506 | * alongside the original password if no master password is
|
1507 | * provided. The master password is used when generating secure
|
1508 | * strings.
|
1509 | * @param {String} password The password to store
|
1510 | * @param {String|null=} masterPassword Optional master password
|
1511 | * to store alongside the credentials. Used to create secure
|
1512 | * strings.
|
1513 | * @returns {Credentials}
|
1514 | * @memberof Credentials
|
1515 | * @static
|
1516 | */
|
1517 | static fromPassword(password: string, masterPassword?: (string | null) | undefined): Credentials;
|
1518 | /**
|
1519 | * Create a new instance from a secure string
|
1520 | * @param {String} content Encrypted content
|
1521 | * @param {String} masterPassword The password for decryption
|
1522 | * @returns {Promise.<Credentials>} A promise that resolves with the new instance
|
1523 | * @static
|
1524 | * @memberof Credentials
|
1525 | */
|
1526 | static fromSecureString(content: string, masterPassword: string): Promise<Credentials>;
|
1527 | /**
|
1528 | * Check if a value is an instance of Credentials
|
1529 | * @param {*} inst The value to check
|
1530 | * @returns {Boolean}
|
1531 | * @statuc
|
1532 | * @memberof Credentials
|
1533 | */
|
1534 | static isCredentials(inst: any): boolean;
|
1535 | /**
|
1536 | * Create a new Credentials instance
|
1537 | * @param {Object=} obj Object data representing some credentials
|
1538 | * @param {String|null=} masterPassword Optional master password to store with
|
1539 | * the credentials data, which is used for generating secure strings.
|
1540 | */
|
1541 | constructor(obj?: any | undefined, masterPassword?: (string | null) | undefined);
|
1542 | /**
|
1543 | * Restrict the purposes that this set of credentials
|
1544 | * can be used for. Once a purpose is removed it can
|
1545 | * no longer be added again to the same instance.
|
1546 | * @param {Array.<String>} allowedPurposes An array of
|
1547 | * new allowed purposes. If a purpose mentioned is
|
1548 | * not currently permitted, it will be ignored.
|
1549 | * {Credentials} Returns self
|
1550 | * Credentials
|
1551 | *
|
1552 | * credentials.restrictPurposes(
|
1553 | * Credentials.PURPOSE_SECURE_EXPORT
|
1554 | * );
|
1555 | * // credentials can only be exported to an
|
1556 | * // encrypted string, and not used for things
|
1557 | * // like encrypting datasource changes.
|
1558 | */
|
1559 | restrictPurposes(allowedPurposes: Array<string>): Credentials;
|
1560 | /**
|
1561 | * Convert the credentials to an encrypted string, for storage
|
1562 | * @returns {Promise.<String>} A promise that resolves with the encrypted credentials
|
1563 | * @throws {Error} Rejects when masterPassword is not a string
|
1564 | * @throws {Error} Rejects if credentials don't permit secure export purposes
|
1565 | * @memberof Credentials
|
1566 | */
|
1567 | toSecureString(): Promise<string>;
|
1568 | }
|
1569 | }
|
1570 | declare module "tools/vaultManagement" {
|
1571 | export function getSourceOfflineArchive(storage: any, sourceID: any): any;
|
1572 | export function sourceHasOfflineCopy(storage: any, sourceID: any): any;
|
1573 | export function storeSourceOfflineCopy(storage: any, sourceID: any, content: any): any;
|
1574 | }
|
1575 | declare module "datasources/register" {
|
1576 | export type RegisterDatasourcePostProcessorResult = {
|
1577 | /**
|
1578 | * - Function to call to remove the handler
|
1579 | */
|
1580 | remove: Function;
|
1581 | };
|
1582 | /**
|
1583 | * Convert a Credentials instance to a Datasource
|
1584 | * @param {Credentials} credentials A Credentials instance that
|
1585 | * contains a datasource configuration
|
1586 | * @returns {TextDatasource}
|
1587 | * @throws {Error} Throws if no datasource configuration in
|
1588 | * credentials
|
1589 | * @throws {Error} Throws if no type specified in datasource
|
1590 | * configuration
|
1591 | * @throws {Error} Throws if no datasource found for type
|
1592 | * @private
|
1593 | */
|
1594 | export function credentialsToDatasource(credentials: any): any;
|
1595 | /**
|
1596 | * Execute all datasource postprocessors
|
1597 | * @param {TextDatasource} datasource The datasource instance
|
1598 | * @private
|
1599 | */
|
1600 | export function fireInstantiationHandlers(type: any, datasource: any): void;
|
1601 | /**
|
1602 | * Register a new datasource
|
1603 | * This is called internally by the built-in datasources, but should be called if a
|
1604 | * custom datasource is used.
|
1605 | * @param {String} datasourceType The name (slug) of the datasource
|
1606 | * @param {Object} DSClass The class for the new datasource
|
1607 | * @memberof module:Buttercup
|
1608 | */
|
1609 | export function registerDatasource(datasourceType: string, DSClass: any): void;
|
1610 | /**
|
1611 | * @typedef {Object} RegisterDatasourcePostProcessorResult
|
1612 | * @property {Function} remove - Function to call to remove the handler
|
1613 | */
|
1614 | /**
|
1615 | * Register a post-processor for a datasource being instantiated
|
1616 | * @param {Function} callback The callback to execute with the instantiated datasource
|
1617 | * @returns {RegisterDatasourcePostProcessorResult} The result of the registration
|
1618 | * @private
|
1619 | */
|
1620 | export function registerDatasourcePostProcessor(callback: Function): RegisterDatasourcePostProcessorResult;
|
1621 | }
|
1622 | declare module "tools/hash" {
|
1623 | export {};
|
1624 | }
|
1625 | declare module "myButtercup/Share" {
|
1626 | export = Share;
|
1627 | class Share {
|
1628 | constructor(shareID: any, history: any, permissions?: any[]);
|
1629 | _id: any;
|
1630 | _history: string[];
|
1631 | _lastHash: any;
|
1632 | _dirty: boolean;
|
1633 | _permissions: any[];
|
1634 | get id(): any;
|
1635 | get permissions(): any[];
|
1636 | applyToArchive(archive: any): void;
|
1637 | archiveHasAppliedShare(archive: any): boolean;
|
1638 | getPrefixedHistory(): string[];
|
1639 | updateHistory(history: any): boolean;
|
1640 | }
|
1641 | }
|
1642 | declare module "myButtercup/sharing" {
|
1643 | export function initialiseShares(workspace: any): any;
|
1644 | }
|
1645 | declare module "facades/detection" {
|
1646 | /**
|
1647 | * Check if a string is an OTP URI
|
1648 | * @param {String} str The string to check
|
1649 | * @returns {Boolean}
|
1650 | * @memberof module:Buttercup
|
1651 | */
|
1652 | export function isOTPURI(str: string): boolean;
|
1653 | /**
|
1654 | * Check if an object is a vault facade
|
1655 | * @param {Object|*} obj The item to check
|
1656 | * @returns {Boolean} True if a vault facade
|
1657 | * @memberof module:Buttercup
|
1658 | */
|
1659 | export function isVaultFacade(obj: any | any): boolean;
|
1660 | }
|
1661 | declare module "facades/symbols" {
|
1662 | export type FlagSpecification = {
|
1663 | /**
|
1664 | * The title of the entry type
|
1665 | */
|
1666 | title: string;
|
1667 | /**
|
1668 | * The slug of the entry type
|
1669 | */
|
1670 | slug: string;
|
1671 | };
|
1672 | /**
|
1673 | * Default entry type
|
1674 | * @type {String}
|
1675 | * @memberof module:Buttercup
|
1676 | */
|
1677 | export const DEFAULT_ENTRY_TYPE: string;
|
1678 | /**
|
1679 | * Default entry field type
|
1680 | * @type {String}
|
1681 | * @memberof module:Buttercup
|
1682 | */
|
1683 | export const DEFAULT_FIELD_TYPE: string;
|
1684 | /**
|
1685 | * Credit-card entry type
|
1686 | * @type {String}
|
1687 | * @memberof module:Buttercup
|
1688 | */
|
1689 | export const ENTRY_TYPE_CREDITCARD: string;
|
1690 | /**
|
1691 | * Login (default) entry type
|
1692 | * @type {String}
|
1693 | * @memberof module:Buttercup
|
1694 | */
|
1695 | export const ENTRY_TYPE_LOGIN: string;
|
1696 | /**
|
1697 | * Note entry type
|
1698 | * @type {String}
|
1699 | * @memberof module:Buttercup
|
1700 | */
|
1701 | export const ENTRY_TYPE_NOTE: string;
|
1702 | /**
|
1703 | * SSH public/private key-pair entry type
|
1704 | * @type {String}
|
1705 | * @memberof module:Buttercup
|
1706 | */
|
1707 | export const ENTRY_TYPE_SSHKEY: string;
|
1708 | /**
|
1709 | * Website entry type (includes URL)
|
1710 | * @type {String}
|
1711 | * @memberof module:Buttercup
|
1712 | */
|
1713 | export const ENTRY_TYPE_WEBSITE: string;
|
1714 | /**
|
1715 | * @typedef {Object} FlagSpecification
|
1716 | * @property {String} title The title of the entry type
|
1717 | * @property {String} slug The slug of the entry type
|
1718 | */
|
1719 | /**
|
1720 | * Entry types collection (all available)
|
1721 | * @type {Object.<String,FlagSpecification>}
|
1722 | * @memberof module:Buttercup
|
1723 | */
|
1724 | export const ENTRY_TYPES: any;
|
1725 | export const FACADE_VERSION: 2;
|
1726 | /**
|
1727 | * Note type entry field value
|
1728 | * @type {String}
|
1729 | * @memberof module:Buttercup
|
1730 | */
|
1731 | export const FIELD_VALUE_TYPE_NOTE: string;
|
1732 | /**
|
1733 | * OTP (One Time Password) type entry field value
|
1734 | * @type {String}
|
1735 | * @memberof module:Buttercup
|
1736 | */
|
1737 | export const FIELD_VALUE_TYPE_OTP: string;
|
1738 | /**
|
1739 | * Password type entry field value
|
1740 | * @type {String}
|
1741 | * @memberof module:Buttercup
|
1742 | */
|
1743 | export const FIELD_VALUE_TYPE_PASSWORD: string;
|
1744 | /**
|
1745 | * Text (default) type entry field value
|
1746 | * @type {String}
|
1747 | * @memberof module:Buttercup
|
1748 | */
|
1749 | export const FIELD_VALUE_TYPE_TEXT: string;
|
1750 | /**
|
1751 | * Entry field value types collection (all available)
|
1752 | * @type {Object.<String,FlagSpecification>}
|
1753 | * @memberof module:Buttercup
|
1754 | */
|
1755 | export const FIELD_VALUE_TYPES: any;
|
1756 | }
|
1757 | declare module "facades/tools" {
|
1758 | export type EntryFacadeFieldFormattingSegment = {
|
1759 | /**
|
1760 | * - A character to match with a regular expression
|
1761 | */
|
1762 | char?: RegExp | undefined;
|
1763 | /**
|
1764 | * - Number of times to repeat the character match (required for `char`)
|
1765 | */
|
1766 | repeat?: number | undefined;
|
1767 | /**
|
1768 | * - The exact character match (operates in opposition to `char`)
|
1769 | */
|
1770 | exactly?: string | undefined;
|
1771 | };
|
1772 | export type EntryFacadeFieldFormatting = {
|
1773 | /**
|
1774 | * - The segmented formatting of the value
|
1775 | */
|
1776 | format?: Array<EntryFacadeFieldFormattingSegment> | undefined;
|
1777 | /**
|
1778 | * - Optional placeholder for the input (ties in to `format`)
|
1779 | */
|
1780 | placeholder?: string | undefined;
|
1781 | /**
|
1782 | * - Options for a dropdown: either an array of option values or an object
|
1783 | * (key:value) of values and titles
|
1784 | */
|
1785 | options?: (any | Array) | undefined;
|
1786 | /**
|
1787 | * - The default option value if none set
|
1788 | */
|
1789 | defaultOption?: string | undefined;
|
1790 | };
|
1791 | /**
|
1792 | * Entry facade data field
|
1793 | */
|
1794 | export type EntryFacadeField = {
|
1795 | /**
|
1796 | * - A randomly generated ID (UUID) for identifying this field during editing
|
1797 | */
|
1798 | id: string;
|
1799 | /**
|
1800 | * - The user-friendly title of the field
|
1801 | */
|
1802 | title: string;
|
1803 | /**
|
1804 | * - The type of data to map back to on the Entry instance (property/attribute)
|
1805 | */
|
1806 | propertyType: string;
|
1807 | /**
|
1808 | * - The property name within the field type of the Entry instance
|
1809 | */
|
1810 | property: string;
|
1811 | /**
|
1812 | * - The value of the property (read/write)
|
1813 | */
|
1814 | value: string;
|
1815 | /**
|
1816 | * - The type of value (rendering) (null for attributes)
|
1817 | */
|
1818 | valueType?: string | undefined;
|
1819 | /**
|
1820 | * - Vendor formatting options object, or false if no formatting necessary
|
1821 | */
|
1822 | formatting: EntryFacadeFieldFormatting | boolean;
|
1823 | /**
|
1824 | * - Whether or not the field can be removed or have its key changed
|
1825 | */
|
1826 | removeable: boolean;
|
1827 | };
|
1828 | /**
|
1829 | * @typedef {Object} EntryFacadeFieldFormattingSegment
|
1830 | * @property {RegExp=} char - A character to match with a regular expression
|
1831 | * @property {Number=} repeat - Number of times to repeat the character match (required for `char`)
|
1832 | * @property {String=} exactly - The exact character match (operates in opposition to `char`)
|
1833 | */
|
1834 | /**
|
1835 | * @typedef {Object} EntryFacadeFieldFormatting
|
1836 | * @property {Array.<EntryFacadeFieldFormattingSegment>=} format - The segmented formatting of the value
|
1837 | * @property {String=} placeholder - Optional placeholder for the input (ties in to `format`)
|
1838 | * @property {Object|Array=} options - Options for a dropdown: either an array of option values or an object
|
1839 | * (key:value) of values and titles
|
1840 | * @property {String=} defaultOption - The default option value if none set
|
1841 | */
|
1842 | /**
|
1843 | * Entry facade data field
|
1844 | * @typedef {Object} EntryFacadeField
|
1845 | * @property {String} id - A randomly generated ID (UUID) for identifying this field during editing
|
1846 | * @property {String} title - The user-friendly title of the field
|
1847 | * @property {String} propertyType - The type of data to map back to on the Entry instance (property/attribute)
|
1848 | * @property {String} property - The property name within the field type of the Entry instance
|
1849 | * @property {String} value - The value of the property (read/write)
|
1850 | * @property {String=} valueType - The type of value (rendering) (null for attributes)
|
1851 | * @property {EntryFacadeFieldFormatting|Boolean} formatting - Vendor formatting options object, or false if no formatting necessary
|
1852 | * @property {Boolean} removeable - Whether or not the field can be removed or have its key changed
|
1853 | */
|
1854 | /**
|
1855 | * Create a descriptor for a field to be used within a facade
|
1856 | * @param {Entry|null} entry The entry instance to process or null if the initial value
|
1857 | * should be empty
|
1858 | * @param {String} title The field title
|
1859 | * @param {String} entryPropertyType The type of entry property (property/attribute)
|
1860 | * @param {String} entryPropertyName The name of the property
|
1861 | * @param {Object} options The options for the field
|
1862 | * @returns {EntryFacadeField} The field descriptor
|
1863 | * @memberof module:Buttercup
|
1864 | */
|
1865 | export function createFieldDescriptor(entry: any | null, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any): EntryFacadeField;
|
1866 | /**
|
1867 | * Get a value on an entry for a specific property type
|
1868 | * @param {Entry} entry The entry instance
|
1869 | * @param {String} propertyType The type of entry property (property/attribute)
|
1870 | * @param {String} name The property name
|
1871 | * @returns {String} The property value
|
1872 | * @throws {Error} Throws for unknown property types
|
1873 | * @deprecated Not in use - To be removed
|
1874 | */
|
1875 | export function getEntryValue(entry: any, propertyType: string, name: string): string;
|
1876 | /**
|
1877 | * Get the entry value type
|
1878 | * @param {Entry|null} entry Entry instance
|
1879 | * @param {String} propertyName The entry property name
|
1880 | * @returns {String} The entry value type (returns default "text"
|
1881 | * if entry not specified)
|
1882 | */
|
1883 | export function getEntryValueType(entry: import("core/Entry.js") | null, propertyName: string): string;
|
1884 | /**
|
1885 | * Check if an ID signifies a new instance and not an
|
1886 | * existing one
|
1887 | * @param {String|Number} id The ID to check
|
1888 | * @returns {Boolean}
|
1889 | */
|
1890 | export function idSignifiesNew(id: string | number): boolean;
|
1891 | /**
|
1892 | * Set the value type attribute of an entry
|
1893 | * @param {Entry} entry Entry instance
|
1894 | * @param {String} propertyName The property name
|
1895 | * @param {String} valueType The value type
|
1896 | */
|
1897 | export function setEntryValueType(entry: import("core/Entry.js"), propertyName: string, valueType: string): void;
|
1898 | }
|
1899 | declare module "facades/entryFields" {
|
1900 | const _exports: {
|
1901 | [x: string]: typeof createLoginFields;
|
1902 | };
|
1903 | export = _exports;
|
1904 | function createLoginFields(entry: any): import("facades/tools.js").EntryFacadeField[];
|
1905 | }
|
1906 | declare module "facades/entry" {
|
1907 | export type EntryHistoryItem = {
|
1908 | /**
|
1909 | * The property/attribute name
|
1910 | */
|
1911 | property: string;
|
1912 | /**
|
1913 | * Either "property" or "attribute"
|
1914 | */
|
1915 | propertyType: string;
|
1916 | /**
|
1917 | * The original value or null if it did not exist
|
1918 | * before this change
|
1919 | */
|
1920 | originalValue: string | null;
|
1921 | /**
|
1922 | * The new value or null if it was deleted
|
1923 | */
|
1924 | newValue: string | null;
|
1925 | };
|
1926 | /**
|
1927 | * Entry facade for data input
|
1928 | */
|
1929 | export type EntryFacade = {
|
1930 | /**
|
1931 | * - The entry ID
|
1932 | */
|
1933 | id: string;
|
1934 | /**
|
1935 | * - The type of the facade
|
1936 | */
|
1937 | type: string;
|
1938 | /**
|
1939 | * - An array of fields
|
1940 | */
|
1941 | fields: Array<any>;
|
1942 | /**
|
1943 | * - The parent group ID
|
1944 | */
|
1945 | parentID: string;
|
1946 | /**
|
1947 | * - Array of changes for all properties of
|
1948 | * the entry
|
1949 | */
|
1950 | _history: Array<EntryHistoryItem>;
|
1951 | };
|
1952 | export type CreateEntryFacadeOptions = {
|
1953 | /**
|
1954 | * - Optionally override the created facade type
|
1955 | */
|
1956 | type?: string | undefined;
|
1957 | };
|
1958 | /**
|
1959 | * Process a modified entry facade
|
1960 | * @param {Entry} entry The entry to apply processed data on
|
1961 | * @param {EntryFacade} facade The facade object
|
1962 | * @memberof module:Buttercup
|
1963 | */
|
1964 | export function consumeEntryFacade(entry: import("core/Entry.js"), facade: EntryFacade): void;
|
1965 | /**
|
1966 | * @typedef {Object} CreateEntryFacadeOptions
|
1967 | * @property {String=} type - Optionally override the created facade type
|
1968 | */
|
1969 | /**
|
1970 | * Create a data/input facade for an Entry instance
|
1971 | * @param {Entry=} entry The Entry instance
|
1972 | * @param {CreateEntryFacadeOptions=} ops Options for the entry facade creation
|
1973 | * @returns {EntryFacade} A newly created facade
|
1974 | * @memberof module:Buttercup
|
1975 | */
|
1976 | export function createEntryFacade(entry?: import("core/Entry.js") | undefined, { type }?: CreateEntryFacadeOptions | undefined): EntryFacade;
|
1977 | }
|
1978 | declare module "facades/vault" {
|
1979 | export type VaultFacade = {
|
1980 | /**
|
1981 | * - The facade type: "vault"
|
1982 | */
|
1983 | type: string;
|
1984 | /**
|
1985 | * - The vault ID
|
1986 | */
|
1987 | id: string;
|
1988 | /**
|
1989 | * - A key/value list of all the vault attributes
|
1990 | */
|
1991 | attributes: any;
|
1992 | /**
|
1993 | * - An array of group facades
|
1994 | */
|
1995 | groups: Array<GroupFacade>;
|
1996 | /**
|
1997 | * - An array of entry facades
|
1998 | */
|
1999 | entries: Array<any>;
|
2000 | /**
|
2001 | * - The UUID tag for the generation of the facade
|
2002 | */
|
2003 | _tag: string;
|
2004 | };
|
2005 | export type GroupFacade = {
|
2006 | /**
|
2007 | * - The facade type: "group"
|
2008 | */
|
2009 | type: string;
|
2010 | /**
|
2011 | * - The group ID. Will be set to null if
|
2012 | * the group is a new one
|
2013 | */
|
2014 | id: string | null;
|
2015 | /**
|
2016 | * - The group title
|
2017 | */
|
2018 | title: string;
|
2019 | /**
|
2020 | * - A key/value list of group attributes
|
2021 | */
|
2022 | attributes: any;
|
2023 | /**
|
2024 | * - The parent group ID. Set to "0" if
|
2025 | * it is to be created in the root.
|
2026 | */
|
2027 | parentID: string | null;
|
2028 | };
|
2029 | /**
|
2030 | * Consume a group facade and apply the differences to a group instance
|
2031 | * @param {Group} group The group instance to apply to
|
2032 | * @param {GroupFacade} facade The facade to apply
|
2033 | * @memberof module:Buttercup
|
2034 | */
|
2035 | export function consumeGroupFacade(group: any, facade: GroupFacade): void;
|
2036 | /**
|
2037 | * Consume a vault facade and apply the differences to the vault
|
2038 | * instance
|
2039 | * @param {Vault} vault The vault instance to apply to
|
2040 | * @param {VaultFacade} facade The facade to apply
|
2041 | * @memberof module:Buttercup
|
2042 | */
|
2043 | export function consumeVaultFacade(vault: any, facade: VaultFacade): void;
|
2044 | /**
|
2045 | * @typedef {Object} GroupFacade
|
2046 | * @property {String} type - The facade type: "group"
|
2047 | * @property {String|null} id - The group ID. Will be set to null if
|
2048 | * the group is a new one
|
2049 | * @property {String} title - The group title
|
2050 | * @property {Object} attributes - A key/value list of group attributes
|
2051 | * @property {String|null} parentID - The parent group ID. Set to "0" if
|
2052 | * it is to be created in the root.
|
2053 | */
|
2054 | /**
|
2055 | * Create a group facade from a Group instance
|
2056 | * @param {Group} group The group instance
|
2057 | * @param {String=} parentID The parent ID of the group
|
2058 | * @memberof module:Buttercup
|
2059 | */
|
2060 | export function createGroupFacade(group: any, parentID?: string | undefined): {
|
2061 | type: string;
|
2062 | id: any;
|
2063 | title: any;
|
2064 | attributes: any;
|
2065 | parentID: string;
|
2066 | };
|
2067 | /**
|
2068 | * @typedef {Object} VaultFacade
|
2069 | * @property {String} type - The facade type: "vault"
|
2070 | * @property {String} id - The vault ID
|
2071 | * @property {Object} attributes - A key/value list of all the vault attributes
|
2072 | * @property {Array.<GroupFacade>} groups - An array of group facades
|
2073 | * @property {Array.<EntryFacade>} entries - An array of entry facades
|
2074 | * @property {String} _tag - The UUID tag for the generation of the facade
|
2075 | */
|
2076 | /**
|
2077 | * Create a vault facade from an Vault instance
|
2078 | * @param {Vault} vault A vault instance
|
2079 | * @returns {VaultFacade} A vault facade
|
2080 | * @memberof module:Buttercup
|
2081 | */
|
2082 | export function createVaultFacade(vault: any): VaultFacade;
|
2083 | }
|
2084 | declare module "core/VaultComparator" {
|
2085 | export = VaultComparator;
|
2086 | /**
|
2087 | * Vault comparison class
|
2088 | */
|
2089 | class VaultComparator {
|
2090 | static calculateHistoryDifferences(historyA: any, historyB: any): boolean | {
|
2091 | original: string[];
|
2092 | secondary: string[];
|
2093 | };
|
2094 | /**
|
2095 | * Constructor for the vault comparator
|
2096 | * @param {Vault} originalVault The primary vault
|
2097 | * @param {Vault} secondaryVault The secondary vault
|
2098 | */
|
2099 | constructor(originalVault: any, secondaryVault: any);
|
2100 | _vaultA: any;
|
2101 | _vaultB: any;
|
2102 | /**
|
2103 | * Calculate the differences, in commands, between the two vaults
|
2104 | * @returns {{ original:Array, secondary:Array }|null} Returns null if no common base
|
2105 | * is found, or the command differences as two arrays
|
2106 | * VaultComparator
|
2107 | */
|
2108 | calculateDifferences(): {
|
2109 | original: Array;
|
2110 | secondary: Array;
|
2111 | } | null;
|
2112 | /**
|
2113 | * Check if the current vaults differ
|
2114 | * @returns {Boolean} True if the vaults are different
|
2115 | * @memberof VaultComparator
|
2116 | */
|
2117 | vaultsDiffer(): boolean;
|
2118 | }
|
2119 | }
|
2120 | declare module "insight/vault" {
|
2121 | export type VaultInsights = {
|
2122 | /**
|
2123 | * Average password length
|
2124 | */
|
2125 | avgPassLen?: number | undefined;
|
2126 | /**
|
2127 | * Number of entries in the vault
|
2128 | */
|
2129 | entries?: number | undefined;
|
2130 | /**
|
2131 | * Number of groups in the vault
|
2132 | */
|
2133 | groups?: number | undefined;
|
2134 | /**
|
2135 | * Longest password length
|
2136 | */
|
2137 | longPassLen?: number | undefined;
|
2138 | /**
|
2139 | * Shortest password length
|
2140 | */
|
2141 | shortPassLen?: number | undefined;
|
2142 | /**
|
2143 | * Number of entries in trash
|
2144 | */
|
2145 | trashEntries?: number | undefined;
|
2146 | /**
|
2147 | * Number of groups in trash
|
2148 | */
|
2149 | trashGroups?: number | undefined;
|
2150 | };
|
2151 | export type Insights = {
|
2152 | /**
|
2153 | * Average password length
|
2154 | */
|
2155 | avgPassLen?: number | undefined;
|
2156 | /**
|
2157 | * Number of entries in the vault
|
2158 | */
|
2159 | entries?: number | undefined;
|
2160 | /**
|
2161 | * Number of groups in the vault
|
2162 | */
|
2163 | groups?: number | undefined;
|
2164 | /**
|
2165 | * Longest password length
|
2166 | */
|
2167 | longPassLen?: number | undefined;
|
2168 | /**
|
2169 | * Shortest password length
|
2170 | */
|
2171 | shortPassLen?: number | undefined;
|
2172 | /**
|
2173 | * Number of entries in trash
|
2174 | */
|
2175 | trashEntries?: number | undefined;
|
2176 | /**
|
2177 | * Number of groups in trash
|
2178 | */
|
2179 | trashGroups?: number | undefined;
|
2180 | };
|
2181 | /**
|
2182 | * @typedef {Object} VaultInsights
|
2183 | * @property {Number=} avgPassLen Average password length
|
2184 | * @property {Number=} entries Number of entries in the vault
|
2185 | * @property {Number=} groups Number of groups in the vault
|
2186 | * @property {Number=} longPassLen Longest password length
|
2187 | * @property {Number=} shortPassLen Shortest password length
|
2188 | * @property {Number=} trashEntries Number of entries in trash
|
2189 | * @property {Number=} trashGroups Number of groups in trash
|
2190 | */
|
2191 | /**
|
2192 | * @typedef {VaultInsights} Insights
|
2193 | */
|
2194 | /**
|
2195 | * Generate insights for a vault instance
|
2196 | * @param {Vault} vault The vault instance
|
2197 | * @returns {VaultInsights}
|
2198 | * @private
|
2199 | */
|
2200 | export function generateVaultInsights(vault: any): VaultInsights;
|
2201 | }
|
2202 | declare module "core/VaultSource" {
|
2203 | export = VaultSource;
|
2204 | const VaultSource_base: typeof import("eventemitter3");
|
2205 | /**
|
2206 | * Vault source class for managing a single vault
|
2207 | * within a vault manager
|
2208 | * @augments EventEmitter
|
2209 | * @memberof module:Buttercup
|
2210 | */
|
2211 | class VaultSource extends VaultSource_base {
|
2212 | static STATUS_LOCKED: string;
|
2213 | static STATUS_PENDING: string;
|
2214 | static STATUS_UNLOCKED: string;
|
2215 | /**
|
2216 | * Rehydrate the vault source from a dehydrated state
|
2217 | * @param {String} dehydratedString The dehydrated form of the vault source
|
2218 | * @returns {VaultSource} A rehydrated instance
|
2219 | * @memberof VaultSource
|
2220 | * @static
|
2221 | */
|
2222 | static rehydrate(dehydratedString: string): VaultSource;
|
2223 | constructor(name: any, type: any, credentialsString: any, config?: {});
|
2224 | _queue: any;
|
2225 | _credentials: any;
|
2226 | _status: string;
|
2227 | _datasource: any;
|
2228 | _vault: any;
|
2229 | _shares: any[];
|
2230 | _id: any;
|
2231 | _name: any;
|
2232 | _type: any;
|
2233 | _colour: any;
|
2234 | _order: any;
|
2235 | _meta: any;
|
2236 | _vaultManager: any;
|
2237 | set colour(arg: string);
|
2238 | /**
|
2239 | * Source colour
|
2240 | * @type {String}
|
2241 | * VaultSource
|
2242 | */
|
2243 | get colour(): string;
|
2244 | /**
|
2245 | * Source ID
|
2246 | * @type {String}
|
2247 | * @memberof VaultSource
|
2248 | * @readonly
|
2249 | */
|
2250 | readonly get id(): string;
|
2251 | /**
|
2252 | * Meta data
|
2253 | * @type {Object}
|
2254 | * @memberof VaultSource
|
2255 | * @readonly
|
2256 | */
|
2257 | readonly get meta(): any;
|
2258 | /**
|
2259 | * Source name
|
2260 | * @type {String}
|
2261 | * @memberof VaultSource
|
2262 | * @readonly
|
2263 | */
|
2264 | readonly get name(): string;
|
2265 | /**
|
2266 | * Source status
|
2267 | * @type {String}
|
2268 | * @memberof VaultSource
|
2269 | * @readonly
|
2270 | */
|
2271 | readonly get status(): string;
|
2272 | /**
|
2273 | * The datasource type
|
2274 | * @type {String}
|
2275 | * @memberof VaultSource
|
2276 | * @readonly
|
2277 | */
|
2278 | readonly get type(): string;
|
2279 | /**
|
2280 | * Vault reference
|
2281 | * @type {Vault|null}
|
2282 | * @memberof VaultSource
|
2283 | * @readonly
|
2284 | */
|
2285 | readonly get vault(): import("core/Vault.js");
|
2286 | /**
|
2287 | * Change the master vault password
|
2288 | * @param {String} oldPassword The original/current password
|
2289 | * @param {String} newPassword The new password to change to
|
2290 | * @param {Object=} meta Optional metadata
|
2291 | * @returns {Promise}
|
2292 | * @memberof VaultSource
|
2293 | */
|
2294 | changeMasterPassword(oldPassword: string, newPassword: string, meta?: any | undefined): Promise<any>;
|
2295 | /**
|
2296 | * Check if the vault source can be updated
|
2297 | * @returns {Boolean}
|
2298 | * @memberof VaultSource
|
2299 | */
|
2300 | canBeUpdated(): boolean;
|
2301 | /**
|
2302 | * Check if the source has an offline copy
|
2303 | * @returns {Promise.<Boolean>} A promise which resolves with whether an offline
|
2304 | * copy is available or not
|
2305 | * @memberof VaultSource
|
2306 | */
|
2307 | checkOfflineCopy(): Promise<boolean>;
|
2308 | dehydrate(): Promise<string>;
|
2309 | /**
|
2310 | * Get offline content, if it exists
|
2311 | * @returns {Promise.<String|null>} A promise a resolves with the content, or null
|
2312 | * if it doesn't exist
|
2313 | * @memberof VaultSource
|
2314 | */
|
2315 | getOfflineContent(): Promise<string | null>;
|
2316 | /**
|
2317 | * Detect whether the local archives (in memory) differ from their remote copies
|
2318 | * Fetches the remote copies from their datasources and detects differences between
|
2319 | * them and their local counterparts. Does not change/update the local items.
|
2320 | * @returns {Promise.<Boolean>} A promise that resolves with a boolean - true if
|
2321 | * there are differences, false if there is not
|
2322 | * @memberof VaultSource
|
2323 | */
|
2324 | localDiffersFromRemote(): Promise<boolean>;
|
2325 | lock(): Promise<void>;
|
2326 | /**
|
2327 | * Merge remote contents
|
2328 | * Detects differences between a local and a remote item, and merges the
|
2329 | * two copies together.
|
2330 | * @returns {Promise.<Vault>} A promise that resolves with the newly merged archive -
|
2331 | * This archive is automatically saved over the original local copy.
|
2332 | * @memberof VaultSource
|
2333 | */
|
2334 | mergeFromRemote(): Promise<import("core/Vault.js")>;
|
2335 | /**
|
2336 | * Save the vault to the remote, ensuring that it's first merged and
|
2337 | * updated to prevent conflicts or overwrites.
|
2338 | * @returns {Promise}
|
2339 | * @memberof VaultSource
|
2340 | */
|
2341 | save(): Promise<any>;
|
2342 | unlock(vaultCredentials: any, config?: {}): Promise<any>;
|
2343 | /**
|
2344 | * Update the vault
|
2345 | * @returns {Promise} A promise that resolves once the update has
|
2346 | * completed
|
2347 | * @memberof VaultSource
|
2348 | */
|
2349 | update({ skipDiff }?: {
|
2350 | skipDiff?: boolean;
|
2351 | }): Promise<any>;
|
2352 | /**
|
2353 | * Write the vault to the remote
|
2354 | * - This does not perform any merging or sync checks, but simply
|
2355 | * writes the vault contents to the remote, overwriting whatever
|
2356 | * was there before.
|
2357 | * @returns {Promise} A promise that resolves when saving has completed
|
2358 | * @memberof VaultSource
|
2359 | */
|
2360 | write(): Promise<any>;
|
2361 | _applyShares(): void;
|
2362 | _enqueueStateChange(cb: any, stack: any): any;
|
2363 | _unloadShares(): void;
|
2364 | _updateCredentialsFromDatasource(): Promise<void>;
|
2365 | _updateInsights(): Promise<void>;
|
2366 | _updateVaultCredentials(newCredentials: any): Promise<void>;
|
2367 | /**
|
2368 | * Wait for the source to enter a non-pending state
|
2369 | * @protected
|
2370 | * @returns {Promise}
|
2371 | * @memberof VaultSource
|
2372 | */
|
2373 | protected _waitNonPending(): Promise<any>;
|
2374 | }
|
2375 | }
|
2376 | declare module "core/VaultManager" {
|
2377 | export = VaultManager;
|
2378 | const VaultManager_base: typeof import("eventemitter3");
|
2379 | /**
|
2380 | * @typedef {Object} VaultManagerOptions
|
2381 | * @property {Boolean=} autoUpdate Whether or not to auto update unlocked vaults
|
2382 | * @property {Number=} autoUpdateDelay Delay in milliseconds between auto-update
|
2383 | * checks
|
2384 | * @property {StorageInterface=} cacheStorage Storage adapter for storing
|
2385 | * cached vault contents for offline access
|
2386 | * @property {StorageInterface=} sourceStorage Storage adapter for storing
|
2387 | * managed vault details so that they can be rehydrated upon startup
|
2388 | */
|
2389 | /**
|
2390 | * Vault manager, to manage vault sources and their vaults
|
2391 | * @augments EventEmitter
|
2392 | * @memberof module:Buttercup
|
2393 | */
|
2394 | class VaultManager extends VaultManager_base {
|
2395 | /**
|
2396 | * Construct a new VaultManager
|
2397 | * @param {VaultManagerOptions=} opts Configuration options
|
2398 | */
|
2399 | constructor(opts?: VaultManagerOptions | undefined);
|
2400 | _sources: any[];
|
2401 | _cacheStorage: any;
|
2402 | _sourceStorage: any;
|
2403 | _queue: any;
|
2404 | _autoUpdateEnabled: boolean;
|
2405 | _autoUpdateDelay: number;
|
2406 | _autoUpdateTimer: NodeJS.Timeout;
|
2407 | _initialised: boolean;
|
2408 | /**
|
2409 | * Array of vault sources
|
2410 | * @type {VaultSource[]}
|
2411 | *
|
2412 | * VaultManager
|
2413 | */
|
2414 | readonly get sources(): import("core/VaultSource.js")[];
|
2415 | /**
|
2416 | * Array of unlocked vault sources
|
2417 | * @type {VaultSource[]}
|
2418 | * @readonly
|
2419 | * @memberof VaultManager
|
2420 | */
|
2421 | readonly get unlockedSources(): import("core/VaultSource.js")[];
|
2422 | /**
|
2423 | * @typedef {Object} AddSourceOptions
|
2424 | * @property {Number=} order Optional order override
|
2425 | */
|
2426 | /**
|
2427 | * Add a VaultSource to the VaultManager
|
2428 | * - The vault manager will then provide a management
|
2429 | * platform for the source, including storage access and
|
2430 | * event aggregation.
|
2431 | * @param {VaultSource} source The source to add
|
2432 | * @param {AddSourceOptions=} opts Options for adding the
|
2433 | * source
|
2434 | * @returns {Promise}
|
2435 | * @memberof VaultManager
|
2436 | */
|
2437 | addSource(source: import("core/VaultSource.js"), opts?: {
|
2438 | /**
|
2439 | * Optional order override
|
2440 | */
|
2441 | order?: number | undefined;
|
2442 | }): Promise<any>;
|
2443 | /**
|
2444 | * Dehydrate all sources and write them to storage
|
2445 | * @returns {Promise} A promise that resolves once all sources have been dehydrated
|
2446 | * @memberof VaultManager
|
2447 | */
|
2448 | dehydrate(): Promise<any>;
|
2449 | /**
|
2450 | * Dehydrate a single archive source
|
2451 | * @param {String} sourceID The ID of the source
|
2452 | * @returns {Promise} A promise that resolves once the source has been dehydrated
|
2453 | * @memberof VaultManager
|
2454 | */
|
2455 | dehydrateSource(sourceOrSourceID: any): Promise<any>;
|
2456 | /**
|
2457 | * Enqueue an asychronous change of state
|
2458 | * @param {Function} cb Callback to enqueue
|
2459 | * @returns {Promise}
|
2460 | * @memberof VaultManager
|
2461 | */
|
2462 | enqueueStateChange(cb: Function): Promise<any>;
|
2463 | /**
|
2464 | * Get the next viable order number for a new source
|
2465 | * @returns {Number} The new order
|
2466 | * @memberof VaultManager
|
2467 | */
|
2468 | getNextOrder(): number;
|
2469 | /**
|
2470 | * Get a source for an ID
|
2471 | * @param {String} sourceID The source ID
|
2472 | * @returns {Vaultsource|null} The source with the matching ID or null if not found
|
2473 | * @memberof VaultManager
|
2474 | */
|
2475 | getSourceForID(sourceID: string): any | null;
|
2476 | /**
|
2477 | * Get an array of sources that can be updated
|
2478 | * @returns {Array.<VaultSource>}
|
2479 | * @memberof VaultManager
|
2480 | */
|
2481 | getUpdateableSources(): Array<import("core/VaultSource.js")>;
|
2482 | /**
|
2483 | * Initialise the vault manager
|
2484 | * @memberof VaultManager
|
2485 | */
|
2486 | initialise(): void;
|
2487 | /**
|
2488 | * Wait for and interrupt state changes when auto-update is running
|
2489 | * @param {Function} cb The callback to execute during the auto-update interruption
|
2490 | * @returns {Promise} A promise that resolves when ready
|
2491 | * @memberof ArchiveManager
|
2492 | * @example
|
2493 | * archiveManager.interruptAutoUpdate(() => {
|
2494 | * // Do something with auto-updating paused
|
2495 | * });
|
2496 | */
|
2497 | interruptAutoUpdate(cb: Function): Promise<any>;
|
2498 | /**
|
2499 | * Rehydrate sources from storage
|
2500 | * @returns {Promise} A promise that resolves once rehydration has completed
|
2501 | * @memberof VaultManager
|
2502 | * @throws {VError} Rejects if rehydrating from storage fails
|
2503 | */
|
2504 | rehydrate(): Promise<any>;
|
2505 | /**
|
2506 | * Remove a source from the storage
|
2507 | * @param {String} sourceID The ID of the source to remove
|
2508 | * @returns {Promise} A promise that resolves once the source has been removed
|
2509 | * @memberof VaultManager
|
2510 | */
|
2511 | removeSource(sourceID: string): Promise<any>;
|
2512 | /**
|
2513 | * Reorder a source
|
2514 | * @param {String} sourceID The ID of the source to reorder
|
2515 | * @param {Number} position The 0-based position to move the source to
|
2516 | * @memberof VaultManager
|
2517 | * @throws {VError} Throws if no source is found
|
2518 | */
|
2519 | reorderSource(sourceID: string, position: number): void;
|
2520 | /**
|
2521 | * Reorder all sources
|
2522 | * @memberof VaultManager
|
2523 | */
|
2524 | reorderSources(): void;
|
2525 | /**
|
2526 | * Toggle auto updating of sources
|
2527 | * @param {Boolean=} enable Enable or disable auto updating. Leave empty
|
2528 | * to invert the setting
|
2529 | * @param {Number=} delay Milliseconds between updates
|
2530 | * @memberof VaultManager
|
2531 | */
|
2532 | toggleAutoUpdating(enable?: boolean | undefined, delay?: number | undefined): void;
|
2533 | _autoUpdateSources(): Promise<any>;
|
2534 | _startAutoUpdateTimer(): void;
|
2535 | _storeDehydratedSource(id: any, dehydratedSource: any): any;
|
2536 | }
|
2537 | namespace VaultManager {
|
2538 | export { VaultManagerOptions };
|
2539 | }
|
2540 | type VaultManagerOptions = {
|
2541 | /**
|
2542 | * Whether or not to auto update unlocked vaults
|
2543 | */
|
2544 | autoUpdate?: boolean | undefined;
|
2545 | /**
|
2546 | * Delay in milliseconds between auto-update
|
2547 | * checks
|
2548 | */
|
2549 | autoUpdateDelay?: number | undefined;
|
2550 | /**
|
2551 | * Storage adapter for storing
|
2552 | * cached vault contents for offline access
|
2553 | */
|
2554 | cacheStorage?: any;
|
2555 | /**
|
2556 | * Storage adapter for storing
|
2557 | * managed vault details so that they can be rehydrated upon startup
|
2558 | */
|
2559 | sourceStorage?: any;
|
2560 | };
|
2561 | }
|
2562 | declare module "datasources/TextDatasource" {
|
2563 | export = TextDatasource;
|
2564 | /**
|
2565 | * @typedef {Object} LoadedVaultData
|
2566 | * @property {VaultFormat} Format The vault format class that was detected
|
2567 | * when reading encrypted vault contents
|
2568 | * @property {Array.<String>} history Decrypted vault data
|
2569 | */
|
2570 | /**
|
2571 | * Datasource for text input and output
|
2572 | * @memberof module:Buttercup
|
2573 | */
|
2574 | class TextDatasource {
|
2575 | /**
|
2576 | * Constructor for the text datasource
|
2577 | * @param {Credentials} credentials The credentials and configuration for
|
2578 | * the datasource
|
2579 | */
|
2580 | constructor(credentials: import("credentials/Credentials.js"));
|
2581 | _credentials: import("credentials/Credentials.js");
|
2582 | _content: string;
|
2583 | type: string;
|
2584 | /**
|
2585 | * Datasource credentials
|
2586 | * @type {Credentials}
|
2587 | *
|
2588 | */
|
2589 | readonly get credentials(): import("credentials/Credentials.js");
|
2590 | /**
|
2591 | * Whether the datasource currently has content
|
2592 | * Used to check if the datasource has encrypted content that can be
|
2593 | * loaded. May be used when attempting to open a vault in offline mode.
|
2594 | * @type {Boolean}
|
2595 | * @memberof TextDatasource
|
2596 | */
|
2597 | get hasContent(): boolean;
|
2598 | /**
|
2599 | * Get the ID of the datasource
|
2600 | * ID to uniquely identify the datasource and its parameters
|
2601 | * @returns {String} A hasn of the datasource (unique ID)
|
2602 | * @memberof TextDataSource
|
2603 | */
|
2604 | getID(): string;
|
2605 | /**
|
2606 | * Load from the stored content using a password to decrypt
|
2607 | * @param {Credentials} credentials The password or Credentials instance to decrypt with
|
2608 | * @returns {Promise.<LoadedVaultData>} A promise that resolves with decrypted history
|
2609 | * @throws {Error} Rejects if content is empty
|
2610 | * @memberof TextDatasource
|
2611 | */
|
2612 | load(credentials: import("credentials/Credentials.js")): Promise<LoadedVaultData>;
|
2613 | /**
|
2614 | * Save archive contents with a password
|
2615 | * @param {Array.<String>} history Archive history to save
|
2616 | * @param {Credentials} credentials The Credentials instance to encrypt with
|
2617 | * @returns {Promise.<string>} A promise resolving with the encrypted content
|
2618 | * @memberof TextDatasource
|
2619 | */
|
2620 | save(vaultCommands: any, credentials: import("credentials/Credentials.js")): Promise<string>;
|
2621 | /**
|
2622 | * Set the text content
|
2623 | * @param {String} content The encrypted text content
|
2624 | * @returns {TextDatasource} Self
|
2625 | * @memberof TextDatasource
|
2626 | */
|
2627 | setContent(content: string): TextDatasource;
|
2628 | /**
|
2629 | * Whether or not the datasource supports the changing of the master password
|
2630 | * @returns {Boolean} True if the datasource supports password changing
|
2631 | * @memberof TextDataSource
|
2632 | */
|
2633 | supportsPasswordChange(): boolean;
|
2634 | /**
|
2635 | * Whether or not the datasource supports bypassing remote fetch operations
|
2636 | * (offline support)
|
2637 | * @returns {Boolean} True if content can be set to bypass fetch operations,
|
2638 | * false otherwise
|
2639 | * @memberof TextDatasource
|
2640 | */
|
2641 | supportsRemoteBypass(): boolean;
|
2642 | }
|
2643 | namespace TextDatasource {
|
2644 | export { LoadedVaultData };
|
2645 | }
|
2646 | type LoadedVaultData = {
|
2647 | /**
|
2648 | * The vault format class that was detected
|
2649 | * when reading encrypted vault contents
|
2650 | */
|
2651 | Format: any;
|
2652 | /**
|
2653 | * Decrypted vault data
|
2654 | */
|
2655 | history: Array<string>;
|
2656 | };
|
2657 | }
|
2658 | declare module "datasources/FileDatasource" {
|
2659 | export = FileDatasource;
|
2660 | const FileDatasource_base: typeof import("datasources/TextDatasource.js");
|
2661 | /**
|
2662 | * File datasource for loading and saving files
|
2663 | * @augments TextDatasource
|
2664 | * @memberof module:Buttercup
|
2665 | */
|
2666 | class FileDatasource extends FileDatasource_base {
|
2667 | /**
|
2668 | * Constructor for the file datasource
|
2669 | * @param {Credentials} credentials The credentials instance with which to
|
2670 | * use to configure the datasource
|
2671 | */
|
2672 | constructor(credentials: any);
|
2673 | _filename: any;
|
2674 | readFile: any;
|
2675 | writeFile: any;
|
2676 | /**
|
2677 | * The file path
|
2678 | * @type {String}
|
2679 | * FileDatasource
|
2680 | */
|
2681 | get path(): string;
|
2682 | }
|
2683 | }
|
2684 | declare module "datasources/WebDAVDatasource" {
|
2685 | export = WebDAVDatasource;
|
2686 | const WebDAVDatasource_base: typeof import("datasources/TextDatasource.js");
|
2687 | /**
|
2688 | * WebDAV datasource for reading and writing remote archives
|
2689 | * @augments TextDatasource
|
2690 | * @memberof module:Buttercup
|
2691 | */
|
2692 | class WebDAVDatasource extends WebDAVDatasource_base {
|
2693 | /**
|
2694 | * Constructor for the datasource
|
2695 | * @param {Credentials} credentials Credentials for the datasource
|
2696 | */
|
2697 | constructor(credentials: any);
|
2698 | _path: any;
|
2699 | _client: any;
|
2700 | /**
|
2701 | * The WebDAV client instance
|
2702 | * @type {Object}
|
2703 | * WebDAVDatasource
|
2704 | */
|
2705 | get client(): any;
|
2706 | /**
|
2707 | * The remote archive path
|
2708 | * @type {String}
|
2709 | * @memberof WebDAVDatasource
|
2710 | */
|
2711 | get path(): string;
|
2712 | }
|
2713 | }
|
2714 | declare module "datasources/DropboxDatasource" {
|
2715 | export = DropboxDatasource;
|
2716 | const DropboxDatasource_base: typeof import("datasources/TextDatasource.js");
|
2717 | /**
|
2718 | * Datasource for Dropbox archives
|
2719 | * @augments TextDatasource
|
2720 | * @memberof module:Buttercup
|
2721 | */
|
2722 | class DropboxDatasource extends DropboxDatasource_base {
|
2723 | /**
|
2724 | * Datasource for Dropbox accounts
|
2725 | * @param {Credentials} credentials Credentials instance to configure the
|
2726 | * datsource with
|
2727 | */
|
2728 | constructor(credentials: any);
|
2729 | path: any;
|
2730 | token: any;
|
2731 | client: any;
|
2732 | }
|
2733 | }
|
2734 | declare module "datasources/DatasourceAuthManager" {
|
2735 | export = DatasourceAuthManager;
|
2736 | /**
|
2737 | * Authentication manager
|
2738 | * @augments EventEmitter
|
2739 | * @memberof module:Buttercup
|
2740 | */
|
2741 | class DatasourceAuthManager {
|
2742 | /**
|
2743 | * Get the shared DatasourceAuthManager instance
|
2744 | * @returns {DatasourceAuthManager} The shared auth manager instance
|
2745 | * @static
|
2746 | * @memberof DatasourceAuthManager
|
2747 | */
|
2748 | static getSharedManager(): DatasourceAuthManager;
|
2749 | _handlers: {};
|
2750 | /**
|
2751 | * Execute auth handlers for a datasource
|
2752 | * @param {String} datasourceType The type of datasource (slug)
|
2753 | * @param {TextDatasource} datasourceInst The datasource instance
|
2754 | * @returns {Promise} A promise that resolves once execution has completed
|
2755 | * @throws {Error} Throws if no handlers have been specified
|
2756 | * @memberof DatasourceAuthManager
|
2757 | */
|
2758 | executeAuthHandlers(datasourceType: string, datasourceInst: any): Promise<any>;
|
2759 | /**
|
2760 | * Register an auth handler
|
2761 | * @param {String} datasourceType The datasource type
|
2762 | * @param {Function} handler The handler function
|
2763 | * @example
|
2764 | * authManager.registerHandler("googledrive", datasource => {
|
2765 | * return renewTokens().then(({ accessToken, refreshToken }) => {
|
2766 | * datasource.token = accessToken;
|
2767 | * datasource.refreshToken = refreshToken;
|
2768 | * });
|
2769 | * });
|
2770 | * @memberof DatasourceAuthManager
|
2771 | * @throws {Error} Throws if the handler argument is not a function
|
2772 | */
|
2773 | registerHandler(datasourceType: string, handler: Function): void;
|
2774 | }
|
2775 | }
|
2776 | declare module "datasources/GoogleDriveDatasource" {
|
2777 | export = GoogleDriveDatasource;
|
2778 | const GoogleDriveDatasource_base: typeof import("datasources/TextDatasource.js");
|
2779 | /**
|
2780 | * Datasource for Google Drive archives
|
2781 | * @augments TextDatasource
|
2782 | * @memberof module:Buttercup
|
2783 | */
|
2784 | class GoogleDriveDatasource extends GoogleDriveDatasource_base {
|
2785 | /**
|
2786 | * Datasource for Google Drive connections
|
2787 | * @param {Credentials} credentials The credentials instance with which to
|
2788 | * configure the datasource with
|
2789 | */
|
2790 | constructor(credentials: any);
|
2791 | fileID: any;
|
2792 | authManager: import("datasources/DatasourceAuthManager.js");
|
2793 | /**
|
2794 | * Update the OAuth2 tokens
|
2795 | * @param {String} accessToken The access token
|
2796 | * String=} refreshToken The refresh token
{ |
2797 | * GoogleDriveDatasource
|
2798 | */
|
2799 | updateTokens(accessToken: string, refreshToken?: string | undefined): void;
|
2800 | token: string;
|
2801 | refreshToken: string;
|
2802 | client: any;
|
2803 | }
|
2804 | }
|
2805 | declare module "myButtercup/symbols" {
|
2806 | export const API_INSIGHTS: any;
|
2807 | export const API_ORG_USERS: any;
|
2808 | export const API_OWN_ARCHIVE: any;
|
2809 | export const API_OWN_ARCHIVE_DETAILS: any;
|
2810 | export const API_OWN_DIGEST: any;
|
2811 | export const API_OWN_ORGS: any;
|
2812 | export const API_OWN_PASS_CHANGE: any;
|
2813 | export const API_OWN_PASS_CHANGE_VERIFY: any;
|
2814 | export const API_SHARES: any;
|
2815 | export const OAUTH_AUTHORISE_URI: string;
|
2816 | export const OAUTH_REDIRECT_URI: string;
|
2817 | export const OAUTH_TOKEN_URI: string;
|
2818 | }
|
2819 | declare module "myButtercup/MyButtercupClient" {
|
2820 | export = MyButtercupClient;
|
2821 | const MyButtercupClient_base: typeof import("eventemitter3");
|
2822 | /**
|
2823 | * My Buttercup client
|
2824 | * @augments EventEmitter
|
2825 | * @memberof module:Buttercup
|
2826 | */
|
2827 | class MyButtercupClient extends MyButtercupClient_base {
|
2828 | /**
|
2829 | * Exchange an auth code for tokens
|
2830 | * @param {String} authCode OAuth2 auth code, retrieved from browser-
|
2831 | * based OAuth2 flow using a user's username and password
|
2832 | * @param {String} clientID The OAuth2 client ID
|
2833 | * @param {String} clientSecret The OAuth2 client secret
|
2834 | * @param {String} redirectURI The OAuth2 client redirect URI
|
2835 | * @returns {MyButtercupTokenResult}
|
2836 | * @memberof MyButtercupClient
|
2837 | * @static
|
2838 | */
|
2839 | static exchangeAuthCodeForTokens(authCode: string, clientID: string, clientSecret: string, redirectURI: string): MyButtercupTokenResult;
|
2840 | /**
|
2841 | * Generate an OAuth2 authorisation URL using the client ID of the current
|
2842 | * application platform (eg. Buttercup browser extension)
|
2843 | * @param {String} clientID The OAuth2 client ID registered on
|
2844 | * my.buttercup.pw
|
2845 | * @returns {String} The generated URL
|
2846 | * @memberof MyButtercupClient
|
2847 | * @static
|
2848 | */
|
2849 | static generateAuthorisationURL(clientID: string): string;
|
2850 | /**
|
2851 | * Create a new client instance
|
2852 | * @param {String} clientID The client identifier
|
2853 | * @param {String} clientSecret The client secret
|
2854 | * @param {String} accessToken Access token
|
2855 | * @param {String} refreshToken Refresh token
|
2856 | */
|
2857 | constructor(clientID: string, clientSecret: string, accessToken: string, refreshToken: string);
|
2858 | _accessToken: string;
|
2859 | _refreshToken: string;
|
2860 | _lastDigest: any;
|
2861 | _clientID: string;
|
2862 | _clientSecret: string;
|
2863 | request: any;
|
2864 | /**
|
2865 | * The current access token
|
2866 | * @type {String}
|
2867 | *
|
2868 | */
|
2869 | readonly get accessToken(): string;
|
2870 | /**
|
2871 | * The last client digest response
|
2872 | * @type {MyButtercupDigest|null}
|
2873 | * @readonly
|
2874 | */
|
2875 | readonly get digest(): MyButtercupDigest;
|
2876 | /**
|
2877 | * The refresh token
|
2878 | * @type {String}
|
2879 | * @readonly
|
2880 | */
|
2881 | readonly get refreshToken(): string;
|
2882 | changePassword(password: any, passwordToken: any): Promise<any>;
|
2883 | /**
|
2884 | * Fetch user shares
|
2885 | * @param {String[]} ids Share IDs
|
2886 | * @returns {Promise.<Object.<String, MyButtercupEncryptedShare>>}
|
2887 | * @memberof MyButtercupClient
|
2888 | */
|
2889 | fetchShares(ids: string[]): Promise<any>;
|
2890 | /**
|
2891 | * Fetch user vault contents
|
2892 | * @returns {Promise.<{ archive: String, updateID: Number}>} The user's
|
2893 | * vault contents
|
2894 | * @memberof MyButtercupClient
|
2895 | */
|
2896 | fetchUserVault(): Promise<{
|
2897 | archive: string;
|
2898 | updateID: number;
|
2899 | }>;
|
2900 | /**
|
2901 | * Fetch the user's vault details
|
2902 | * @returns {Promise.<MyButtercupArchiveDetails>} The details of the vault
|
2903 | * @memberof MyButtercupClient
|
2904 | */
|
2905 | fetchUserVaultDetails(): Promise<MyButtercupArchiveDetails>;
|
2906 | /**
|
2907 | * Fetch and set account digest information
|
2908 | * @returns {Promise.<MyButtercupDigest>} Digest information
|
2909 | * @memberof MyButtercupClient
|
2910 | */
|
2911 | retrieveDigest(): Promise<MyButtercupDigest>;
|
2912 | /**
|
2913 | * Get the list of users available to address for the user
|
2914 | * @returns {Promise.<MyButtercupUsersListItem[]>}
|
2915 | * @memberof MyButtercupClient
|
2916 | */
|
2917 | retrieveUsersList(): Promise<MyButtercupUsersListItem[]>;
|
2918 | /**
|
2919 | * Get the list of users for an organisation
|
2920 | * (User must be present in organisation, or this method will fail)
|
2921 | * @param {Number} orgID The ID of the organisation
|
2922 | * @returns {Promise.<MyButtercupUsersListItem[]>}
|
2923 | * @memberof MyButtercupClient
|
2924 | */
|
2925 | retrieveUsersListForOrganisation(orgID: number): Promise<MyButtercupUsersListItem[]>;
|
2926 | /**
|
2927 | * Test if a password token is valid
|
2928 | * @param {String} passwordToken The password change token
|
2929 | * @returns {Promise}
|
2930 | * @memberof MyButtercupClient
|
2931 | */
|
2932 | testPasswordChange(passwordToken: string): Promise<any>;
|
2933 | /**
|
2934 | * Write insights to the remote account
|
2935 | * @param {Insights} insights The insights data
|
2936 | * @returns {Promise}
|
2937 | * @memberof MyButtercupClient
|
2938 | */
|
2939 | writeInsights(insights: any): Promise<any>;
|
2940 | /**
|
2941 | * Write the user vault contents back to the server
|
2942 | * @param {String} contents Encrypted vault contents
|
2943 | * @param {Number} previousUpdateID The previous update ID received
|
2944 | * from the server
|
2945 | * @param {Number} newUpdateID The new update ID to set after a
|
2946 | * successful write
|
2947 | * @returns {Promise} A promise that resolves once the write has
|
2948 | * been completed
|
2949 | * @memberof MyButtercupClient
|
2950 | */
|
2951 | writeUserArchive(contents: string, previousUpdateID: number, newUpdateID: number): Promise<any>;
|
2952 | /**
|
2953 | * Handle a request failure (processes token expiration etc.)
|
2954 | * @param {Error} err The received error from making a request
|
2955 | * @throws {Error} Throws if the error was not catchable
|
2956 | * @returns {Promise} Returns a promise if an action can be taken
|
2957 | * to remedy the situation
|
2958 | * @memberof MyButtercupClient
|
2959 | * @protected
|
2960 | */
|
2961 | protected _handleRequestFailure(err: Error): Promise<any>;
|
2962 | /**
|
2963 | * Refresh tokens
|
2964 | * @memberof MyButtercupClient
|
2965 | * @protected
|
2966 | * @returns {Promise}
|
2967 | * @fires MyButtercupClient#tokensUpdated
|
2968 | */
|
2969 | protected _performTokenRefresh(): Promise<any>;
|
2970 | }
|
2971 | namespace MyButtercupClient {
|
2972 | export { MyButtercupShareBase, MyButtercupIncomingShare, MyButtercupEncryptedShare, MyButtercupOrganisation, MyButtercupDigest, MyButtercupUsersListItem, MyButtercupTokenResult, MyButtercupArchiveDetails };
|
2973 | }
|
2974 | type MyButtercupDigest = {
|
2975 | /**
|
2976 | * The ID of the user's archive
|
2977 | */
|
2978 | archive_id: number;
|
2979 | /**
|
2980 | * The RSA public key for the user
|
2981 | */
|
2982 | public_key: string;
|
2983 | /**
|
2984 | * System messages for the user (internal processing)
|
2985 | */
|
2986 | messages: Array<any>;
|
2987 | /**
|
2988 | * An array of new shares to process
|
2989 | */
|
2990 | new_shares: Array<MyButtercupIncomingShare>;
|
2991 | /**
|
2992 | * An array of user organisations
|
2993 | */
|
2994 | organisations: Array<MyButtercupOrganisation>;
|
2995 | };
|
2996 | type MyButtercupArchiveDetails = {
|
2997 | /**
|
2998 | * The remote vault ID
|
2999 | */
|
3000 | id: number;
|
3001 | /**
|
3002 | * The current update ID for the vault
|
3003 | */
|
3004 | updateID: number;
|
3005 | /**
|
3006 | * The creation date
|
3007 | */
|
3008 | created: string;
|
3009 | /**
|
3010 | * The last update date
|
3011 | */
|
3012 | lastUpdate: string;
|
3013 | };
|
3014 | type MyButtercupUsersListItem = {
|
3015 | /**
|
3016 | * The ID of the user
|
3017 | */
|
3018 | user_id: number;
|
3019 | /**
|
3020 | * The organisation ID the user was found in
|
3021 | */
|
3022 | organisation_id: number;
|
3023 | /**
|
3024 | * The name of the user
|
3025 | */
|
3026 | name: string;
|
3027 | /**
|
3028 | * The public key for the user
|
3029 | */
|
3030 | public_key: string;
|
3031 | };
|
3032 | type MyButtercupTokenResult = {
|
3033 | /**
|
3034 | * An OAuth2 access token for API requests
|
3035 | */
|
3036 | accessToken: string;
|
3037 | /**
|
3038 | * An OAuth2 refresh token
|
3039 | */
|
3040 | refreshToken: string;
|
3041 | };
|
3042 | type MyButtercupShareBase = {
|
3043 | /**
|
3044 | * The share ID
|
3045 | */
|
3046 | id: string;
|
3047 | /**
|
3048 | * The share title
|
3049 | */
|
3050 | title: string;
|
3051 | /**
|
3052 | * Permission to read
|
3053 | */
|
3054 | perm_read: boolean;
|
3055 | /**
|
3056 | * Permission to write changes
|
3057 | */
|
3058 | perm_write: boolean;
|
3059 | /**
|
3060 | * Permission to share with others, remove share access etc.
|
3061 | */
|
3062 | perm_manage: boolean;
|
3063 | };
|
3064 | type MyButtercupIncomingShare = {
|
3065 | /**
|
3066 | * The share ID
|
3067 | */
|
3068 | id: string;
|
3069 | /**
|
3070 | * The share title
|
3071 | */
|
3072 | title: string;
|
3073 | /**
|
3074 | * Permission to read
|
3075 | */
|
3076 | perm_read: boolean;
|
3077 | /**
|
3078 | * Permission to write changes
|
3079 | */
|
3080 | perm_write: boolean;
|
3081 | /**
|
3082 | * Permission to share with others, remove share access etc.
|
3083 | */
|
3084 | perm_manage: boolean;
|
3085 | };
|
3086 | type MyButtercupEncryptedShare = {
|
3087 | /**
|
3088 | * The share ID
|
3089 | */
|
3090 | id: string;
|
3091 | /**
|
3092 | * The share title
|
3093 | */
|
3094 | title: string;
|
3095 | /**
|
3096 | * Permission to read
|
3097 | */
|
3098 | perm_read: boolean;
|
3099 | /**
|
3100 | * Permission to write changes
|
3101 | */
|
3102 | perm_write: boolean;
|
3103 | /**
|
3104 | * Permission to share with others, remove share access etc.
|
3105 | */
|
3106 | perm_manage: boolean;
|
3107 | };
|
3108 | type MyButtercupOrganisation = {
|
3109 | /**
|
3110 | * The organisation's ID
|
3111 | */
|
3112 | id: number;
|
3113 | /**
|
3114 | * The organisation name
|
3115 | */
|
3116 | name: string;
|
3117 | /**
|
3118 | * The creation date
|
3119 | */
|
3120 | created: string;
|
3121 | };
|
3122 | }
|
3123 | declare module "myButtercup/update" {
|
3124 | /**
|
3125 | * Generate a new update ID
|
3126 | * @returns {Number} A randomly generated ID
|
3127 | */
|
3128 | export function generateNewUpdateID(): number;
|
3129 | }
|
3130 | declare module "datasources/MyButtercupDatasource" {
|
3131 | export = MyButtercupDatasource;
|
3132 | const MyButtercupDatasource_base: typeof import("datasources/TextDatasource.js");
|
3133 | /**
|
3134 | * My Buttercup datasource
|
3135 | * @augments TextDatasource
|
3136 | * @memberof module:Buttercup
|
3137 | */
|
3138 | class MyButtercupDatasource extends MyButtercupDatasource_base {
|
3139 | /**
|
3140 | * Constructor for the datasource
|
3141 | * @param {Credentials} credentials Credentials for the datasource
|
3142 | * @memberof MyButtercupDatasource
|
3143 | */
|
3144 | constructor(credentials: import("credentials/Credentials.js"));
|
3145 | accessToken: any;
|
3146 | refreshToken: any;
|
3147 | _clientID: any;
|
3148 | _clientSecret: any;
|
3149 | _client: import("myButtercup/MyButtercupClient.js");
|
3150 | _vaultID: any;
|
3151 | _updateID: number;
|
3152 | /**
|
3153 | * @type {MyButtercupClient}
|
3154 | *
|
3155 | * MyButtercupDatasource
|
3156 | */
|
3157 | readonly get client(): import("myButtercup/MyButtercupClient.js");
|
3158 | /**
|
3159 | * Change the master password for the vault
|
3160 | * (Called with a preflight check to ensure that the datasource is
|
3161 | * ready to change - if not ready, the method will return false)
|
3162 | * @param {*} newCredentials
|
3163 | * @param {*} preflight
|
3164 | * @returns {Promise.<Boolean|undefined>} A promise that resolves
|
3165 | * with a boolean value during preflight, or with simply undefined
|
3166 | * if performing the final change action.
|
3167 | * @example
|
3168 | * const creds = Credentials.fromPassword("test");
|
3169 | * const isReady = await tds.changePassword(
|
3170 | * creds,
|
3171 | * true // preflight
|
3172 | * );
|
3173 | * if (!isReady) {
|
3174 | * throw new Error("Datasource unable to change password");
|
3175 | * }
|
3176 | * await tds.changePassword(creds, false);
|
3177 | */
|
3178 | changePassword(newCredentials: any, preflight: any): Promise<boolean | undefined>;
|
3179 | /**
|
3180 | * Override for history difference checking
|
3181 | * @see Workspace#localDiffersFromRemote
|
3182 | * @param {Credentials} masterCredentials Master service credentials
|
3183 | * @param {String[]} archiveHistory Archive history lines
|
3184 | * @returns {Promise.<Boolean>} True if differing, false otherwise
|
3185 | * @memberof MyButtercupDatasource
|
3186 | */
|
3187 | localDiffersFromRemote(masterCredentials: import("credentials/Credentials.js"), archiveHistory: string[]): Promise<boolean>;
|
3188 | /**
|
3189 | * Whether or not the datasource supports the changing of the master password
|
3190 | * @returns {Boolean} True if it supports changing the master password
|
3191 | * @memberof WebDAVDatasource
|
3192 | */
|
3193 | supportsChangePassword(): boolean;
|
3194 | /**
|
3195 | * Update vault/account insights
|
3196 | * @param {Insights} insights Insights to update
|
3197 | * @returns {Promise}
|
3198 | * @memberof MyButtercupDatasource
|
3199 | */
|
3200 | updateInsights(insights: any): Promise<any>;
|
3201 | /**
|
3202 | * Update the OAuth2 tokens
|
3203 | * @param {String} accessToken The access token
|
3204 | * @param {String} refreshToken The refresh token
|
3205 | * @memberof MyButtercupDatasource
|
3206 | */
|
3207 | updateTokens(accessToken: string, refreshToken: string, updateClientTokens?: boolean): void;
|
3208 | /**
|
3209 | * Create a new MyButtercupClient instance and attach
|
3210 | * event listeners
|
3211 | * @protected
|
3212 | * @memberof MyButtercupDatasource
|
3213 | * @fires MyButtercupDatasource#updatedClient
|
3214 | */
|
3215 | protected _createNewClient(): void;
|
3216 | _onTokensUpdated: () => void;
|
3217 | }
|
3218 | }
|
3219 | declare module "tools/vaultSearch" {
|
3220 | /**
|
3221 | * Find entry instances by filtering with a compare function
|
3222 | * @param {Array.<Group>} groups The groups to check in
|
3223 | * @param {Function} compareFn The callback comparison function, return true to keep and false
|
3224 | * to strip
|
3225 | * @returns {Array.<Entry>} An array of found entries
|
3226 | */
|
3227 | export function findEntriesByCheck(groups: Array<any>, compareFn: Function): Array<any>;
|
3228 | /**
|
3229 | * Find group instances within groups that satisfy some check
|
3230 | * @param {Array.<Group>} groups The groups to check within
|
3231 | * @param {Function} compareFn A comparision function - return true to keep, false to strip
|
3232 | * @returns {Array.<Group>} An array of found groups
|
3233 | */
|
3234 | export function findGroupsByCheck(groups: Array<any>, compareFn: Function): Array<any>;
|
3235 | /**
|
3236 | * Get all entries within a collection of groups
|
3237 | * @param {Array.<Group>} groups An array of groups
|
3238 | * @returns {Array.<Entry>} An array of entries
|
3239 | */
|
3240 | export function getAllEntries(groups: Array<any>): Array<any>;
|
3241 | }
|
3242 | declare module "search/EntryFinder" {
|
3243 | export = EntryFinder;
|
3244 | /**
|
3245 | * @typedef {Object} EntrySearchInfo
|
3246 | * @property {Entry} entry The entry
|
3247 | * @property {Archive} archive The associated archive
|
3248 | */
|
3249 | /**
|
3250 | * Entry searching class
|
3251 | */
|
3252 | class EntryFinder {
|
3253 | /**
|
3254 | * @param {Array.<Archive>|Archive} target The archive or archives to search
|
3255 | */
|
3256 | constructor(target: Array<any> | any);
|
3257 | _items: EntrySearchInfo[];
|
3258 | _fuse: Fuse;
|
3259 | _lastResult: any[];
|
3260 | /**
|
3261 | * All items available for searching
|
3262 | * @type {Array.<EntrySearchInfo>}
|
3263 | */
|
3264 | get items(): EntrySearchInfo[];
|
3265 | /**
|
3266 | * The last result
|
3267 | * @type {Array.<EntrySearchInfo>}
|
3268 | */
|
3269 | get lastResult(): EntrySearchInfo[];
|
3270 | /**
|
3271 | * Initialise the searching mechanism
|
3272 | */
|
3273 | initSearcher(): void;
|
3274 | /**
|
3275 | * Search and get results
|
3276 | * @param {String} term The search term
|
3277 | * @returns {Array.<EntrySearchInfo>} The results
|
3278 | */
|
3279 | search(term: string): Array<EntrySearchInfo>;
|
3280 | }
|
3281 | namespace EntryFinder {
|
3282 | export { EntrySearchInfo };
|
3283 | }
|
3284 | type EntrySearchInfo = {
|
3285 | /**
|
3286 | * The entry
|
3287 | */
|
3288 | entry: any;
|
3289 | /**
|
3290 | * The associated archive
|
3291 | */
|
3292 | archive: any;
|
3293 | };
|
3294 | }
|
3295 | declare module "index.common" {
|
3296 | export const DEFAULT_ENTRY_TYPE: string;
|
3297 | export const DEFAULT_FIELD_TYPE: string;
|
3298 | export const ENTRY_TYPE_CREDITCARD: string;
|
3299 | export const ENTRY_TYPE_LOGIN: string;
|
3300 | export const ENTRY_TYPE_NOTE: string;
|
3301 | export const ENTRY_TYPE_SSHKEY: string;
|
3302 | export const ENTRY_TYPE_WEBSITE: string;
|
3303 | export const ENTRY_TYPES: any;
|
3304 | export const ENTRY_URL_TYPE_ANY: string;
|
3305 | export const ENTRY_URL_TYPE_GENERAL: string;
|
3306 | export const ENTRY_URL_TYPE_ICON: string;
|
3307 | export const ENTRY_URL_TYPE_LOGIN: string;
|
3308 | export const FIELD_VALUE_TYPE_NOTE: string;
|
3309 | export const FIELD_VALUE_TYPE_OTP: string;
|
3310 | export const FIELD_VALUE_TYPE_PASSWORD: string;
|
3311 | export const FIELD_VALUE_TYPE_TEXT: string;
|
3312 | export const FIELD_VALUE_TYPES: any;
|
3313 | export const VaultManager: typeof import("core/VaultManager.js");
|
3314 | export const VaultSource: typeof import("core/VaultSource.js");
|
3315 | export const Vault: typeof import("core/Vault.js");
|
3316 | export const Group: typeof import("core/Group.js");
|
3317 | export const Entry: typeof import("core/Entry.js");
|
3318 | export const Credentials: typeof import("credentials/Credentials.js");
|
3319 | export const TextDatasource: typeof import("datasources/TextDatasource.js");
|
3320 | export const FileDatasource: typeof import("datasources/FileDatasource.js");
|
3321 | export const WebDAVDatasource: typeof import("datasources/WebDAVDatasource.js");
|
3322 | export const DropboxDatasource: typeof import("datasources/DropboxDatasource.js");
|
3323 | export const GoogleDriveDatasource: typeof import("datasources/GoogleDriveDatasource.js");
|
3324 | export const MyButtercupDatasource: typeof import("datasources/MyButtercupDatasource.js");
|
3325 | export const DatasourceAuthManager: typeof import("datasources/DatasourceAuthManager.js");
|
3326 | export const registerDatasource: (datasourceType: string, DSClass: any) => void;
|
3327 | export const MyButtercupClient: typeof import("myButtercup/MyButtercupClient.js");
|
3328 | export const StorageInterface: typeof import("storage/StorageInterface.js");
|
3329 | export const MemoryStorageInterface: typeof import("storage/MemoryStorageInterface.js");
|
3330 | export const EntryFinder: typeof import("search/EntryFinder.js");
|
3331 | export const consumeEntryFacade: (entry: import("core/Entry.js"), facade: import("facades/entry.js").EntryFacade) => void;
|
3332 | export const consumeGroupFacade: (group: any, facade: import("facades/vault.js").GroupFacade) => void;
|
3333 | export const consumeVaultFacade: (vault: any, facade: import("facades/vault.js").VaultFacade) => void;
|
3334 | export const createEntryFacade: (entry?: import("core/Entry.js"), { type }?: import("facades/entry.js").CreateEntryFacadeOptions) => import("facades/entry.js").EntryFacade;
|
3335 | export const createFieldDescriptor: (entry: any, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any) => import("facades/tools.js").EntryFacadeField;
|
3336 | export const createGroupFacade: (group: any, parentID?: string) => {
|
3337 | type: string;
|
3338 | id: any;
|
3339 | title: any;
|
3340 | attributes: any;
|
3341 | parentID: string;
|
3342 | };
|
3343 | export const createVaultFacade: (vault: any) => import("facades/vault.js").VaultFacade;
|
3344 | export const isOTPURI: (str: string) => boolean;
|
3345 | export const isVaultFacade: (obj: any) => boolean;
|
3346 | export const getSharedAppEnv: () => any;
|
3347 | export const getEntryURLs: (properties: any, preference?: any) => any[];
|
3348 | }
|
3349 | declare module "env/native/crypto" {
|
3350 | export function getCryptoResources(): {
|
3351 | "crypto/v1/decryptBuffer": typeof decryptData;
|
3352 | "crypto/v1/encryptBuffer": typeof encryptData;
|
3353 | "crypto/v1/decryptText": typeof decryptData;
|
3354 | "crypto/v1/encryptText": typeof encryptData;
|
3355 | "crypto/v1/setDerivationRounds": typeof setDerivationRounds;
|
3356 | };
|
3357 | function decryptData(data: any, password: any): Promise<string | ArrayBuffer | Buffer>;
|
3358 | function encryptData(data: any, password: any): Promise<string | ArrayBuffer | Buffer>;
|
3359 | function setDerivationRounds(rounds?: any): void;
|
3360 | export {};
|
3361 | }
|
3362 | declare module "env/native/compression" {
|
3363 | export function getCompressionResources(): {
|
3364 | "compression/v1/compressText": typeof compress;
|
3365 | "compression/v1/decompressText": typeof decompress;
|
3366 | };
|
3367 | /**
|
3368 | * Compress text using GZIP
|
3369 | * @param {String} text The text to compress
|
3370 | * @returns {String} Compressed text
|
3371 | */
|
3372 | function compress(text: string): string;
|
3373 | /**
|
3374 | * Decompress a compressed string (GZIP)
|
3375 | * @param {String} text The compressed text
|
3376 | * @returns {String} Decompressed text
|
3377 | */
|
3378 | function decompress(text: string): string;
|
3379 | export {};
|
3380 | }
|
3381 | declare module "env/native/net" {
|
3382 | export function getNetResources(): {
|
3383 | "net/webdav/v1/newClient": any;
|
3384 | };
|
3385 | }
|
3386 | declare module "env/native/index" {
|
3387 | export function applyNativeConfiguration(appEnv: any): void;
|
3388 | }
|
3389 | declare module "index.node" {
|
3390 | const _exports: {
|
3391 | DEFAULT_ENTRY_TYPE: string;
|
3392 | DEFAULT_FIELD_TYPE: string;
|
3393 | ENTRY_TYPE_CREDITCARD: string;
|
3394 | ENTRY_TYPE_LOGIN: string;
|
3395 | ENTRY_TYPE_NOTE: string;
|
3396 | ENTRY_TYPE_SSHKEY: string;
|
3397 | ENTRY_TYPE_WEBSITE: string;
|
3398 | ENTRY_TYPES: any;
|
3399 | ENTRY_URL_TYPE_ANY: string;
|
3400 | ENTRY_URL_TYPE_GENERAL: string;
|
3401 | ENTRY_URL_TYPE_ICON: string;
|
3402 | ENTRY_URL_TYPE_LOGIN: string;
|
3403 | FIELD_VALUE_TYPE_NOTE: string;
|
3404 | FIELD_VALUE_TYPE_OTP: string;
|
3405 | FIELD_VALUE_TYPE_PASSWORD: string;
|
3406 | FIELD_VALUE_TYPE_TEXT: string;
|
3407 | FIELD_VALUE_TYPES: any;
|
3408 | VaultManager: typeof import("core/VaultManager.js");
|
3409 | VaultSource: typeof import("core/VaultSource.js");
|
3410 | Vault: typeof import("core/Vault.js");
|
3411 | Group: typeof import("core/Group.js");
|
3412 | Entry: typeof import("core/Entry.js");
|
3413 | Credentials: typeof import("credentials/Credentials.js");
|
3414 | TextDatasource: typeof import("datasources/TextDatasource.js");
|
3415 | FileDatasource: typeof import("datasources/FileDatasource.js");
|
3416 | WebDAVDatasource: typeof import("datasources/WebDAVDatasource.js");
|
3417 | DropboxDatasource: typeof import("datasources/DropboxDatasource.js");
|
3418 | GoogleDriveDatasource: typeof import("datasources/GoogleDriveDatasource.js");
|
3419 | MyButtercupDatasource: typeof import("datasources/MyButtercupDatasource.js");
|
3420 | DatasourceAuthManager: typeof import("datasources/DatasourceAuthManager.js");
|
3421 | registerDatasource: (datasourceType: string, DSClass: any) => void;
|
3422 | MyButtercupClient: typeof import("myButtercup/MyButtercupClient.js");
|
3423 | StorageInterface: typeof import("storage/StorageInterface.js");
|
3424 | MemoryStorageInterface: typeof import("storage/MemoryStorageInterface.js");
|
3425 | EntryFinder: typeof import("search/EntryFinder.js");
|
3426 | consumeEntryFacade: (entry: import("core/Entry.js"), facade: import("facades/entry.js").EntryFacade) => void;
|
3427 | consumeGroupFacade: (group: any, facade: import("facades/vault.js").GroupFacade) => void;
|
3428 | consumeVaultFacade: (vault: any, facade: import("facades/vault.js").VaultFacade) => void;
|
3429 | createEntryFacade: (entry?: import("core/Entry.js"), { type }?: import("facades/entry.js").CreateEntryFacadeOptions) => import("facades/entry.js").EntryFacade;
|
3430 | createFieldDescriptor: (entry: any, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any) => import("facades/tools.js").EntryFacadeField;
|
3431 | createGroupFacade: (group: any, parentID?: string) => {
|
3432 | type: string;
|
3433 | id: any;
|
3434 | title: any;
|
3435 | attributes: any;
|
3436 | parentID: string;
|
3437 | };
|
3438 | createVaultFacade: (vault: any) => import("facades/vault.js").VaultFacade;
|
3439 | isOTPURI: (str: string) => boolean;
|
3440 | isVaultFacade: (obj: any) => boolean;
|
3441 | getSharedAppEnv: () => any;
|
3442 | getEntryURLs: (properties: any, preference?: any) => any[];
|
3443 | } & {
|
3444 | init: typeof init;
|
3445 | };
|
3446 | export = _exports;
|
3447 | /**
|
3448 | * Initialise the node/native environment
|
3449 | * @memberof module:Buttercup
|
3450 | */
|
3451 | function init(): void;
|
3452 | }
|
3453 | declare module "env/web/crypto" {
|
3454 | export function getCryptoResources(): {
|
3455 | "crypto/v1/decryptBuffer": typeof decryptData;
|
3456 | "crypto/v1/encryptBuffer": typeof encryptData;
|
3457 | "crypto/v1/decryptText": typeof decryptData;
|
3458 | "crypto/v1/encryptText": typeof encryptData;
|
3459 | "crypto/v1/setDerivationRounds": typeof setDerivationRounds;
|
3460 | };
|
3461 | function decryptData(data: any, password: any): any;
|
3462 | function encryptData(data: any, password: any): any;
|
3463 | function setDerivationRounds(rounds?: any): void;
|
3464 | export {};
|
3465 | }
|
3466 | declare module "env/web/compression" {
|
3467 | export function getCompressionResources(): {
|
3468 | "compression/v1/compressText": typeof compress;
|
3469 | "compression/v1/decompressText": typeof decompress;
|
3470 | };
|
3471 | /**
|
3472 | * Compress text using GZIP
|
3473 | * @param {String} text The text to compress
|
3474 | * @returns {String} Compressed text
|
3475 | */
|
3476 | function compress(text: string): string;
|
3477 | /**
|
3478 | * Decompress a compressed string (GZIP)
|
3479 | * @param {String} text The compressed text
|
3480 | * @returns {String} Decompressed text
|
3481 | */
|
3482 | function decompress(text: string): string;
|
3483 | export {};
|
3484 | }
|
3485 | declare module "env/web/net" {
|
3486 | export function getNetResources(): {
|
3487 | "net/webdav/v1/newClient": any;
|
3488 | };
|
3489 | }
|
3490 | declare module "env/web/index" {
|
3491 | export function applyWebConfiguration(appEnv: any): void;
|
3492 | }
|
3493 | declare module "web/LocalStorageInterface" {
|
3494 | export = LocalStorageInterface;
|
3495 | const LocalStorageInterface_base: typeof import("storage/StorageInterface.js");
|
3496 | /**
|
3497 | * Interface for localStorage
|
3498 | * @augments StorageInterface
|
3499 | */
|
3500 | class LocalStorageInterface extends LocalStorageInterface_base {
|
3501 | _storage: Storage;
|
3502 | get storage(): Storage;
|
3503 | }
|
3504 | }
|
3505 | declare module "web/index" {
|
3506 | export const LocalStorageInterface: typeof import("web/LocalStorageInterface.js");
|
3507 | }
|
3508 | declare module "index.web" {
|
3509 | const _exports: {
|
3510 | DEFAULT_ENTRY_TYPE: string;
|
3511 | DEFAULT_FIELD_TYPE: string;
|
3512 | ENTRY_TYPE_CREDITCARD: string;
|
3513 | ENTRY_TYPE_LOGIN: string;
|
3514 | ENTRY_TYPE_NOTE: string;
|
3515 | ENTRY_TYPE_SSHKEY: string;
|
3516 | ENTRY_TYPE_WEBSITE: string;
|
3517 | ENTRY_TYPES: any;
|
3518 | ENTRY_URL_TYPE_ANY: string;
|
3519 | ENTRY_URL_TYPE_GENERAL: string;
|
3520 | ENTRY_URL_TYPE_ICON: string;
|
3521 | ENTRY_URL_TYPE_LOGIN: string;
|
3522 | FIELD_VALUE_TYPE_NOTE: string;
|
3523 | FIELD_VALUE_TYPE_OTP: string;
|
3524 | FIELD_VALUE_TYPE_PASSWORD: string;
|
3525 | FIELD_VALUE_TYPE_TEXT: string;
|
3526 | FIELD_VALUE_TYPES: any;
|
3527 | VaultManager: typeof import("core/VaultManager.js");
|
3528 | VaultSource: typeof import("core/VaultSource.js");
|
3529 | Vault: typeof import("core/Vault.js");
|
3530 | Group: typeof import("core/Group.js");
|
3531 | Entry: typeof import("core/Entry.js");
|
3532 | Credentials: typeof import("credentials/Credentials.js");
|
3533 | TextDatasource: typeof import("datasources/TextDatasource.js");
|
3534 | FileDatasource: typeof import("datasources/FileDatasource.js");
|
3535 | WebDAVDatasource: typeof import("datasources/WebDAVDatasource.js");
|
3536 | DropboxDatasource: typeof import("datasources/DropboxDatasource.js");
|
3537 | GoogleDriveDatasource: typeof import("datasources/GoogleDriveDatasource.js");
|
3538 | MyButtercupDatasource: typeof import("datasources/MyButtercupDatasource.js");
|
3539 | DatasourceAuthManager: typeof import("datasources/DatasourceAuthManager.js");
|
3540 | registerDatasource: (datasourceType: string, DSClass: any) => void;
|
3541 | MyButtercupClient: typeof import("myButtercup/MyButtercupClient.js");
|
3542 | StorageInterface: typeof import("storage/StorageInterface.js");
|
3543 | MemoryStorageInterface: typeof import("storage/MemoryStorageInterface.js");
|
3544 | EntryFinder: typeof import("search/EntryFinder.js");
|
3545 | consumeEntryFacade: (entry: import("core/Entry.js"), facade: import("facades/entry.js").EntryFacade) => void;
|
3546 | consumeGroupFacade: (group: any, facade: import("facades/vault.js").GroupFacade) => void;
|
3547 | consumeVaultFacade: (vault: any, facade: import("facades/vault.js").VaultFacade) => void;
|
3548 | createEntryFacade: (entry?: import("core/Entry.js"), { type }?: import("facades/entry.js").CreateEntryFacadeOptions) => import("facades/entry.js").EntryFacade;
|
3549 | createFieldDescriptor: (entry: any, title: string, entryPropertyType: string, entryPropertyName: string, { formatting, removeable, valueType }?: any) => import("facades/tools.js").EntryFacadeField;
|
3550 | createGroupFacade: (group: any, parentID?: string) => {
|
3551 | type: string;
|
3552 | id: any;
|
3553 | title: any;
|
3554 | attributes: any;
|
3555 | parentID: string;
|
3556 | };
|
3557 | createVaultFacade: (vault: any) => import("facades/vault.js").VaultFacade;
|
3558 | isOTPURI: (str: string) => boolean;
|
3559 | isVaultFacade: (obj: any) => boolean;
|
3560 | getSharedAppEnv: () => any;
|
3561 | getEntryURLs: (properties: any, preference?: any) => any[];
|
3562 | } & {
|
3563 | LocalStorageInterface: typeof import("web/LocalStorageInterface.js");
|
3564 | } & {
|
3565 | init: typeof init;
|
3566 | };
|
3567 | export = _exports;
|
3568 | /**
|
3569 | * Initialise the web environment
|
3570 | * @memberof module:Buttercup
|
3571 | */
|
3572 | function init(): void;
|
3573 | }
|
3574 | declare module "test" {
|
3575 | export {};
|
3576 | }
|
3577 | declare module "facades/hash" {
|
3578 | /**
|
3579 | * Generate a hash of a vault facade (useful for detecting
|
3580 | * if the vault differs from another copy)
|
3581 | * @param {VaultFacade} vaultFacade A facade instance
|
3582 | * @returns {String} Hash string
|
3583 | * @deprecated Poor performance - rely on `VaultFacade#_tag` instead
|
3584 | */
|
3585 | export function hashVaultFacade(vaultFacade: any): string;
|
3586 | }
|