UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

52 lines (51 loc) 1.78 kB
import ICommitProtector from './ICommitProtector'; import Commit from '../Commit'; import { ICryptoToken } from '../../crypto/protocols/ICryptoToken'; import IPayloadProtectionOptions from '../../crypto/protocols/IPayloadProtectionOptions'; import { IPayloadProtection } from '../../crypto/protocols/IPayloadProtection'; import ProtectionStrategy from '../../crypto/strategies/ProtectionStrategy'; import { PublicKey } from '../..'; export interface CommitProtectorOptions { /** * The DID of the identity that will the commit. */ did: string; /** * The private key reference to be used to sign the commit. */ signingKeyReference: string | undefined; /** * The public keys used for encrypting the payload */ recipientsPublicKeys: PublicKey[] | undefined; /** * The protection protocol interface to use */ payloadProtection: IPayloadProtection; /** * The payload protection options used to protect the commits */ payloadProtectionOptions: IPayloadProtectionOptions; /** * Defines the protection strategy that will be used to protect the commit. */ hubProtectionStrategy: ProtectionStrategy | undefined; } /** * Class which can apply a signature to a commit. */ export default class CommitProtector implements ICommitProtector { private did; private signingKeyReference; private payloadProtectionOptions; private payloadProtection; private hubProtectionStrategy; private recipientsPublicKeys; constructor(options: CommitProtectorOptions); /** * Protect the given commit. * * @param commit The commit to protect. */ protect(commit: Commit): Promise<ICryptoToken>; }