@auth/unstorage-adapter
Official Unstorage adapter for Auth.js / NextAuth.js.
Installation
npm install unstorage @auth/unstorage-adapterUnstorageAdapterOptions
This is the interface of the Unstorage adapter options.
Properties
accountByUserIdPrefix?
optional accountByUserIdPrefix: string;The prefix for the accountByUserId key
accountKeyPrefix?
optional accountKeyPrefix: string;The prefix for the account key
authenticatorKeyPrefix?
optional authenticatorKeyPrefix: string;The prefix for the authenticator key
authenticatorUserKeyPrefix?
optional authenticatorUserKeyPrefix: string;The prefix for the authenticator-by-user-id key
baseKeyPrefix?
optional baseKeyPrefix: string;The base prefix for your keys
emailKeyPrefix?
optional emailKeyPrefix: string;The prefix for the emailKey key
sessionByUserIdKeyPrefix?
optional sessionByUserIdKeyPrefix: string;The prefix for the sessionByUserId key
sessionKeyPrefix?
optional sessionKeyPrefix: string;The prefix for the sessionKey key
useItemRaw?
optional useItemRaw: boolean;Use getItemRaw/setItemRaw instead of getItem/setItem.
This is an experimental feature. Please check unjs/unstorage#142 for more information.
userKeyPrefix?
optional userKeyPrefix: string;The prefix for the user key
verificationTokenKeyPrefix?
optional verificationTokenKeyPrefix: string;The prefix for the verificationToken key
defaultOptions
const defaultOptions: {
accountByUserIdPrefix: string;
accountKeyPrefix: string;
authenticatorKeyPrefix: string;
authenticatorUserKeyPrefix: string;
baseKeyPrefix: string;
emailKeyPrefix: string;
sessionByUserIdKeyPrefix: string;
sessionKeyPrefix: string;
useItemRaw: boolean;
userKeyPrefix: string;
verificationTokenKeyPrefix: string;
};Type declaration
accountByUserIdPrefix
accountByUserIdPrefix: string = "user:account:by-user-id:";accountKeyPrefix
accountKeyPrefix: string = "user:account:";authenticatorKeyPrefix
authenticatorKeyPrefix: string = "authenticator:";authenticatorUserKeyPrefix
authenticatorUserKeyPrefix: string = "authenticator:by-user-id:";baseKeyPrefix
baseKeyPrefix: string = "";emailKeyPrefix
emailKeyPrefix: string = "user:email:";sessionByUserIdKeyPrefix
sessionByUserIdKeyPrefix: string = "user:session:by-user-id:";sessionKeyPrefix
sessionKeyPrefix: string = "user:session:";useItemRaw
useItemRaw: boolean = false;userKeyPrefix
userKeyPrefix: string = "user:";verificationTokenKeyPrefix
verificationTokenKeyPrefix: string = "user:token:";hydrateDates()
function hydrateDates(json): anyParameters
| Parameter | Type |
|---|---|
json | Record<string, any> |
Returns
any
UnstorageAdapter()
function UnstorageAdapter(storage, options): AdapterParameters
| Parameter | Type |
|---|---|
storage | Storage |
options | UnstorageAdapterOptions |