mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add options.externalKey in koa-session (#42646)
This commit is contained in:
parent
a20e6d6ce7
commit
b715241f21
18
types/koa-session/index.d.ts
vendored
18
types/koa-session/index.d.ts
vendored
@ -155,6 +155,12 @@ declare namespace session {
|
||||
*/
|
||||
store?: stores;
|
||||
|
||||
/**
|
||||
* External key is used the cookie by default,
|
||||
* but you can use options.externalKey to customize your own external key methods.
|
||||
*/
|
||||
externalKey?: ExternalKeys;
|
||||
|
||||
/**
|
||||
* If your session store requires data or utilities from context, opts.ContextStore is alse supported.
|
||||
* ContextStore must be a class which claims three instance methods demonstrated above.
|
||||
@ -194,6 +200,18 @@ declare namespace session {
|
||||
*/
|
||||
destroy(key: string): any;
|
||||
}
|
||||
|
||||
interface ExternalKeys {
|
||||
/**
|
||||
* get session object by key
|
||||
*/
|
||||
get(ctx: Koa.Context): string;
|
||||
|
||||
/**
|
||||
* set session object for key, with a maxAge (in ms)
|
||||
*/
|
||||
set(ctx: Koa.Context, value: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare function session(CONFIG: Partial<session.opts>, app: Koa): Koa.Middleware;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user