diff --git a/README.md b/README.md index e60c88b6..e0e49edd 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The session data is stored in signed and encrypted cookies which are decoded by - [`session.destroy(): void`](#sessiondestroy-void) - [`session.updateConfig(sessionOptions: SessionOptions): void`](#sessionupdateconfigsessionoptions-sessionoptions-void) - [`sealData(data: unknown, { password, ttl }): Promise`](#sealdatadata-unknown--password-ttl--promisestring) - - [`unsealData(seal: string, { password, ttl }): Promise`](#unsealdatatseal-string--password-ttl--promiset) + - [`unsealData(seal: string, { password }): Promise`](#unsealdatatseal-string--password--promiset) - [FAQ](#faq) - [Why use pure cookies for sessions?](#why-use-pure-cookies-for-sessions) - [How to invalidate sessions?](#how-to-invalidate-sessions) @@ -188,7 +188,7 @@ Updates the configuration of the session with new session options. You still nee This is the underlying method and seal mechanism that powers `iron-session`. You can use it to seal any `data` you want and pass it around. One usecase are magic links: you generate a seal that contains a user id to login and send it to a route on your website (like `/magic-login`). Once received, you can safely decode the seal with `unsealData` and log the user in. -### `unsealData(seal: string, { password, ttl }): Promise` +### `unsealData(seal: string, { password }): Promise` This is the opposite of `sealData` and allow you to decode a seal to get the original data back. diff --git a/src/core.ts b/src/core.ts index 91902ec5..85318bbf 100644 --- a/src/core.ts +++ b/src/core.ts @@ -229,10 +229,7 @@ export function createSealData(_crypto: Crypto) { export function createUnsealData(_crypto: Crypto) { return async function unsealData( seal: string, - { - password, - ttl = fourteenDaysInSeconds, - }: { password: Password; ttl?: number }, + { password }: { password: Password }, ): Promise { const passwordsMap = normalizeStringPasswordToMap(password); const { sealWithoutVersion, tokenVersion } = parseSeal(seal); @@ -241,7 +238,6 @@ export function createUnsealData(_crypto: Crypto) { const data = (await ironUnseal(_crypto, sealWithoutVersion, passwordsMap, { ...ironDefaults, - ttl: ttl * 1000, })) ?? {}; if (tokenVersion === 2) { @@ -365,7 +361,6 @@ export function createGetIronSession( const session = sealFromCookies ? await unsealData(sealFromCookies, { password: passwordsMap, - ttl: sessionConfig.ttl, }) : ({} as T); @@ -452,7 +447,6 @@ async function getIronSessionFromCookieStore( const session = sealFromCookies ? await unsealData(sealFromCookies, { password: passwordsMap, - ttl: sessionConfig.ttl, }) : ({} as T);