Socket
Socket
Sign inDemoInstall

lucia-auth-adapter-surrealdb

Package Overview
Dependencies
251
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lucia-auth-adapter-surrealdb

SurrealDB adapter for Lucia


Version published
Maintainers
1
Install size
8.30 MB
Created

Readme

Source

lucia-auth-adapter-surrealdb

SurrealDB adapter for Lucia

Lucia documentation

Changelog

Installation

npm install lucia-auth-adapter-surrealdb
pnpm install lucia-auth-adapter-surrealdb
yarn add lucia-auth-adapter-surrealdb

Usage

// required imports
import lucia from "lucia-auth";
import surrealdb from "lucia-auth-adapter-surrealdb";

// init surrealdb adapter
const adapter = surrealdb({
  uri: "surrealdb-uri", // Example: 'http://localhost:8000/rpc',
  user: "surrealdb-user",
  pass: "surrealdb-pass",
  ns: "my-ns",
  db: "my-db",
});

// init lucia using the adapter
const auth = lucia({
  adapter,
  env: "DEV",
});

// OR
// only if you want to build the surrealdb client yoursef
import Surreal from "$lib/surreal";

// build and init surrealdb client
const surreal = new Surreal("surrealdb-uri");

await surreal.signin({
  user: "surrealdb-user",
  pass: "surrealdb-pass",
});

await surreal.use("my-ns", "my-db");

// init lucia passing surrealdb client to the adapter
const adapter = surrealdb({
  surreal,
});

// init lucia using the adapter
const auth = lucia({
  adapter,
  env: "DEV",
});

export type Auth = typeof auth;

// enjoy

Lucia version compatibility

Surrealdb adapter versionLucia version
v0.8.0v1.8.0

Testing

Add your .env file with your configuration

SURREALDB_URL=
SURREALDB_USER=
SURREALDB_PASS=
SURREALDB_NS=
SURREALDB_DB=
pnpm run test-main

Keywords

FAQs

Last updated on 23 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc