Skip to content

Commit bce4469

Browse files
committed
regenerate auth manager on every invocation
1 parent 8204762 commit bce4469

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/index.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ function getPrivateKey(): `0x${string}` {
125125
return cachedPrivateKey;
126126
}
127127

128-
const storage = storagePlugins.localStorageNode({
129-
appName: 'drips-app',
130-
networkName: getLitNetworkName(),
131-
storagePath: join(currentDir, '.lit-auth-storage'),
132-
});
133-
const authManager = createAuthManager({ storage });
128+
function createFreshAuthManager() {
129+
const storage = storagePlugins.localStorageNode({
130+
appName: 'drips-app',
131+
networkName: getLitNetworkName(),
132+
storagePath: join(currentDir, '.lit-auth-storage'),
133+
});
134+
return createAuthManager({ storage });
135+
}
134136

135137
const LIT_TIMEOUT_MS = 60_000;
136138
const LIT_MAX_RETRIES = 2;
@@ -155,6 +157,7 @@ async function executeLitAction(source: { kind: string; name: string }, chainNam
155157
const account = privateKeyToAccount(getPrivateKey());
156158
const ipfsCid = await getLitActionIpfsCid();
157159

160+
const authManager = createFreshAuthManager();
158161
const authContext = await authManager.createEoaAuthContext({
159162
litClient,
160163
config: { account },

0 commit comments

Comments
 (0)