Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Sep 26, 2024
1 parent cc4e669 commit 59ee25b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/core/src/lib/actions/callback/oauth/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@ const COOKIE_TTL = 60 * 15 // 15 minutes
async function sealCookie(
type: keyof CookiesOptions,
payload: string,
options: InternalOptions<"oauth" | "oidc" | WebAuthnProviderType>,
maxAge: number = COOKIE_TTL
options: InternalOptions<"oauth" | "oidc" | WebAuthnProviderType>
): Promise<Cookie> {
const { cookies, logger } = options
const expires = new Date()
expires.setTime(expires.getTime() + maxAge * 1000)
expires.setTime(expires.getTime() + COOKIE_TTL * 1000)
const name = options.cookies[type].name

logger.debug(`CREATE_${type.toUpperCase()}`, {
name,
payload,
maxAge,
COOKIE_TTL,
expires,
})

const encoded = await encode({
...options.jwt,
maxAge,
maxAge: COOKIE_TTL,
token: { value: payload } satisfies CookiePayload,
salt: name,
})
Expand Down

0 comments on commit 59ee25b

Please sign in to comment.