Skip to content

Commit

Permalink
Update lucia dependencies (#1158)
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper authored Oct 26, 2023
1 parent 7c6a84a commit bf38689
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 307 deletions.
6 changes: 6 additions & 0 deletions .auri/$d2qojx1e.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
package: "lucia" # package name
type: "patch" # "major", "minor", "patch"
---

Update dependencies
4 changes: 4 additions & 0 deletions packages/lucia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@
"@types/node": "^18.6.2",
"prettier": "^2.3.0",
"vitest": "^0.33.0"
},
"dependencies": {
"@noble/hashes": "1.3.2",
"nanoid": "5.0.1"
}
}
2 changes: 1 addition & 1 deletion packages/lucia/src/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DEFAULT_SESSION_COOKIE_NAME, createSessionCookie } from "./cookie.js";
import { logError } from "../utils/log.js";
import { generateScryptHash, validateScryptHash } from "../utils/crypto.js";
import { generateRandomString } from "../utils/nanoid.js";
import { generateRandomString } from "../utils/crypto.js";
import { LuciaError } from "./error.js";
import { parseCookie } from "../utils/cookie.js";
import { isValidDatabaseSession } from "./session.js";
Expand Down
21 changes: 0 additions & 21 deletions packages/lucia/src/scrypt/MODULE_LICENSE

This file was deleted.

28 changes: 0 additions & 28 deletions packages/lucia/src/scrypt/index.test.ts

This file was deleted.

193 changes: 0 additions & 193 deletions packages/lucia/src/scrypt/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions packages/lucia/src/scrypt/pbkdf.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/lucia/src/utils/crypto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { test, expect } from "vitest";
import {
convertUint8ArrayToHex,
generateScryptHash,
validateScryptHash
validateScryptHash,
generateRandomString
} from "./crypto.js";
import { generateRandomString } from "./nanoid.js";

test("convertUint8ArrayToHex() output matches Buffer.toString()", async () => {
const testUint8Array = crypto.getRandomValues(new Uint8Array(16));
Expand Down
10 changes: 8 additions & 2 deletions packages/lucia/src/utils/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { LuciaError } from "../auth/error.js";
import scrypt from "../scrypt/index.js";
import { generateRandomString } from "./nanoid.js";
import { scryptAsync as scrypt } from "@noble/hashes/scrypt";
import { customAlphabet } from "nanoid";

export const generateRandomString = (length: number, alphabet?: string) => {
const DEFAULT_ALPHABET = "abcdefghijklmnopqrstuvwxyz1234567890";
const customNanoid = customAlphabet(alphabet ?? DEFAULT_ALPHABET);
return customNanoid(length);
};

export const generateScryptHash = async (s: string): Promise<string> => {
const salt = generateRandomString(16);
Expand Down
4 changes: 2 additions & 2 deletions packages/lucia/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { generateRandomString } from "./nanoid.js";
export { serializeCookie, parseCookie } from "./cookie.js";
export { isWithinExpiration } from "./date.js";
export {
generateScryptHash as generateLuciaPasswordHash,
validateScryptHash as validateLuciaPasswordHash
validateScryptHash as validateLuciaPasswordHash,
generateRandomString
} from "./crypto.js";
export { joinAdapters as __experimental_joinAdapters } from "./adapter.js";
31 changes: 0 additions & 31 deletions packages/lucia/src/utils/nanoid.ts

This file was deleted.

0 comments on commit bf38689

Please sign in to comment.