Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 962 Bytes

README.md

File metadata and controls

46 lines (34 loc) · 962 Bytes

lucia auth adapter deno kv

JSR

compatible with npm:lucia@3

example implementation: https://github.com/cotyhamilton/deno-auth-lucia

usage

deno add @cotyhamilton/lucia-adapter-denokv
deno add npm:lucia@3
import { Lucia } from "lucia";
import { DenoKVAdapter } from "@cotyhamilton/lucia-adapter-denokv";

const kv = await Deno.openKv();

export const lucia = new Lucia(new DenoKVAdapter(kv), {
  getUserAttributes: (attributes) => {
    return {
      // attributes has the type of DatabaseUserAttributes
      name: attributes.name,
    };
  },
});

declare module "lucia" {
  interface Register {
    Lucia: typeof lucia;
    DatabaseUserAttributes: DatabaseUserAttributes;
  }
}

interface DatabaseUserAttributes {
  name: string;
}

reference