TrpcAuth
A is the session attribute type of your createAuth call, inferred from
it, so ctx.session goes back into the flows without a cast.
Type Parameters
Section titled “Type Parameters”U extends AuthUser = AuthUser
A = unknown
Properties
Section titled “Properties”context
Section titled “context”
readonlycontext:object
readonlyclock:Clock
cookie?
Section titled “cookie?”
readonlyoptionalcookie?:SessionCookieConfig
The session cookie config. The CSRF, pre-session and blank session
cookies take their SameSite from it, per request Origin, exactly as
the session cookie does. Missing (a hand-made stand-in): Lax.
logger
Section titled “logger”
readonlylogger:object
logger.error()
Section titled “logger.error()”error(
message,context?):void
Parameters
Section titled “Parameters”message
Section titled “message”string
context?
Section titled “context?”Record<string, unknown>
Returns
Section titled “Returns”void
throttle
Section titled “throttle”
readonlythrottle:object
throttle.hit()
Section titled “throttle.hit()”hit(
scope,rule):Promise<Hit>
Parameters
Section titled “Parameters”string
RateLimitRule
Returns
Section titled “Returns”Promise<Hit>
readonlyusers:object
users.findById()
Section titled “users.findById()”findById(
id):Promise<U|null>
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<U | null>
emit()
Section titled “emit()”emit(
event,meta):Promise<void>
Parameters
Section titled “Parameters”AuthEvent
RequestMeta | undefined
Returns
Section titled “Returns”Promise<void>
keyedHash()
Section titled “keyedHash()”keyedHash(
purpose,message):string
An HMAC of message under a key derived from the server secret for
purpose. Names the user in a keyBy: 'user' rate limit key.
Parameters
Section titled “Parameters”purpose
Section titled “purpose”string
message
Section titled “message”string
Returns
Section titled “Returns”string
cookieName
Section titled “cookieName”
readonlycookieName:string
Methods
Section titled “Methods”logout()
Section titled “logout()”logout(
input):Promise<{cookie:CookieSpec; }>
Parameters
Section titled “Parameters”RequestMeta
string | null | undefined
Returns
Section titled “Returns”Promise<{ cookie: CookieSpec; }>
readDeviceToken()
Section titled “readDeviceToken()”readDeviceToken(
cookieHeader):string|null
Parameters
Section titled “Parameters”cookieHeader
Section titled “cookieHeader”string | null | undefined
Returns
Section titled “Returns”string | null
readSessionToken()
Section titled “readSessionToken()”readSessionToken(
cookieHeader):string|null
Parameters
Section titled “Parameters”cookieHeader
Section titled “cookieHeader”string | null | undefined
Returns
Section titled “Returns”string | null
requireFreshAuth()
Section titled “requireFreshAuth()”requireFreshAuth(
session):AuthResult<void>
Parameters
Section titled “Parameters”session
Section titled “session”StoredSession<A>
Returns
Section titled “Returns”AuthResult<void>
validateRequest()
Section titled “validateRequest()”validateRequest(
input):Promise<AuthResult<ValidatedSession<A>>>
Parameters
Section titled “Parameters”RequestMeta
string | null | undefined
touch?
Section titled “touch?”boolean
Returns
Section titled “Returns”Promise<AuthResult<ValidatedSession<A>>>