Skip to content

Commit

Permalink
add updateConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Nov 21, 2023
1 parent 6dda573 commit 41c8b11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The session data is stored in signed and encrypted cookies which are decoded by
- [`getIronSession<T>(cookieStore, sessionOptions): Promise<IronSession<T>>`](#getironsessiontcookiestore-sessionoptions-promiseironsessiont)
- [`session.save(): Promise<void>`](#sessionsave-promisevoid)
- [`session.destroy(): void`](#sessiondestroy-void)
- [`session.updateConfig(sessionOptions: SessionOptions): void`](#sessionupdateconfigsessionoptions-sessionoptions-void)
- [`sealData(data: unknown, { password, ttl }): Promise<string>`](#sealdatadata-unknown--password-ttl--promisestring)
- [`unsealData<T>(seal: string, { password, ttl }): Promise<T>`](#unsealdatatseal-string--password-ttl--promiset)
- [FAQ](#faq)
Expand Down Expand Up @@ -149,6 +150,10 @@ Destroys the session. This is a synchronous operation as it only removes the coo
session.destroy()
```

### `session.updateConfig(sessionOptions: SessionOptions): void`

Updates the configuration of the session with new session options. You still need to call save() if you want them to be applied.

### `sealData(data: unknown, { password, ttl }): Promise<string>`

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.
Expand Down

0 comments on commit 41c8b11

Please sign in to comment.