Skip to content

Commit

Permalink
feat: add get/set metadata general domain
Browse files Browse the repository at this point in the history
  • Loading branch information
ieow committed Nov 8, 2024
1 parent 647eddb commit f072898
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ export interface ICoreKit {
*/
getKeyDetails(): MPCKeyDetails;

/**
* Get specific general domain's metadata which is used by plugin or modules.
*/
getGeneralStoreDomain<T>(domain: string): T;

/**
* Set specific general domain's metadata which is used by plugin or modules.
*/
setGeneralStoreDomain<T>(domain: string, value: T): void;

/**
* Commit the changes made to the user's account when in manual sync mode.
*/
Expand Down
9 changes: 9 additions & 0 deletions src/mpcCoreKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,15 @@ export class Web3AuthMPCCoreKit implements ICoreKit {
this.state = { ...this.state, ...newState };
}

public getGeneralStoreDomain<T>(domain: string): T {
return this.tkey.metadata.getGeneralStoreDomain(domain) as T;
}

public setGeneralStoreDomain<T>(domain: string, value: T): void {
// should we add check for root flag before allow to mutate metadata?
this.tkey.metadata.setGeneralStoreDomain(domain, value);
}

protected async atomicSync<T>(f: () => Promise<T>): Promise<T> {
this.atomicCallStackCounter += 1;

Expand Down

0 comments on commit f072898

Please sign in to comment.