UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

51 lines (50 loc) 2.14 kB
import Identifier from '../Identifier'; import Commit from '../hubSession/Commit'; import HubObjectQueryRequest from '../hubSession/requests/HubObjectQueryRequest'; import IHubClient, { HubClientOptions } from './IHubClient'; import HubObject from './HubObject'; import HubCommitQueryRequest from '../hubSession/requests/HubCommitQueryRequest'; /** * Class for doing CRUD operations to Actions, Collections, Permissions, and Profile * In a Hub. */ export default class HubClient implements IHubClient { hubOwner: Identifier; clientIdentifier: Identifier; private readonly signingKeyReference; private readonly encryptionKeyReference; private readonly recipientsPublicKeys; private readonly cryptoFactory; private readonly payloadProtection; private readonly hubProtectionStrategy; /** * Constructs an instance of the Hub Client Class for hub operations * @param hubClientOptions hub client options used to create instance. */ constructor(hubClientOptions: HubClientOptions); /** * Protect and sends a commit to the hub owner's hub. * @param commit commit to be sent to hub owner's hub. */ commit(commit: Commit): Promise<import("..").HubWriteResponse>; /** * Query Objects of certain type in Hub. * @param queryRequest object that tells the hub what object to get. */ queryObjects(queryRequest: HubObjectQueryRequest): Promise<HubObject[]>; /** * Query Object specified by certain id * @param commitQueryRequest HubCommitQueryRequest object to request object of specific id. * @param hubObject a HubObject containing metadata such as object id. */ queryObject(commitQueryRequest: HubCommitQueryRequest, hubObject: HubObject): Promise<HubObject>; /** * Get all Hub Instances from hub owner's identifier document. */ getHubInstances(): Promise<string[]>; /** * Implement createHubSession method once HubSession is refactored. * creates a hubSession for hub instance that is available/online. */ private createHubSession; }