Skip to content

1681-engine / electron / SessionStore

Class: SessionStore ​

Defined in: src/electron/sessionStore.ts:25

One small secret (a refresh token and username, as a JSON string) kept for "stay logged in", encrypted by the OS — safeStorage: DPAPI for the Windows user, the Keychain on the Mac. Where the OS offers no real encryption (Linux without a keyring: basic_text, a key written into Chromium) nothing is written and the player logs in again after closing; a token on disk in the clear is worse than that. Never localStorage: any script in the page could read it.

Constructors ​

Constructor ​

ts
new SessionStore(o): SessionStore;

Defined in: src/electron/sessionStore.ts:30

Parameters ​

ParameterType
oSessionStoreOptions

Returns ​

SessionStore

Methods ​

canEncrypt() ​

ts
canEncrypt(): boolean;

Defined in: src/electron/sessionStore.ts:37

Whether the OS can encrypt for real here.

Returns ​

boolean


clear() ​

ts
clear(): Promise<void>;

Defined in: src/electron/sessionStore.ts:69

Returns ​

Promise<void>


get() ​

ts
get(): Promise<string | null>;

Defined in: src/electron/sessionStore.ts:44

The saved value, or null when there is none, it cannot be decrypted (another OS user, a reinstall) or nothing may be.

Returns ​

Promise<string | null>


set() ​

ts
set(value): Promise<boolean>;

Defined in: src/electron/sessionStore.ts:54

Saves value; false when it is not a string, too long, or the OS cannot encrypt it.

Parameters ​

ParameterType
valueunknown

Returns ​

Promise<boolean>

Released under the MIT License.