tubsproject / solid-slack-bridge

GNU General Public License v3.0
1 stars 0 forks source link

Persist sessions to database #8

Open michielbdejong opened 3 days ago

michielbdejong commented 3 days ago

In the current code, a 'session' is a link between a specific Slack user (UUID) and a specific Solid pod (web ID).

It is stored in memory, so it's lost whenever the server restarts.

michielbdejong commented 3 days ago

I can reuse code from https://github.com/tosdr/ota-engine/commit/8d8f48bd8c2ac6242d9980bca808de5843940c06

michielbdejong commented 2 days ago

JSON-stringifying Session objects is not the way. Instead, it seems we need to pass a k-v store to the Session constructor:

export default interface IStorage {
    get: (key: string) => Promise<string | undefined>;
    set: (key: string, value: string) => Promise<void>;
    delete: (key: string) => Promise<void>;
}
michielbdejong commented 2 days ago

Should also read the docs about how to persist @inrupt/solid-client-authn-node sessions to db.

michielbdejong commented 23 hours ago

I found the relevant docs for storing the Solid sessions. Moving this to solid-client, and adding that as a dependency of solid-slack-bridge. Solid-slack-bridge can then still keep its own db table to link Slack UUIDs to Solid WebIDs.