Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lucia

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucia - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

dist/cookie.d.ts

6

CHANGELOG.md
# lucia
## 3.2.1
### Patch changes
- [#1708](https://github.com/lucia-auth/lucia/pull/1708) by [@pilcrowOnPaper](https://github.com/pilcrowOnPaper) : Update dependencies.
## 3.2.0

@@ -4,0 +10,0 @@

4

dist/core.d.ts

@@ -1,5 +0,5 @@

import { TimeSpan } from "oslo";
import type { Cookie } from "oslo/cookie";
import { TimeSpan } from "./date.js";
import type { Adapter } from "./database.js";
import type { RegisteredDatabaseSessionAttributes, RegisteredDatabaseUserAttributes, RegisteredLucia, UserId } from "./index.js";
import type { Cookie } from "./cookie.js";
type SessionAttributes = RegisteredLucia extends Lucia<infer _SessionAttributes, any> ? _SessionAttributes : {};

@@ -6,0 +6,0 @@ type UserAttributes = RegisteredLucia extends Lucia<any, infer _UserAttributes> ? _UserAttributes : {};

@@ -1,3 +0,3 @@

import { TimeSpan, createDate, isWithinExpirationDate } from "oslo";
import { CookieController } from "oslo/cookie";
import { TimeSpan, createDate, isWithinExpirationDate } from "./date.js";
import { CookieController } from "./cookie.js";
import { generateIdFromEntropySize } from "./crypto.js";

@@ -4,0 +4,0 @@ export class Lucia {

@@ -1,3 +0,1 @@

import type { PasswordHashingAlgorithm } from "oslo/password";
export type { PasswordHashingAlgorithm } from "oslo/password";
export declare function generateId(length: number): string;

@@ -13,1 +11,5 @@ export declare function generateIdFromEntropySize(size: number): string;

}
export interface PasswordHashingAlgorithm {
hash(password: string): Promise<string>;
verify(hash: string, password: string): Promise<boolean>;
}

@@ -1,3 +0,4 @@

import { encodeHex, decodeHex, base32 } from "oslo/encoding";
import { constantTimeEqual, generateRandomString, alphabet } from "oslo/crypto";
import { decodeHex, encodeBase32LowerCaseNoPadding, encodeHexLowerCase } from "@oslojs/encoding";
import { generateRandomString } from "@oslojs/crypto/random";
import { constantTimeEqual } from "@oslojs/crypto/subtle";
import { scrypt } from "./scrypt/index.js";

@@ -13,20 +14,22 @@ async function generateScryptKey(data, salt, blockSize = 16) {

});
return keyUint8Array;
return new Uint8Array(keyUint8Array);
}
const random = {
read(bytes) {
crypto.getRandomValues(bytes);
}
};
export function generateId(length) {
return generateRandomString(length, alphabet("0-9", "a-z"));
const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
return generateRandomString(random, alphabet, length);
}
export function generateIdFromEntropySize(size) {
const buffer = crypto.getRandomValues(new Uint8Array(size));
return base32
.encode(buffer, {
includePadding: false
})
.toLowerCase();
return encodeBase32LowerCaseNoPadding(buffer);
}
export class Scrypt {
async hash(password) {
const salt = encodeHex(crypto.getRandomValues(new Uint8Array(16)));
const salt = encodeHexLowerCase(crypto.getRandomValues(new Uint8Array(16)));
const key = await generateScryptKey(password.normalize("NFKC"), salt);
return `${salt}:${encodeHex(key)}`;
return `${salt}:${encodeHexLowerCase(key)}`;
}

@@ -44,5 +47,5 @@ async verify(hash, password) {

async hash(password) {
const salt = encodeHex(crypto.getRandomValues(new Uint8Array(16)));
const salt = encodeHexLowerCase(crypto.getRandomValues(new Uint8Array(16)));
const key = await generateScryptKey(password.normalize("NFKC"), salt);
return `s2:${salt}:${encodeHex(key)}`;
return `s2:${salt}:${encodeHexLowerCase(key)}`;
}

@@ -49,0 +52,0 @@ async verify(hash, password) {

export { Lucia } from "./core.js";
export { Scrypt, LegacyScrypt, generateId, generateIdFromEntropySize } from "./crypto.js";
export { TimeSpan } from "oslo";
export { Cookie } from "oslo/cookie";
export { verifyRequestOrigin } from "oslo/request";
export { TimeSpan } from "./date.js";
export { Cookie, CookieAttributes } from "./cookie.js";
export { verifyRequestOrigin } from "./request.js";
export type { User, Session, SessionCookieOptions, SessionCookieAttributesOptions } from "./core.js";
export type { DatabaseSession, DatabaseUser, Adapter } from "./database.js";
export type { PasswordHashingAlgorithm } from "./crypto.js";
export type { CookieAttributes } from "oslo/cookie";
import type { Lucia } from "./core.js";

@@ -11,0 +10,0 @@ export interface Register {

export { Lucia } from "./core.js";
export { Scrypt, LegacyScrypt, generateId, generateIdFromEntropySize } from "./crypto.js";
export { TimeSpan } from "oslo";
export { Cookie } from "oslo/cookie";
export { verifyRequestOrigin } from "oslo/request";
export { TimeSpan } from "./date.js";
export { Cookie } from "./cookie.js";
export { verifyRequestOrigin } from "./request.js";
{
"name": "lucia",
"version": "3.2.0",
"version": "3.2.1",
"description": "A simple and flexible authentication library",

@@ -32,3 +32,4 @@ "main": "dist/index.js",

"dependencies": {
"oslo": "1.2.0"
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.1.0"
},

@@ -35,0 +36,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc