crumb

CSRF crumb generation and validation for hapi.

Latest Version: 9.0.1
hapi-family
Installation:

npm: npm install @hapi/crumb

yarn: yarn add @hapi/crumb

Module Status:
Version License Node Dependencies CI
BSD 16, 18, 20, 22 Dependency Status Build Status
BSD 16, 18, 20, 22 Dependency Status Build Status

Usage

 const Hapi = require('@hapi/hapi');
 const Crumb = require('@hapi/crumb');
 const server = new Hapi.Server({ port: 8000 });
 (async () => {
 await server.register({
 plugin: Crumb,
 // plugin options
 options: {}
 });
 server.route({
 path: '/login',
 method: 'GET',
 options: {
 plugins: {
 // route specific options
 crumb: {}
 },
 handler(request, h) {
 // this requires to have a view engine configured
 return h.view('some-view');
 }
 }
 });
 })();

For a complete example see the examples folder.

AltStyle によって変換されたページ (->オリジナル) /