@ovos-media/sign-helpers
v2.2.1
Published
Helpers for sign service.
Downloads
2
Keywords
Readme
@ovos-media/sign-helpers
Helpers for signed resources.
Usage
const makeVerifyRequest = require('@ovos-media/sign-helpers').verifyRequest;
const verifyRequest = makeVerifyRequest({
basePath: process.env.SERVICE_PATH,
path(ctx) { return ctx.request.url; },
parseReferer: true, // this is a default, can be overwritten optional
refererRegex: /https?:\/\/[a-zA-Z0-9\.\:]*(.*)\// // this is a default, can be overwritten optional
});
const work = (ctx) => {
const credentials = verifyRequest(ctx);
if (credentials) {
ctx.status = 200;
} else {
ctx.status = 401;
}
}
router.get('/url', work);
Contributors
created at ovos with ♥