/** * AddressBook holds the contacts, groups and actions of a user. */ import Long from "long"; import { BehaviorSubject } from "rxjs"; import { InstanceID } from "@dedis/cothority/byzcoin"; import { Darc, IIdentity } from "@dedis/cothority/darc"; import { CoinBS, DarcBS, DarcsBS } from "./byzcoin"; import { AttributeInstanceSetBS, CredentialStructBS } from "./credentialStructBS"; import { SpawnerTransactionBuilder } from "./spawnerTransactionBuilder"; import { UserSkeleton } from "./userSkeleton"; /** * The `AddressBook` represents the following DARCs of the `CredentialStruct`: * - `credPublic.contacts` as `ABContactsBS` - links to other credentials the user knows * - `credPublic.groups` as `ABGroupsBS` - groups the user follows * - `credPublic.actions` as `ABActionsBS` - actions, which are DARCs + a coin-instance for actions like login * * Every field is set up as a `BehaviorSubject`, which means that there is a `getValue()` method to get the current * value, but also a `.subscribe()` to be informed if anything changes. * If an element is removed or added, the `BehaviorSubject` calls `next` method on all observers. * If an element is changed, only the `BehaviorSubject` of this element is updated. */ export declare class AddressBook { readonly contacts: ABContactsBS; readonly groups: ABGroupsBS; readonly actions: ABActionsBS; constructor(contacts: ABContactsBS, groups: ABGroupsBS, actions: ABActionsBS); } export declare class ABContactsBS extends BehaviorSubject { private ais; constructor(ais: AttributeInstanceSetBS, bscs: BehaviorSubject); create(tx: SpawnerTransactionBuilder, user: UserSkeleton, initial?: Long): void; link(tx: SpawnerTransactionBuilder, id: InstanceID): void; unlink(tx: SpawnerTransactionBuilder, id: InstanceID): void; rename(tx: SpawnerTransactionBuilder, oldName: string, newName: string): void; } export declare class ABGroupsBS extends DarcsBS { private ais; constructor(ais: AttributeInstanceSetBS, dbs: DarcsBS); find(name: string): DarcBS | undefined; create(tx: SpawnerTransactionBuilder, name: string, signers: IIdentity[]): Darc; link(tx: SpawnerTransactionBuilder, id: InstanceID): void; unlink(tx: SpawnerTransactionBuilder, id: InstanceID): void; rename(tx: SpawnerTransactionBuilder, oldName: string, newName: string): void; } export declare class ABActionsBS extends BehaviorSubject { private ais; constructor(ais: AttributeInstanceSetBS, abs: BehaviorSubject); create(tx: SpawnerTransactionBuilder, desc: string, signers: IIdentity[]): void; link(tx: SpawnerTransactionBuilder, id: InstanceID): void; unlink(tx: SpawnerTransactionBuilder, id: InstanceID): void; rename(tx: SpawnerTransactionBuilder, oldName: string, newName: string): void; } /** * TODO: Need to link CoinBS somewhere in the Credential - currently it's not stored! */ export declare class ActionBS { darc: DarcBS; coin?: CoinBS; constructor(darc: DarcBS, coin?: CoinBS); }