Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lit-node-client-nodejs test by adding issuedAt to SIWE message #772

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

susumutomita
Copy link
Contributor

Description

This PR fixes the failing test in packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sigs.spec.ts. The test currently throws:

Invalid SIWE message. Missing expirationTime or issuedAt.

because the SiweMessage created in the test has expirationTime but no issuedAt. According to blsSessionSigVerify logic in validate-bls-session-sig.ts, both issuedAt and expirationTime must be present.

By adding issuedAt: new Date().toISOString() to the new SiweMessage({ ... }), the test now passes without error, aligning with EIP-4361 which typically includes issuedAt.

Related Issue:
fix #771


Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change
  • Documentation update

How Has This Been Tested?

  1. Local
    • Ran npx nx run lit-node-client-nodejs:test locally after adding issuedAt.
    • Confirmed the test suite passes without throwing “Invalid SIWE message. Missing expirationTime or issuedAt.”
~/js-sdk bugfix/verify-bls-signature-tests-issue771
❯ npx nx run lit-node-client-nodejs:test                    

> nx run lit-node-client-nodejs:test  [existing outputs match the cache, left as is]

 PASS   lit-node-client-nodejs  packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sigs.spec.ts
Thu, 16 Jan 2025 23:05:36 GMT lit-js-sdk:constants:constants deprecated LogLevel is deprecated and will be removed in a future version. Use LOG_LEVEL instead. at dist/packages/core/src/lib/lit-core.js:451:90
(node:58033) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 PASS   lit-node-client-nodejs  packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.spec.ts
  ● Console

    console.debug
      [Lit-JS-SDK v7.0.4] [2025-01-16T23:05:36.696Z] [DEBUG] [core] localstorage api not found, injecting persistence instance found in config

      at Logger._log (../../dist/packages/logger/src/lib/logger.js:227:22)


Test Suites: 13 passed, 13 total
Tests:       43 passed, 43 total
Snapshots:   0 total
Time:        4.758 s
Ran all test suites.
 —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Successfully ran target test for project lit-node-client-nodejs (81ms)
 
   Nx read the output from the cache instead of running the command for 1 out of 1 tasks.

Test Suites: 13 passed, 13 total
Tests: 43 passed, 43 total
Snapshots: 0 total
Time: 4.758 s
Ran all test suites.

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

NX Successfully ran target test for project lit-node-client-nodejs (67ms)

Nx read the output from the cache instead of running the command for 1 out of 1 tasks.


Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if any)
  • My changes generate no new warnings
  • I have added tests (or updated the existing test) that confirm my fix is effective
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Note: If in the future we decide that issuedAt is not strictly required, we can revisit blsSessionSigVerify. For now, EIP-4361 and Lit’s validation logic suggest that issuedAt is the correct approach.

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.

lit-node-client-nodejs test fails with "Invalid SIWE message. Missing expirationTime or issuedAt."
1 participant