Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -5,3 +5,3 @@ import { AuthRequest } from "./request.js"; | ||
import type { Adapter } from "./database.js"; | ||
import type { DatabaseSessionAttributes, DatabaseUserAttributes, RegisteredLucia } from "../index.js"; | ||
import { type DatabaseSessionAttributes, type DatabaseUserAttributes, type RegisteredLucia } from "../index.js"; | ||
type SessionAttributes = RegisteredLucia extends Lucia<any, infer _SessionAttributes, any> ? _SessionAttributes : {}; | ||
@@ -8,0 +8,0 @@ type UserAttributes = RegisteredLucia extends Lucia<any, any, infer _UserAttributes> ? _UserAttributes : {}; |
@@ -6,4 +6,4 @@ import { AuthRequest } from "./request.js"; | ||
import { TimeSpan, isWithinExpirationDate } from "oslo"; | ||
import { generateRandomString, alphabet } from "oslo/random"; | ||
import { verifyRequestOrigin } from "oslo/request"; | ||
import { generateId } from "../index.js"; | ||
export class Lucia { | ||
@@ -109,3 +109,3 @@ adapter; | ||
async createSession(userId, attributes) { | ||
const sessionId = generateRandomString(40, alphabet("0-9", "a-z")); | ||
const sessionId = generateId(40); | ||
const sessionExpiresAt = this.sessionController.createExpirationDate(); | ||
@@ -112,0 +112,0 @@ await this.adapter.setSession({ |
export { Lucia } from "./auth/index.js"; | ||
export { AuthRequest } from "./auth/request.js"; | ||
export { generateScryptHash as generateLegacyLuciaPasswordHash, verifyScryptHash as verifyLegacyLuciaPasswordHash } from "./utils/crypto.js"; | ||
export { generateScryptHash as generateLegacyLuciaPasswordHash, verifyScryptHash as verifyLegacyLuciaPasswordHash, generateId } from "./utils/crypto.js"; | ||
export { TimeSpan } from "oslo"; | ||
@@ -5,0 +5,0 @@ export type { User, Session, ExperimentalOptions, SessionCookieOptions, CSRFProtectionOptions, SessionCookieAttributesOptions, RequestContext, Middleware } from "./auth/index.js"; |
export { Lucia } from "./auth/index.js"; | ||
export { AuthRequest } from "./auth/request.js"; | ||
export { generateScryptHash as generateLegacyLuciaPasswordHash, verifyScryptHash as verifyLegacyLuciaPasswordHash } from "./utils/crypto.js"; | ||
export { generateScryptHash as generateLegacyLuciaPasswordHash, verifyScryptHash as verifyLegacyLuciaPasswordHash, generateId } from "./utils/crypto.js"; | ||
export { TimeSpan } from "oslo"; |
export declare const generateScryptHash: (s: string) => Promise<string>; | ||
export declare const verifyScryptHash: (s: string, hash: string) => Promise<boolean>; | ||
export declare function generateId(length: number): string; |
import { encodeHex, decodeHex } from "oslo/encoding"; | ||
import { constantTimeEqual } from "oslo/crypto"; | ||
import { scrypt } from "../scrypt/index.js"; | ||
import { alphabet, generateRandomString } from "oslo/random"; | ||
export const generateScryptHash = async (s) => { | ||
@@ -35,1 +36,4 @@ const salt = encodeHex(crypto.getRandomValues(new Uint8Array(16))); | ||
}; | ||
export function generateId(length) { | ||
return generateRandomString(length, alphabet("0-9", "a-z")); | ||
} |
{ | ||
"name": "lucia", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "A simple and flexible authentication library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
62473
1186