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 3017 auth unification migrate actual tests #440

Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
9c4077b
fix: https://github.com/LIT-Protocol/js-sdk/pull/440#discussion_r1583…
Ansonhkg Apr 30, 2024
e01e076
fix: only BLS https://github.com/LIT-Protocol/js-sdk/pull/440#discuss…
Ansonhkg Apr 30, 2024
bcad173
fix: https://github.com/LIT-Protocol/js-sdk/pull/440#discussion_r1583…
Ansonhkg Apr 30, 2024
451e0e7
fix: https://github.com/LIT-Protocol/js-sdk/pull/440#discussion_r1583…
Ansonhkg Apr 30, 2024
d428bad
chore: added note https://github.com/LIT-Protocol/js-sdk/pull/440#dis…
Ansonhkg Apr 30, 2024
eaf014b
fix: improve readability
Ansonhkg Apr 29, 2024
660759f
fix: pass-in session key in base provider
Ansonhkg Apr 29, 2024
f30a10a
feat: cherry-pick ee7011a
Ansonhkg Apr 29, 2024
8b92666
fix: pass-in session key in base provider
Ansonhkg Apr 29, 2024
b4a53db
fix: https://github.com/LIT-Protocol/js-sdk/pull/446#discussion_r1583…
Ansonhkg Apr 29, 2024
1c17275
feat: merge https://github.com/LIT-Protocol/js-sdk/pull/446
Ansonhkg Apr 29, 2024
8a8694a
fix: remove TEMP_CACHE
Ansonhkg Apr 30, 2024
3b7de45
fix: https://github.com/LIT-Protocol/js-sdk/pull/440#discussion_r1583…
Ansonhkg Apr 30, 2024
e424daf
fix: https://github.com/LIT-Protocol/js-sdk/pull/440#discussion_r1583…
Ansonhkg Apr 30, 2024
6e0e4ef
fix: https://github.com/LIT-Protocol/js-sdk/pull/440#discussion_r1583…
Ansonhkg Apr 30, 2024
2695204
Merge branch 'feature/lit-2958-auth-unification-ts-tests' of https://…
Ansonhkg May 1, 2024
7bc363d
fix: remove authSig (need to fix `decryptToString` and `decryptToFile…
Ansonhkg May 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 31 additions & 28 deletions packages/lit-auth-client/src/lib/providers/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,40 +161,43 @@ export abstract class BaseProvider {

let response: SignSessionKeyResponse;

// common data for the signSessionKey function call
const commonData = {
sessionKey: params.sessionSigsParams.sessionKey,
statement: authCallbackParams.statement,
pkpPublicKey: params.pkpPublicKey,
expiration: authCallbackParams.expiration,
resources: authCallbackParams.resources,
chainId: chainId,
...(params.resourceAbilityRequests && {
resourceAbilityRequests: params.resourceAbilityRequests,
}),
};

// prepare auth-specific data based on the authentication method
let authSpecificData = {};

if (params.authMethod.authMethodType === AuthMethodType.EthWallet) {
const authSig = JSON.parse(params.authMethod.accessToken);
response = await nodeClient.signSessionKey({
statement: authCallbackParams.statement,
sessionKey: params.sessionSigsParams.sessionKey,
authSpecificData = {
authSig: JSON.parse(params.authMethod.accessToken),
Copy link
Collaborator

Choose a reason for hiding this comment

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

SignSessionKey no longer accepts AuthSig

authMethods: [],
authSig: authSig,
pkpPublicKey: params.pkpPublicKey,
expiration: authCallbackParams.expiration,
resources: authCallbackParams.resources,
chainId,

// optional
...(params.resourceAbilityRequests && {
resourceAbilityRequests: params.resourceAbilityRequests,
}),
});
};
} else {
response = await nodeClient.signSessionKey({
sessionKey: params.sessionSigsParams.sessionKey,
statement: authCallbackParams.statement,
authSpecificData = {
authMethods: [params.authMethod],
pkpPublicKey: params.pkpPublicKey,
expiration: authCallbackParams.expiration,
resources: authCallbackParams.resources,
chainId,

// optional
...(params.resourceAbilityRequests && {
resourceAbilityRequests: params.resourceAbilityRequests,
}),
});
};
}

// Merge the common and auth-specific data
response = await nodeClient.signSessionKey({
// default
authMethods: [],

// override
...commonData,
...authSpecificData,
});

return response.authSig;
};
}
Expand Down