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

Session Keys #2131

Merged
merged 8 commits into from
Nov 8, 2024
Merged

Session Keys #2131

merged 8 commits into from
Nov 8, 2024

Conversation

tudor-malene
Copy link
Collaborator

@tudor-malene tudor-malene commented Nov 7, 2024

Why this change is needed

This is a basic implementation of Gateway level Session Keys.

What changes were made as part of this PR

  • create a couple of endpoints both as "routes" and exposed in 'getStorageAt`
  • update the data types to include session keys
  • create lifecycle logic for SKs
  • wire in the logic when submitting transactions - to sign transactions
  • wire in logic to include the SK account in the "accounts" of the user

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

E2E passing: https://github.com/ten-protocol/ten-test/actions/runs/11741950524/job/32711679991

# Conflicts:
#	tools/walletextension/common/types.go
#	tools/walletextension/rpcapi/filter_api.go
#	tools/walletextension/rpcapi/from_tx_args.go
#	tools/walletextension/rpcapi/utils.go
#	tools/walletextension/storage/database/common/db_types.go
#	tools/walletextension/storage/database/sqlite/sqlite.go
@tudor-malene tudor-malene changed the title WIP - Session Keys Session Keys Nov 8, 2024
Copy link
Contributor

@zkokelj zkokelj left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise looks good to me

}
return userID, nil
switch address.Hex() {
case common.UserIDRequestCQMethod: // todo - review whether we need this endpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

This endpoint is needed by frontend and is used in wallet-provider.tsx : const fetchedToken = await getToken(providerInstance);

But on the other hand we might need to think about this one again as it can be easy to exploit in my opinion in the following scenario:

User connects to a website with TEN (like Battleships ) and if this website is malicious it can store the data (userID) it gets from eth_getStorageAt call and then it can use the gateway to decrypt your transactions right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

exactly. It's a vulnerability. What does the wallet-provider do with it?

tools/walletextension/rpcapi/filter_api.go Outdated Show resolved Hide resolved
tools/walletextension/services/sk_manager.go Show resolved Hide resolved
@@ -11,10 +11,14 @@ import (
"github.com/ten-protocol/go-ten/tools/walletextension/storage/database/sqlite"
)

// todo - pass the Context
Copy link
Contributor

Choose a reason for hiding this comment

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

is this todo for this PR or should we do it in the next one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for a future pr.

@tudor-malene tudor-malene merged commit 65e25e0 into main Nov 8, 2024
1 of 2 checks passed
@tudor-malene tudor-malene deleted the tudor/implement_sk branch November 8, 2024 16:49
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.

2 participants