Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server side signing #76

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft

server side signing #76

wants to merge 57 commits into from

Conversation

ieow
Copy link
Contributor

@ieow ieow commented Nov 7, 2023

This pr containt

  • importTssKey
  • enable mpc-core-kit in nodejs
  • remote signing
  • one time signature ( authorization)

related sdk PR
#46
#62
#68
#75

related server PR
authenticator server( remote signing)
https://github.com/torusresearch/authenticator-server/pull/8

authorization server ( one time signature )
https://github.com/torusresearch/authorization-service/pull/2

demo
Web3Auth/mpc-core-kit-demo#11

require this http-helper fix for tests run log issue
torusresearch/http-helpers#39

replace call to multiple authorization server
@ieow ieow changed the base branch from feat/remote-siging-refresh to master November 7, 2023 09:32
Copy link

@tetratorus tetratorus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

package.json Outdated Show resolved Hide resolved

private coreKitInstance: Web3AuthMPCCoreKit;

private authenticatorType: string = "authenticator";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the type of authenticatorType variable based on accepted values

// this.remoteClient = remoteClient || false;
}

getDescriptionsAndUpdate() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify return type

* Will request for authorization every signing or refresh if being set.
* Required for remote client setup.
*/
authorizationUrl?: string[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be sapphire service url, so you can derive it from fetch node details directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this option internal

* Allow no authorization requirement for remote client setup.
* if AuthorizationUrl is set, this option will be ignored.
*/
allowNoAuthorizationForRemoteClient?: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this option should be removed.

const resp2 = await post<{ success?: boolean; code?: string }>(`${this.backendUrl}/api/v3/start`, startData);
// eslint-disable-next-line no-console
console.log(resp2);
return resp2.code;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it only for testing, ideally otp should be sent only to mobile number?

return data ? new BN(data.factorKey, "hex") : undefined;
}

async verifyRemoteSetup(address: string, code: string): Promise<IRemoteClientState & { tssShareIndex: string }> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should move common functions to base class

return base32.encode(key).toString().replace(/=/g, "");
}

async register(privKey: BN, secretKey: string): Promise<{ success: boolean; message?: string }> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whts the diff b/w private key and secret key? is their any example or flow diagram where i can see usage of this class

@@ -380,6 +441,7 @@ export class Web3AuthMPCCoreKit implements ICoreKit {

public async inputFactorKey(factorKey: BN): Promise<void> {
this.checkReady();
if (this.state.remoteClient) throw new Error("remoteClient is present, inputFactorKey are not allowed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so user cannot provide client side factor key while using server side factor key?

return backupFactorKey;
}
// update to undefined for next major release
return "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is going to be a major release so we can update to undefined here

@ieow ieow mentioned this pull request Nov 24, 2023
@himanshuchawla009 himanshuchawla009 changed the title Feat/authorization signing server side signing May 2, 2024
@himanshuchawla009 himanshuchawla009 changed the base branch from master to alpha May 2, 2024 05:27
Base automatically changed from alpha to v3 May 7, 2024 05:12
Base automatically changed from v3 to master August 12, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants