@enbox/api
Version:
SDK for accessing the features and capabilities of Web5
66 lines • 3.03 kB
TypeScript
import { DwnDataEncodedRecordsWriteMessage, DwnResponseStatus, Web5Agent } from '@enbox/agent';
/**
* Represents the structured data model of a GrantRevocation record, encapsulating the essential fields that define.
*/
export interface GrantRevocationModel {
/** The DWN message used to construct this revocation */
rawMessage: DwnDataEncodedRecordsWriteMessage;
}
/**
* Represents the options for creating a new GrantRevocation instance.
*/
export interface GrantRevocationOptions {
/** The DID of the DWN tenant under which record operations are being performed. */
connectedDid: string;
/** The DWN message used to construct this revocation */
message: DwnDataEncodedRecordsWriteMessage;
}
/**
* The `PermissionGrantRevocation` class encapsulates a permissions protocol `grant/revocation` record, providing a more
* developer-friendly interface for working with Decentralized Web Node (DWN) records.
*
* Methods are provided to manage the grant revocation's lifecycle, including writing to remote DWNs.
*
* @beta
*/
export declare class PermissionGrantRevocation implements GrantRevocationModel {
/** The PermissionsAPI used to interact with the underlying revocation */
private _permissions;
/** The DID to use as the author and default target for the underlying revocation */
private _connectedDid;
/** The DWN `RecordsWrite` message, along with encodedData that represents the revocation */
private _message;
private constructor();
/** The author of the underlying revocation message */
get author(): string;
/** parses the grant revocation given am agent, connectedDid and data encoded records write message */
static parse({ connectedDid, agent, message }: {
connectedDid: string;
agent: Web5Agent;
message: DwnDataEncodedRecordsWriteMessage;
}): Promise<PermissionGrantRevocation>;
/** The agent to use for this instantiation of the grant revocation */
private get agent();
/** The raw `RecordsWrite` DWN message with encoded data that was used to instantiate this grant revocation */
get rawMessage(): DwnDataEncodedRecordsWriteMessage;
/**
* Send the current grant revocation to a remote DWN by specifying their DID
* If no DID is specified, the target is assumed to be the owner (connectedDID).
*
* @param target - the optional DID to send the grant revocation to, if none is set it is sent to the connectedDid
* @returns the status of the send grant revocation request
*
* @beta
*/
send(target?: string): Promise<DwnResponseStatus>;
/**
* Stores the current grant revocation to the owner's DWN.
*
* @param importGrant - if true, the grant revocation will signed by the owner before storing it to the owner's DWN. Defaults to false.
* @returns the status of the store request
*
* @beta
*/
store(importRevocation?: boolean): Promise<DwnResponseStatus>;
}
//# sourceMappingURL=grant-revocation.d.ts.map