Apikey management plugin for Seneca

Usage no npm install needed!

<script type="module">
  import senecaApikey from 'https://cdn.skypack.dev/@seneca/apikey';



A Seneca.js plugin for providing API keys.


npm version Build Status Coverage Status Maintainability DeepScan grade Dependency Status Gitter

Voxgig This open source module is sponsored and supported by Voxgig.


This module is a plugin for the Seneca framework. It provides common actions for supplying API keys to external clients.

API keys are generated and hashed to the same level as passwords.


npm install seneca
npm install seneca-promisify // dependency
npm install seneca-entity // dependency
npm install @seneca/user // dependency
npm install @seneca/apikey

Quick example

Register a apikey and then create an automatic login for testing.

const Seneca = require('seneca')

var seneca = Seneca()

// TODO: complete quick example

Detailed Examples

Because Seneca treats messages as first-class citizens, 90% of unit testing can be implemented with message scenarios that also provide detailed usage examples:


  • test : boolean false
  • keysize : number 32
  • tagsize : number 8
  • rounds : number 11
  • salt.bytelen : number 16
  • salt.format : string "hex"
  • pepper : string ""
  • generate_salt : function generate_salt

Set plugin options when loading with:

seneca.use('apikey', { name: value, ... })

Note: foo.bar in the list above means { foo: { bar: ... } }

Action Patterns

Action Descriptions

« sys:apikey,generate:key »

Generate a new API key.


  • owner : string " "
  • scope : string "default"

Replies With

  ok: '`true` if successful',
  key: 'key string'

« sys:apikey,verify:key »

Verify an API key.


  • owner : string " "
  • scope : string "default"
  • key : string " "

Replies With

  ok: '`true` if verified',
  why: 'explanation code'


Copyright (c) 2010-2020, Richard Rodger and other contributors. Licensed under MIT.