refactor: strip Phase/Plan/R-number references from source comments
This commit is contained in:
@@ -13,7 +13,7 @@ import type { User } from "../../entities/models/user";
|
||||
// generic session interface without deep integration with Payload's REST/local
|
||||
// API and cookie infrastructure.
|
||||
//
|
||||
// TODO(lazar-conformance §7): Implement these three methods once the session
|
||||
// TODO: Implement these three methods once the session
|
||||
// cookie strategy is settled. Until then they throw NotImplementedError to
|
||||
// keep the production-shaped file in place without silently no-oping.
|
||||
//
|
||||
@@ -21,7 +21,7 @@ import type { User } from "../../entities/models/user";
|
||||
|
||||
class NotImplementedError extends Error {
|
||||
constructor(method: string) {
|
||||
super(`NotImplemented: AuthenticationService.${method} — see refactor log §7`);
|
||||
super(`NotImplemented: AuthenticationService.${method}`);
|
||||
this.name = "NotImplementedError";
|
||||
}
|
||||
}
|
||||
@@ -42,10 +42,17 @@ export class AuthenticationService implements IAuthenticationService {
|
||||
async hashPassword(password: string): Promise<string> {
|
||||
const salt = crypto.randomBytes(SALT_LENGTH).toString("hex");
|
||||
const hash = await new Promise<string>((resolve, reject) => {
|
||||
crypto.pbkdf2(password, salt, ITERATIONS, KEY_LENGTH, DIGEST, (err, derivedKey) => {
|
||||
if (err) reject(err);
|
||||
else resolve(derivedKey.toString("hex"));
|
||||
});
|
||||
crypto.pbkdf2(
|
||||
password,
|
||||
salt,
|
||||
ITERATIONS,
|
||||
KEY_LENGTH,
|
||||
DIGEST,
|
||||
(err, derivedKey) => {
|
||||
if (err) reject(err);
|
||||
else resolve(derivedKey.toString("hex"));
|
||||
},
|
||||
);
|
||||
});
|
||||
return `${salt}${SEPARATOR}${hash}`;
|
||||
}
|
||||
@@ -56,10 +63,17 @@ export class AuthenticationService implements IAuthenticationService {
|
||||
const salt = parts[0]!;
|
||||
const expectedHash = parts[1]!;
|
||||
const actualHash = await new Promise<string>((resolve, reject) => {
|
||||
crypto.pbkdf2(password, salt, ITERATIONS, KEY_LENGTH, DIGEST, (err, derivedKey) => {
|
||||
if (err) reject(err);
|
||||
else resolve(derivedKey.toString("hex"));
|
||||
});
|
||||
crypto.pbkdf2(
|
||||
password,
|
||||
salt,
|
||||
ITERATIONS,
|
||||
KEY_LENGTH,
|
||||
DIGEST,
|
||||
(err, derivedKey) => {
|
||||
if (err) reject(err);
|
||||
else resolve(derivedKey.toString("hex"));
|
||||
},
|
||||
);
|
||||
});
|
||||
return crypto.timingSafeEqual(
|
||||
Buffer.from(expectedHash, "hex"),
|
||||
@@ -67,23 +81,27 @@ export class AuthenticationService implements IAuthenticationService {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO(lazar-conformance §7): Implement using Payload's local.login / JWT session issuance.
|
||||
// TODO:Implement using Payload's local.login / JWT session issuance.
|
||||
// Payload creates sessions via its REST auth endpoint; mapping that to a
|
||||
// generic { session: Session; cookie: Cookie } shape requires understanding
|
||||
// the JWT payload structure and the cookie name/attributes Payload uses.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
async createSession(user: User): Promise<{ session: Session; cookie: Cookie }> {
|
||||
async createSession(
|
||||
user: User,
|
||||
): Promise<{ session: Session; cookie: Cookie }> {
|
||||
throw new NotImplementedError("createSession");
|
||||
}
|
||||
|
||||
// TODO(lazar-conformance §7): Implement using Payload's JWT verify mechanism.
|
||||
// TODO:Implement using Payload's JWT verify mechanism.
|
||||
// Need to call Payload's local API to verify the token and retrieve the user.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
async validateSession(sessionId: string): Promise<{ user: User; session: Session }> {
|
||||
async validateSession(
|
||||
sessionId: string,
|
||||
): Promise<{ user: User; session: Session }> {
|
||||
throw new NotImplementedError("validateSession");
|
||||
}
|
||||
|
||||
// TODO(lazar-conformance §7): Implement by clearing the session token.
|
||||
// TODO:Implement by clearing the session token.
|
||||
// Payload does not have a server-side session store by default; invalidation
|
||||
// is typically done client-side by clearing the cookie.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
||||
Reference in New Issue
Block a user