@graffiti-garden/solid-oidc-session-manager v0.1.7
Graffiti Solid OIDC Session Manager
This implements the login and logout methods of the Graffiti API using Solid OIDC.
In the browser, when an application calls graffiti.login(), a dialog opens up that allows the user to log in either
locally (for demoing/testing) or with a Solid OIDC provider.
The actor IDs produced from Solid login are webId URLs that start with http,
while actor IDs produced from local login will not start with http.
The node.js interface is not currently implemented and just
returns an instance of
GraffitiLocalSessionManager,
but at some point it will be extended to use
@inrupt/solid-client-authn-node.
Usage
Install the package with:
npm install @graffiti-garden/solid-oidc-session-managerThen use it in your application as follows:
import { GraffitiSolidOIDCSessionManager } from "@graffiti-garden/solid-oidc-session-manager";
const sessionManager = new GraffitiSolidOIDCSessionManager();
sessionManager.sessionEvents.addEventListener("login", (event) => {
console.log("Logged in as", event.detail.actor);
});
// Log in, in response to a user action
button.onclick = () => sessionManager.login()See the demo for a full example.
Development
Clone the repository, then install and build the package as follows:
npm install
npm run buildThen you can run the demo by running:
npx http-serverand navigating to localhost:8080/demo.
Image Compression
To make the .jpg image smaller, use:
cwebp -q QUALITY -m 6 -mt graffiti.jpg -o graffiti.webpWhere quality is a number between 0 (horrible) and 100 (perfect).