Socket
Book a DemoInstallSign in
Socket

mali-apikey

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mali-apikey

Api key authorization metadata middleware for Mali

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

mali-apikey

Mali API key metadata authorization middleware

npm version build status

API

mali-apikey

Mali API key authorization metadata middleware. If the call has metadata with "authorization" string property with "apikey " then specified function is called

ParamTypeDescription
optionsOptions
options.keyFieldStringOptional key field within the authorization value to look for. Default: "apikey"
options.errorString | Object | functionoptional Error creation options. If String the message for Error to throw in case authorization is not present. If Object the error options with message, code, and metadata properties. See create-grpc-error module. If Function a function with signature (ctx) called to create an error. Must return an Error instanse. Default: "Not Authorized"
fnfunctionThe middleware function to execute with signature (key, ctx, next)

Example

const apikey = require('mali-apikey')

app.use(apikey(async (key, ctx, next) => {
  console.log(key)
  await next()
})

License

Apache-2.0

Keywords

mali

FAQs

Package last updated on 30 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts