EDIT: I've switched svelte-kit-cookie-session to use svelte-kit package which simplifies quite a lot
Currently we're using the NodeJS Crypto Module, this is not supported in every environment that SvelteKit provides adapters for. SvelteKit has a recent change which polyfills the WebCrypto API into globalThis crypto, and this PR implements the encrypting and decrypting part with the WebCrypto API using the zencrypt package which i created for this library.
Everything in svelte-kit-cookie-session is also now async, because of this i had to change some APIs.
Getting the session data stays the same.
Old way of setting the session
locals.session.data = { userId: 12 }
New way of setting the session
await locals.session.set({ userId: 12 })
// All other functions return Promises now!
await locals.session.refresh();
await locals.session.destroy();
If you come across this PR, please feel free to test the next version, it is available under the next tag 3.0.0-next.4:
EDIT:
I've switched svelte-kit-cookie-session to use svelte-kit package which simplifies quite a lot
Currently we're using the NodeJS Crypto Module, this is not supported in every environment that SvelteKit provides adapters for. SvelteKit has a recent change which polyfills the WebCrypto API into globalThis crypto, and this PR implements the encrypting and decrypting part with the WebCrypto API using the zencrypt package which i created for this library.
Everything in
svelte-kit-cookie-session
is also now async, because of this i had to change some APIs.Getting the session data stays the same.
Old way of setting the session
New way of setting the session
If you come across this PR, please feel free to test the next version, it is available under the next tag
3.0.0-next.4
: