Skip to content

Commit

Permalink
adds config to remove commitment calls
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Oct 4, 2024
1 parent 32b25c6 commit 3a30ccf
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 17 deletions.
12 changes: 6 additions & 6 deletions examples/vue-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/vue-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@toruslabs/customauth": "file:../../",
"@toruslabs/fnd-base": "^14.0.0",
"@toruslabs/openlogin-starkkey": "^3.2.0",
"@toruslabs/torus.js": "^15.0.2",
"@toruslabs/torus.js": "^15.1.0-0",
"@toruslabs/vue-components": "^7.8.3",
"@toruslabs/vue-icons": "^7.6.2",
"@web3auth/base": "^8.12.0",
Expand Down
2 changes: 2 additions & 0 deletions examples/vue-app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ const initCustomAuth = async () => {
uxMode,
web3AuthClientId: WEB3AUTH_CLIENT_ID,
nodeDetails,
checkCommitment: false,
});
await customAuthSdk.value.init({ skipSw: true });
break;
Expand All @@ -330,6 +331,7 @@ const initCustomAuth = async () => {
popupFeatures: `titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=500,width=500,top=100,left=100`,
web3AuthClientId: WEB3AUTH_CLIENT_ID,
nodeDetails,
checkCommitment: false,
});
await customAuthSdk.value.init();
break;
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
"@toruslabs/http-helpers": "^7.0.0",
"@toruslabs/metadata-helpers": "^6.0.0",
"@toruslabs/session-manager": "^3.1.0",
"@toruslabs/torus.js": "^15.0.4",
"@toruslabs/torus.js": "^15.1.0-0",
"base64url": "^3.0.1",
"bowser": "^2.11.0",
"deepmerge": "^4.3.1",
"eventemitter3": "^5.0.1",
"loglevel": "^1.9.2"
},
"devDependencies": {
"@sentry/types": "^8.31.0",
"@sentry/types": "^8.33.1",
"@toruslabs/config": "^2.2.0",
"@toruslabs/eslint-config-typescript": "^3.3.3",
"@toruslabs/torus-scripts": "^6.1.2",
Expand Down
7 changes: 7 additions & 0 deletions src/handlers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ export interface CustomAuthArgs {
useDkg?: boolean;

nodeDetails?: INodeDetails;

/**
* Set this flag to false to remove check for commitment calls.
*
* @defaultValue true
*/
checkCommitment?: boolean;
}

export interface InitParams {
Expand Down
4 changes: 4 additions & 0 deletions src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CustomAuth {
web3AuthNetwork: TORUS_NETWORK_TYPE;
keyType: KeyType;
nodeDetails: INodeDetails;
checkCommitment: boolean;
};

torus: Torus;
Expand Down Expand Up @@ -72,6 +73,7 @@ class CustomAuth {
keyType = "secp256k1",
serverTimeOffset = 0,
nodeDetails,
checkCommitment = true,
}: CustomAuthArgs) {
if (!web3AuthClientId) throw new Error("Please provide a valid web3AuthClientId in constructor");
if (!network) throw new Error("Please provide a valid network in constructor");
Expand All @@ -91,6 +93,7 @@ class CustomAuth {
web3AuthNetwork: network,
keyType,
nodeDetails,
checkCommitment,
};
const torus = new Torus({
network,
Expand Down Expand Up @@ -311,6 +314,7 @@ class CustomAuth {
...additionalParams,
},
useDkg: this.config.useDkg,
checkCommitment: this.config.checkCommitment,
});
}
);
Expand Down

0 comments on commit 3a30ccf

Please sign in to comment.