/// import { BehaviorSubject } from "rxjs"; import { ByzCoinRPC, IStorage } from "@dedis/cothority/byzcoin"; import { SpawnerInstance } from "@dedis/cothority/byzcoin/contracts"; import { IdentityDarc, SignerEd25519 } from "@dedis/cothority/darc"; import { Scalar } from "@dedis/kyber"; import { AddressBook } from "./addressBook"; import { CoinBS } from "./byzcoin/coinBS"; import { Calypso } from "./calypso"; import { CredentialSignerBS } from "./credentialSignerBS"; import { CredentialStructBS } from "./credentialStructBS"; import { ICoin } from "./genesis"; import { KeyPair } from "./keypair"; import { SpawnerTransactionBuilder } from "./spawnerTransactionBuilder"; /** * The User-class has references to all other needed classes. * Its only additional data is the private key, which is not available in any other class. * To allow for multiple users in the same db, `dbBase` is prefixed to all keys used by the user. * * To instantiate a user class, you should use one of the Builder.retrieveUser* methods. * * The user class and all classes it references are built on a simple premise: * the only necessary data is the credential-ID and the private key. * All other data is fetched live from the chain. * A caching system makes sure that this loading is fast after a first warming up of the cache. * Interacting with ByzCoin is optimized to only fetch changes of the instances. */ export declare class User { bc: ByzCoinRPC; db: IStorage; kpp: KeyPair; dbBase: string; credStructBS: CredentialStructBS; spawnerInstanceBS: BehaviorSubject; coinBS: CoinBS; credSignerBS: CredentialSignerBS; addressBook: AddressBook; calypso?: Calypso; get kiSigner(): SignerEd25519; get identityDarcSigner(): IdentityDarc; static readonly keyPriv = "private"; static readonly keyCredID = "credID"; static readonly keyMigrate = "storage/data.json"; static readonly versionMigrate = 1; static readonly urlNewDevice = "/register/device"; static migrate(dbFrom: IStorage, dbNew?: IStorage, base?: string): Promise; constructor(bc: ByzCoinRPC, db: IStorage, kpp: KeyPair, dbBase: string, credStructBS: CredentialStructBS, spawnerInstanceBS: BehaviorSubject, coinBS: CoinBS, credSignerBS: CredentialSignerBS, addressBook: AddressBook, calypso?: Calypso); switchKey(previous: KeyPair): Promise; getUrlForDevice(priv: Scalar): string; save(base?: string, priv?: Buffer, credID?: Buffer): Promise; clearDB(base?: string): Promise; iCoin(): ICoin; startTransaction(): SpawnerTransactionBuilder; executeTransactions(addTxs: (tx: SpawnerTransactionBuilder) => Promise | unknown, wait?: number): Promise; } export interface IMigrate { keyPersonhood?: string; keyIdentity: string; version?: number; contact: { credential: Buffer; }; }