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

Feature/lit 2961 auth unification breaking remove existing authsigs #444

Conversation

Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Apr 25, 2024

Description

  • Removed authSig as an option to pass in to endpoint functions eg. pkpSign executeJs and signSessionKey
  • Extracted out all parser, helper, transcompiler functions in the pkpSign and executeJs to a dedicated helpers folder with isolated unit tests
  • Removing getXXPromiseShares methods in the LitNodeClient & its interface, and replacing it with a generic generatePromise instead. See lit-node-client-nodejs.ts
  • Better types for IOs

Note

The commit history is a bit overlapping with other PRs because I need the tests and some other features, please review from the commit below onward (or I just open a new PR and cherry pick the commits if that's better, lmk.)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit test (Jest)
  • E2E test (Tinny)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Ansonhkg Ansonhkg changed the base branch from master to feature/lit-2958-auth-unification-ts-tests April 25, 2024 21:01
Copy link

@joshLong145 joshLong145 left a comment

Choose a reason for hiding this comment

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

Left some comments. looking good :)

packages/auth-helpers/src/lib/resources.ts Outdated Show resolved Hide resolved
packages/types/src/lib/interfaces.ts Outdated Show resolved Hide resolved
pkpPublicKey?: string;
authSig?: AuthSig;
siweMessage: string;
curveType: 'BLS' | 'ECDSA';

Choose a reason for hiding this comment

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

I thought we had a LIT_CURVE introduced as a new enum could we it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea that's in the constants package, it will unfortunately cause circular dependencies. I think constants and types should just merge, they are static values anyway and don't depend on any other packages, but they love each other and we keep separating them 💔

Choose a reason for hiding this comment

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

this makes sense to me, Will make a task as a follow up.

1. Removed authSig and use sessionSigs
2. Moved all parsers/helpers to its own folder with unit tests
3. Updated `ExecuteJsProps` type to `JsonExecutionSdkParams` type and `JsonExecutionRequest` type to nodes
4.
@Ansonhkg Ansonhkg marked this pull request as ready for review April 27, 2024 02:03
@joshLong145 joshLong145 self-requested a review April 29, 2024 20:26
@joshLong145
Copy link

@Ansonhkg this looks awesome!
Thinking to get ready for this merger we should make a release/6.0.0 branch where we can start merging this work into and doing test runs. WDYT?
we then could start merging #444 #436

@DashKash54
Copy link
Collaborator

@Ansonhkg this looks awesome! Thinking to get ready for this merger we should make a release/6.0.0 branch where we can start merging this work into and doing test runs. WDYT? we then could start merging #444 #436

I think we should merge #435 instead of these sub-branches

Copy link
Collaborator

@DashKash54 DashKash54 left a comment

Choose a reason for hiding this comment

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

Starting to review from the commit: 35ede36. Lemme know if this needs to be reviewed before this commit
Full disclosure: I'm glossing over the helper files in the the lib/helpers directory as I presume it's only a copy paste from the existing code?
The AuthSig removal happens only in packages/types/src/lib/interfaces.ts and replacing getSessionOrAuthSig with getSessionSigByUrl? Anything else?

packages/constants/src/lib/constants/endpoints.ts Outdated Show resolved Hide resolved
packages/encryption/src/lib/params-validators.ts Outdated Show resolved Hide resolved
packages/types/src/lib/interfaces.ts Show resolved Hide resolved
packages/types/src/lib/interfaces.ts Show resolved Hide resolved
packages/types/src/lib/interfaces.ts Show resolved Hide resolved
packages/types/src/lib/interfaces.ts Show resolved Hide resolved
Comment on lines +52 to +60
const bigR = typedItem.bigR ?? typedItem.bigr;

typedItem.signatureShare = (typedItem.signatureShare ?? '').replaceAll(
'"',
''
);
typedItem.bigR = (bigR ?? '').replaceAll('"', '');
typedItem.publicKey = (typedItem.publicKey ?? '').replaceAll('"', '');
typedItem.dataSigned = (typedItem.dataSigned ?? '').replaceAll('"', '');

Choose a reason for hiding this comment

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

Do we do this in more than just here? thinking this might be better as a separate helper for sanitizing signatures.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

minNodeCount: number;
signedData: any[];
requestId: string;
}): T | { signature: SigResponse; sig: SigResponse } => {

Choose a reason for hiding this comment

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

I'm wondering if we could standardize on one of the two return values so we can remove T as it is a bit confusing the consumer of this method.

@DashKash54
Copy link
Collaborator

@Ansonhkg Still a bunch of unresolved comments. Can you please respond and resolve those, thanks

Copy link
Collaborator

@DashKash54 DashKash54 left a comment

Choose a reason for hiding this comment

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

Approving the PRs though there are still some unresolved comments which aren't addressed. Please address those and resolve. Great job @Ansonhkg 🚀

…github.com/LIT-Protocol/js-sdk into feature/lit-2961-auth-unification-breaking-remove-existing-authsigs
@Ansonhkg Ansonhkg merged commit 8709d11 into feature/lit-2958-auth-unification-ts-tests May 1, 2024
2 checks passed
@Ansonhkg Ansonhkg deleted the feature/lit-2961-auth-unification-breaking-remove-existing-authsigs branch May 1, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants