Skip to content

Redis adapter

@ltikit/adapter-redis provides the NonceStore only — ideal for serverless, where in-memory state can’t enforce single-use nonces across cold invocations. Single-use is guaranteed by an atomic GETDEL.

Redis holds the nonce store; platforms are durable config, so pair this with a durable PlatformStorePrisma, Supabase, or your own.

Terminal window
npm i @ltikit/core @ltikit/adapter-redis
import { createLti, staticKeyStore } from '@ltikit/core'
import { redisNonceStore, fromUpstash } from '@ltikit/adapter-redis'
import { Redis } from '@upstash/redis'
export const lti = createLti({
keys: staticKeyStore({ /* ...your tool keypair... */ }),
nonces: redisNonceStore(fromUpstash(Redis.fromEnv())), // fast serverless nonces
platforms: prismaPlatformStore(prisma), // or supabase / your own
})

No hard dependency on any Redis client — redisNonceStore takes a structural RedisLike (set with TTL + atomic getdel). Ships helpers for the common clients:

import { fromUpstash, fromIoRedis, fromNodeRedis } from '@ltikit/adapter-redis'
  • Single-use is enforced by GETDEL: a replayed state finds nothing → consume returns null.
  • Nonces are short-lived — the create call sets the key with the record’s TTL, so expired handshakes clean themselves up.