Skip to content

[TILES-PW-2] PLU-672: crypto-related helpers#1450

Merged
pregnantboy merged 1 commit intodevelop-v2from
tiles-password/crypto
Mar 10, 2026
Merged

[TILES-PW-2] PLU-672: crypto-related helpers#1450
pregnantboy merged 1 commit intodevelop-v2from
tiles-password/crypto

Conversation

@pregnantboy
Copy link
Copy Markdown
Contributor

@pregnantboy pregnantboy commented Mar 5, 2026

Changes

Added authentication utilities for tile password hashing and view token management with JWT-based session tokens.

What changed?

Created auth-tiles.ts helper module with functions for:

  • Password hashing using scrypt with tiles viewOnlyKey as salt (hashTilePassword, verifyTilePassword)
  • Random token nonce generation (generateTokenNonce)
  • JWT view token creation and verification (generateViewToken, verifyViewToken)

The view tokens include tileId, viewOnlyKey, and tokenNonce in the payload and expire after 24 hours. Password hashes are automatically invalidated when the viewOnlyKey or passwordNonce changes since it's used as the salt.

How to test?

Covered by unit tests

  • Correct and incorrect password verification
  • Valid and invalid view token scenarios (wrong parameters, malformed tokens, expired tokens, wrong signing secret)
  • Edge cases like non-JWT errors

@pregnantboy pregnantboy changed the title feat: add crypto related helpers [TILES-PW] PLU-672: DB schema Mar 6, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Mar 6, 2026

@pregnantboy pregnantboy changed the title [TILES-PW] PLU-672: DB schema [TILES-PW-2] PLU-672: DB schema Mar 6, 2026
@pregnantboy pregnantboy changed the title [TILES-PW-2] PLU-672: DB schema [TILES-PW-2] PLU-672: crypto-related helpers Mar 6, 2026
@pregnantboy pregnantboy marked this pull request as ready for review March 7, 2026 10:14
@pregnantboy pregnantboy requested a review from a team as a code owner March 7, 2026 10:14
Comment thread packages/backend/src/helpers/auth-tiles.ts
Copy link
Copy Markdown
Contributor

@kevinkim-ogp kevinkim-ogp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than the comment from graphite, lgtm!

Copy link
Copy Markdown
Contributor Author

pregnantboy commented Mar 10, 2026

Merge activity

  • Mar 10, 6:25 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 6:27 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 6:29 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 10, 6:29 AM UTC: The Graphite merge of this pull request was cancelled.
  • Mar 10, 6:29 AM UTC: @pregnantboy merged this pull request with Graphite.

@pregnantboy pregnantboy changed the base branch from tiles-password/db-schema to graphite-base/1450 March 10, 2026 06:25
@pregnantboy pregnantboy changed the base branch from graphite-base/1450 to develop-v2 March 10, 2026 06:28
@pregnantboy pregnantboy force-pushed the tiles-password/crypto branch from 34416a9 to 9221dd9 Compare March 10, 2026 06:28
@pregnantboy pregnantboy merged commit 97fa126 into develop-v2 Mar 10, 2026
7 checks passed
@pregnantboy pregnantboy deleted the tiles-password/crypto branch March 10, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants