Skip to content

@mega-yfue/eufy-sdk / isSessionValid

Function: isSessionValid() ​

ts
function isSessionValid(s, skewSec?): boolean;

A persisted session is usable if it carries a complete credential — token, bound ECDH key, and the account id the gtoken header is hashed from — whose token isn't (near-)expired.

accountUserId is part of the credential, not an optional extra: a record without it was written before that id was tracked, so it can only be restored as the other id, which is what the gateway rejects the header on. Nothing in a restored session can recover it either — the id arrives with a login reply. So such a record is refused and one login re-establishes it, rather than reinstating a session whose every authenticated call fails identically.

Parameters ​

s ​

PersistedSession | null

skewSec? ​

number = 300

Returns ​

boolean

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations, Anker eufy, or eufy. "Anker eufy", "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.