Skip to content

Commit

Permalink
feat(entrykit): reuse accountkit session if available (#3454)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Jan 23, 2025
1 parent 923ab7f commit bc49b98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/entrykit/src/getSessionSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ export function getSessionSigner(userAddress: Address) {
const sessionSignerPrivateKey =
store.getState().signers[userAddress] ??
(() => {
const privateKey = generatePrivateKey();
const privateKey =
// attempt to reuse previous AccountKit session
localStorage.get(`mud:appSigner:privateKey:${userAddress.toLowerCase()}`) ??
// otherwise create a fresh one
generatePrivateKey();
store.setState((state) => ({
signers: {
...state.signers,
Expand Down

0 comments on commit bc49b98

Please sign in to comment.