///
import { AnnotatedKey, KeyAnnotation } from "./AnnotatedKey";
import { BossObject } from "uparsecjs";
export declare class AnnotatedKeyring {
private readonly keys;
private readonly passwords;
private readonly passwordTags;
private readonly keyTags;
static Exception: {
new (message?: string | undefined): {
name: string;
message: string;
stack?: string | undefined;
};
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
};
static TooManyKeysException: {
new (message?: string | undefined): {
name: string;
message: string;
stack?: string | undefined;
};
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
};
constructor(...keys: AnnotatedKey[]);
clone(): AnnotatedKeyring;
addKeys(...keys: AnnotatedKey[]): AnnotatedKeyring;
addTaggedKeys(...tks: {
key: AnnotatedKey;
tags?: string[];
}[]): AnnotatedKeyring;
tags(source: AnnotatedKey | KeyAnnotation | string): Set;
allKeys(): {
key: AnnotatedKey;
tags: Set;
}[];
allPasswords(): Map>;
addTaggedPasswords(...passwords: {
password: string;
tags?: string[];
}[]): AnnotatedKeyring;
addPasswords(...passwords: string[]): AnnotatedKeyring;
/**
* Find the key in the ring that matches annotation. It checks all keys and all passwords in the ring,
* so it could be slow. Returns only _the first key/password that matches_.
* @param annotations that our key must match
*/
findKey(...annotations: KeyAnnotation[]): Promise;
keysByTag(...tags: string[]): AnnotatedKey[];
/**
* Retrieve a single key by a tag or undefined. If there are more than one key with such tag, throws exception.
* Use {@link keysByTag} to retrieve several keys, or any of them.
* @param tag to look for
* @return matched key or undefined
* @throws AnnotatedKeyring.TooManyKeysException if there are more than one matching keys.
*/
taggedKey(tag: string): AnnotatedKey | undefined;
addTagsTo(item: KeyAnnotation | AnnotatedKey | string, ...tags: string[]): AnnotatedKeyring;
addTagsToPassword(password: string, ...tags: string[]): AnnotatedKeyring;
mergeWith(other: AnnotatedKeyring): AnnotatedKeyring;
toMap(): Promise;
static fromMap(source: BossObject): Promise;
}