Skip to content

iroco-co/jmap-admin

Repository files navigation

JMAP Admin

CircleCI

JMAP administration front written in svelte for:

  • create, remove calendars
  • create, remove addressbooks
  • create, remove shared folders
  • manage rights for calendars/addressbooks/folders
  • quota management

The architecture is based on SvelteKit back and front with typescript, JMAP server as backend. The JMAP backend base URL is given to the app with JMAP_URL environment variable.

The goal is to make a graphical interface for what cyradm is providing as command line interface.

It is a work in progress.

Running & Configuration

There is a docker image here: iroco/jmapadmin.

Two environment variables are needed by the app:

  • JMAP_URL: the backend url
  • JWT_SECRET: the JWT signing key

Optionally and depending on your web server configuration, PORT, HOST, ORIGIN and other env variables can be set, see the sveltekit node adapter configuration.

Authenticating

The app is stateless, the user should come with a Json Web Token in a Authorization cookie. The JWT will be used to send JMAP queries to the backend. For Cyrus the header has to contain the fields,

{
	"typ": "JWT",
	"alg": "HS512"
}

The payload should have the following structure:

{
	"role": 3,
	"sub": "[email protected]",
	"iat": 1704359437,
	"iss": "urn:iroco:issuer",
	"exp": 1704361242
}

The role is corresponding to the typescript enum. It should be ADMIN(3) else a 403 Unauthorized will be thrown:

enum Role {
	Temporary,
	Trial,
	User,
	Admin,
	SuperAdmin
}

A secret should be provided to the app with an environment variable JWT_SECRET to check the signature of the token. For more details on accessing the app see hooks.server.ts. For authenticating to the backend, the same secret should be shared with the JMAP or IMAP server (for Cyrus see the http_jwt_key_dir section in imapd.conf).

Develop

Installing dépendencies

npm i

Run tests

npm run test

Run dev server

npm run dev

Releasing: the docker is built and pushed by the CI. We use release-it for creating a TAG. We use the semantic versioning.

npm run release