@pooflabs/web 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/providers/mock-auth-provider.d.ts +2 -2
- package/dist/index.esm.js +12 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,8 +27,8 @@ export declare class MockAuthProvider implements AuthProvider {
|
|
|
27
27
|
*/
|
|
28
28
|
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
29
29
|
/**
|
|
30
|
-
* Restore session
|
|
31
|
-
*
|
|
30
|
+
* Restore session - only restores if user previously called login() explicitly.
|
|
31
|
+
* This prevents auto-login on first page load, but allows session persistence after login.
|
|
32
32
|
*/
|
|
33
33
|
restoreSession(): Promise<User | null>;
|
|
34
34
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -41056,6 +41056,8 @@ PrivyWalletProvider.instance = null;
|
|
|
41056
41056
|
|
|
41057
41057
|
// Default test wallet address (Solana devnet address)
|
|
41058
41058
|
const DEFAULT_TEST_ADDRESS = 'HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof';
|
|
41059
|
+
// Session storage key to track if user explicitly called login()
|
|
41060
|
+
const EXPLICIT_LOGIN_KEY = 'mock-auth-explicit-login';
|
|
41059
41061
|
/**
|
|
41060
41062
|
* MockAuthProvider bypasses real wallet authentication for testing purposes.
|
|
41061
41063
|
* Uses sessionStorage to simulate logged-in user, with fallback to default test address.
|
|
@@ -41074,6 +41076,8 @@ class MockAuthProvider {
|
|
|
41074
41076
|
sessionStorage.setItem('test-user-address', DEFAULT_TEST_ADDRESS);
|
|
41075
41077
|
console.log('[MockAuth] Using default test address:', address);
|
|
41076
41078
|
}
|
|
41079
|
+
// Mark that user explicitly called login() - allows restoreSession on refresh
|
|
41080
|
+
sessionStorage.setItem(EXPLICIT_LOGIN_KEY, 'true');
|
|
41077
41081
|
console.log('[MockAuth] Mock login successful:', address);
|
|
41078
41082
|
return {
|
|
41079
41083
|
address,
|
|
@@ -41123,10 +41127,15 @@ class MockAuthProvider {
|
|
|
41123
41127
|
return transaction;
|
|
41124
41128
|
}
|
|
41125
41129
|
/**
|
|
41126
|
-
* Restore session
|
|
41127
|
-
*
|
|
41130
|
+
* Restore session - only restores if user previously called login() explicitly.
|
|
41131
|
+
* This prevents auto-login on first page load, but allows session persistence after login.
|
|
41128
41132
|
*/
|
|
41129
41133
|
async restoreSession() {
|
|
41134
|
+
const explicitlyLoggedIn = sessionStorage.getItem(EXPLICIT_LOGIN_KEY);
|
|
41135
|
+
if (!explicitlyLoggedIn) {
|
|
41136
|
+
console.log('[MockAuth] No explicit login found. Call login() to authenticate.');
|
|
41137
|
+
return null;
|
|
41138
|
+
}
|
|
41130
41139
|
const address = sessionStorage.getItem('test-user-address');
|
|
41131
41140
|
if (!address) {
|
|
41132
41141
|
console.log('[MockAuth] No previous session found');
|
|
@@ -41144,6 +41153,7 @@ class MockAuthProvider {
|
|
|
41144
41153
|
async logout() {
|
|
41145
41154
|
sessionStorage.removeItem('test-user-address');
|
|
41146
41155
|
sessionStorage.removeItem('test-user-id');
|
|
41156
|
+
sessionStorage.removeItem(EXPLICIT_LOGIN_KEY);
|
|
41147
41157
|
console.log('[MockAuth] Mock logout successful');
|
|
41148
41158
|
}
|
|
41149
41159
|
/**
|