Express middleware for Web Key Directory

Usage no npm install needed!

<script type="module">
  import expressWkd from '';



Express middleware for Web Key Directory


npm install express-wkd


yarn add express-wkd


express-wkd supports both direct mode and advanced mode as described in the Web Key Directory spec.

By default, express-wkd handles both methods.

Default usage

const wkd = require('express-wkd');


Options: domain

Since the domain name is included in the advanced method path, you must specify it in order for advanced method to work.

app.use(wkd({ domain: '' }));

Options: method

To only use the direct or advanced method, set the method option (defaults to all).

app.use(wkd({ method: 'direct' }));   // direct method only
app.use(wkd({ method: 'advanced' })); // advanced method only
app.use(wkd({ method: 'all' }));      // all methods

Options: pathKeys

Set a custom path for the keys (defaults to ./keys/).

app.use(wkd({ pathKeys: './assets/keys/' }));

Cryptographic key files

express-wkd expects the (non-armored) cryptographic key files to be stored in the keys subdirectory relative to the script that called it.

So, if /index.js calls express-wkd, the keys are expected to be stored in /keys/. This behavior can be changed using the pathKeys option.

The cryptographic key files must be non-armored, must have the .pgp file extension and the filename must be equal to the WKD local part. To compute the WKD local part, use the Keyoxide WKD tool.


npm install
npm test


yarn install
yarn test