@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
78 lines (77 loc) • 2.13 kB
TypeScript
import { HubInterfaceType, CommitStrategyType } from '..';
import { Operation } from '../hubInterfaces/HubInterface';
/**
* Fields that can be specified when creating a new commit.
*/
export interface ICommitFields {
/**
* Gets or sets the time stamp of the commit
*/
committed_at: string;
/**
* Gets or sets the issuer of the commit, the DID of the persona.
*/
iss: string;
/**
* Gets or sets the identifier of the hub owner of the commit
*/
sub: string;
/**
* Gets or sets the hub interface type for the commit
*/
interface: HubInterfaceType;
/**
* Gets or sets the context for the commit
*/
context: string;
/**
* Gets or sets the commit type
*/
type: string;
/**
* Gets or sets the commit operation
*/
operation: Operation;
/**
* Gets or sets the commit strategy type
*/
commit_strategy: CommitStrategyType;
/**
* The application-specific commit payload.
*/
payload: object | string;
/**
* Identifier for the object
*/
object_id: string | undefined;
[]: any;
}
/**
* Represents a new (i.e pending, unsigned) commit which will create, update, or delete an object in
* a user's Identity Hub.
*/
export default class Commit {
private fields;
constructor(fields: ICommitFields);
/**
* Verifies whether the currently set fields constitute a valid commit which can be
* signed/encrypted and stored in an Identity Hub.
*
* Throws an error if the commit is not valid.
*
* need: Move validation logic to hub-common-js repository to be shared with hub-node-core.
*/
validate(): void;
/**
* Returns true if the validate() method would pass without error.
*/
isValid(): boolean;
/**
* Returns the fields of the commit.
*/
getCommitFields(): Partial<ICommitFields>;
/**
* Returns the application-specific payload for this commit.
*/
getPayload(): any;
}