Skip to content

tests: add regression tests for Windows identity DPAPI storage and migration (#181) - #197

Open
Yashkush06 wants to merge 1 commit into
InukaAsith:mainfrom
Yashkush06:identity-dpapi-tests
Open

Yashkush06 wants to merge 1 commit into
InukaAsith:mainfrom
Yashkush06:identity-dpapi-tests

Conversation

@Yashkush06

Copy link
Copy Markdown

Summary

Closes #181.

Adds dedicated regression test coverage for windows/identity.js, covering the DPAPI-backed passphrase storage introduced in #139 and safety guards from #137.

What is covered:

  • DPAPI encryption and decryption: Validates that writePass encrypts the passphrase with safeStorage.encryptString and readPass decrypts it.
  • Legacy plaintext migration: Validates that older 48-character hex plaintext passphrases are recognized, returned, and re-sealed on disk with DPAPI on first read.
  • safeStorage unavailable fallback: Validates that when DPAPI encryption is not available, passphrases fall back to plain text read/write cleanly.
  • Invalid / corrupted data safety: Ensures corrupted ciphertext or unreadable passphrases that fail decryption are never overwritten on disk, preventing data loss.
  • Whitespace / newline handling: Verifies whitespace/newlines are properly trimmed in both DPAPI and plaintext modes.

Verification

Ran tests with node --test windows/test/identity.test.js:

  • 9 tests passing (0 failures).
  • Syntax validated with node --check.

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.

1 participant