Skip to content

Comments

fix(sdk wasm): remove cookies at signout#265

Closed
SHAcollision wants to merge 1 commit intomainfrom
fix/clear-cookies-wasm
Closed

fix(sdk wasm): remove cookies at signout#265
SHAcollision wants to merge 1 commit intomainfrom
fix/clear-cookies-wasm

Conversation

@SHAcollision
Copy link
Contributor

This PR solves a long standing legacy issue. On browsers (wasm), on signout, the cookies are not cleared.
image

What changed

  • Added regression coverage in pubky-sdk/bindings/js/pkg/tests/session.ts for signout now must delete every per-user cookie from the environment. This test fails against the previous build, proving the bug and guarding the fix going forward.
  • Implemented cookies::clear_session_cookie and called it from Session::signout. The helper compiles only for wasm32 and delegates to a tiny JS shim so both Node (via fetch-cookie's jar) and browsers (document.cookie) clear the exact cookie named after the user's public key. @86667 this might not work correctly jointly with Allow multiple cookies per user #262 right?
  • Updated the bundling script (scripts/patch.mjs) and npm run build:test so wasm-bindgen's generated snippets/ directory is treated like the rest of the runtime artifacts (copied alongside index.js, rewritten to use ESM imports) and no longer needs to be versioned.
  • Ignored pkg/snippets/ via .gitignore so newly generated inline helpers do not get committed accidentally.

@SHAcollision SHAcollision requested a review from 86667 November 18, 2025 08:27
@SHAcollision
Copy link
Contributor Author

Closing, the fix is not working as intended. Needs more research.

@SHAcollision SHAcollision deleted the fix/clear-cookies-wasm branch November 18, 2025 13:23
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.

1 participant