Skip to content

Improve local storage session keys for development#42

Merged
jarrodwatts merged 3 commits intoAbstract-Foundation:mainfrom
Morgosh:main
Apr 28, 2025
Merged

Improve local storage session keys for development#42
jarrodwatts merged 3 commits intoAbstract-Foundation:mainfrom
Morgosh:main

Conversation

@Morgosh
Copy link
Contributor

@Morgosh Morgosh commented Apr 26, 2025

Added option to logout
Session should load on refresh (wait for client)
Based on the network, the session keys should be recreated
Based on connected user, the session keys should be recreated
If policies change, then the session should be recreated

Makes development easier


PR-Codex overview

This PR focuses on enhancing session management and environment-specific configurations in the application. It introduces default call policies, modifies storage key prefixes based on the environment, and updates session handling in the Home component.

Detailed summary

  • Updated chain assignment in chain.ts for production environment.
  • Added check for DEFAULT_CALL_POLICIES in getStoredSession.ts.
  • Modified LOCAL_STORAGE_KEY_PREFIX and ENCRYPTION_KEY_PREFIX in constants.ts to include NODE_ENV.
  • Introduced DEFAULT_CALL_POLICIES in createAndStoreSession.ts.
  • Replaced hardcoded callPolicies with DEFAULT_CALL_POLICIES in createAndStoreSession.
  • Added useLoginWithAbstract and handleLogout in page.tsx.
  • Updated useEffect dependency to include client?.account?.address.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Apr 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
agw-connectkit-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2025 9:50am
agw-eoa-linking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2025 9:50am
agw-rainbowkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2025 9:50am
agw-signing-messages ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2025 9:50am
session-keys ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 27, 2025 9:50am

@vercel
Copy link

vercel bot commented Apr 26, 2025

@Morgosh is attempting to deploy a commit to the Abstract Foundation Team on Vercel.

A member of the Team first needs to authorize it.

*/
export default function Home() {
const { address, isConnected } = useAccount();
const { disconnect } = useDisconnect();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should use the logout function from the AGW hook useLoginWithAbstract

@jarrodwatts
Copy link
Collaborator

Thanks for this @Morgosh! I like these improvements - one small feedback is I think the logout function needs to be called to properly handle the privy logout side of the wallet disconnect

@Morgosh
Copy link
Contributor Author

Morgosh commented Apr 27, 2025

Thanks for this @Morgosh! I like these improvements - one small feedback is I think the logout function needs to be called to properly handle the privy logout side of the wallet disconnect

Thanks for the feedback! Updated

@jarrodwatts
Copy link
Collaborator

Thanks for this! Looks good to me

@jarrodwatts jarrodwatts merged commit b870e74 into Abstract-Foundation:main Apr 28, 2025
5 of 9 checks passed
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