Skip to content

Commit

Permalink
remove csrf
Browse files Browse the repository at this point in the history
  • Loading branch information
evantahler committed Apr 2, 2024
1 parent ad05b14 commit 8f8f763
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 5 deletions.
1 change: 0 additions & 1 deletion __tests__/actions/session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ test("returns user when matched", async () => {
expect(response.user.id).toEqual(1);
expect(response.user.name).toEqual("Mario Mario");
expect(response.session.createdAt).toBeGreaterThan(0);
expect(response.session.csrfToken).not.toBe(null);
expect(response.session.data.userId).toEqual(response.user.id);
});

Expand Down
1 change: 0 additions & 1 deletion __tests__/actions/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ describe("userEdit", () => {
const sessionResponse =
(await sessionRes.json()) as ActionResponse<SessionCreate>;
expect(sessionRes.status).toBe(200);
const csrfToken = sessionResponse.session.csrfToken;
const sessionId = sessionResponse.session.id;

await Bun.sleep(1001);
Expand Down
3 changes: 0 additions & 3 deletions initializers/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const namespace = "session";
export interface SessionData {
id: string;
cookieName: typeof config.session.cookieName;
csrfToken: string;
createdAt: number;
data: Record<string, any>;
}
Expand Down Expand Up @@ -40,12 +39,10 @@ export class Session extends Initializer {

create = async (connection: Connection, data: Record<string, any> = {}) => {
const key = this.getKey(connection.id);
const csrfToken = crypto.randomUUID() + ":" + crypto.randomUUID();

const sessionData: SessionData = {
id: connection.id,
cookieName: config.session.cookieName,
csrfToken: csrfToken,
createdAt: new Date().getTime(),
data,
};
Expand Down

0 comments on commit 8f8f763

Please sign in to comment.