diff options
Diffstat (limited to 'src/routers/vault/types/Session.js')
-rw-r--r-- | src/routers/vault/types/Session.js | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/routers/vault/types/Session.js b/src/routers/vault/types/Session.js index 34bd250..1809cac 100644 --- a/src/routers/vault/types/Session.js +++ b/src/routers/vault/types/Session.js @@ -2,20 +2,42 @@ * holds a cache of all the user data fetched from SQL */ module.exports = class Session { - expires = new Date(); // expiry Date - vault = null; // Vault account id - authenticated = false; // whether the user logged in - identity = null; // the identity that was used to log in - email; // the email address of the identity that was used to log in - identities = []; // cache holding all identities - primaryIdentity = null; // the main identity of the account - allowNonPrimary = true; // whether to allow logging in with a non-primary ident - legacyAccounts = []; // cache holding all legacy game accounts - gameAccounts = []; // cache holding all evol game accounts - ip; // ip that was used to init the session + /** expiry Date */ + expires = new Date(); + /** Vault account id */ + vault = null; + /** whether the user logged in */ + authenticated = false; + /** the identity that was used to log in */ + identity = null; + /** the email address of the identity that was used to log in */ + email; + /** cache holding all identities */ + identities = []; + /** the main identity of the account */ + primaryIdentity = null; + /** whether to allow logging in with a non-primary ident */ + allowNonPrimary = true; + /** LegacyAccount[] cache holding all legacy game accounts */ + legacyAccounts = []; + /** EvolAccount[] cache holding all evol game accounts */ + gameAccounts = []; + /** ip that was used to init the session */ + ip; constructor (ip, email) { this.ip = ip; this.email = email; } + + /** + * serialize for sending over the network + * @param {*} key + */ + toJSON (key) { + return { + expires: this.expires, + identity: this.identity, + } + } } |