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

LastLoggedIn still broken 😮‍💨 #2588

Open
taoeffect opened this issue Feb 3, 2025 · 2 comments
Open

LastLoggedIn still broken 😮‍💨 #2588

taoeffect opened this issue Feb 3, 2025 · 2 comments
Assignees
Labels
App:Frontend Kind:Bug Kind:Core Anything that changes or affects the fundamental core data structures & design of the application. Priority:High

Comments

@taoeffect
Copy link
Member

taoeffect commented Feb 3, 2025

Problem

Image

The uCHELONIA_STATE:

Image

The other state:

Image

One other potential problem is that we use new Date() to get this value:

    const now = new Date().toISOString()

The user's clock could be wrong.

Solution

  1. Figure out why it's not being updated correctly and fix it.
  2. Use new Date(sbp('chelonia/time')) instead of naked new Date()
@taoeffect taoeffect added App:Frontend Kind:Bug Kind:Core Anything that changes or affects the fundamental core data structures & design of the application. Priority:High labels Feb 3, 2025
@taoeffect
Copy link
Member Author

Image

Notice the Error updating lastLoggedIn Error: kv/set invalid response status: 401

And there are Invalid signature time range messages on the server, so maybe this is the cause?

@taoeffect
Copy link
Member Author

taoeffect commented Feb 7, 2025

We've narrowed this down to likely being related to ?.data:

return (await sbp('chelonia/kv/get', contractID, KV_KEYS.LAST_LOGGED_IN))?.data || Object.create(null)

And related code, e.g.:

    get data () {
      if (!encryptedData) return
      if (isSignedData(encryptedData.data)) {
        return encryptedData.data.valueOf()
      }
      return encryptedData.data
    },

Note there's the same issue in identity-kv.js:

return (await sbp('chelonia/kv/get', identityContractID, KV_KEYS.UNREAD_MESSAGES))?.data || {}

And who knows, maybe that's related to fixing #2442 too?

corrideat added a commit that referenced this issue Feb 7, 2025
Changes to `kv/get` to propagate decryption errors (related to #2588).

Closes #2589.
taoeffect pushed a commit that referenced this issue Feb 7, 2025
* Add `wsOnly` parameter to avoid broadcasting KV updates.

Changes to `kv/get` to propagate decryption errors (related to #2588).

Closes #2589.

* Feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App:Frontend Kind:Bug Kind:Core Anything that changes or affects the fundamental core data structures & design of the application. Priority:High
Projects
None yet
Development

No branches or pull requests

2 participants