
A Seneca.js plugin for providing API keys.
@seneca/apikey

Description
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.
Install
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()
.use('promisify')
.use('entity')
.use('apikey')
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:
Options
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.
Parameters
- owner : string "Â "
- scope : string "default"
Replies With
{
ok: '`true` if successful',
key: 'key string'
}
ÂŤ sys:apikey,verify:key Âť
Verify an API key.
Parameters
- owner : string "Â "
- scope : string "default"
- key : string "Â "
Replies With
{
ok: '`true` if verified',
why: 'explanation code'
}
License
Copyright (c) 2010-2020, Richard Rodger and other contributors.
Licensed under MIT.