5.0.0 • Published 6 years ago

vados-i18n v5.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

vados-requesthasher

A plugin decrypts querystring, request body data (except multipart) and encrypts response body data for vados

Install

npm i vados-requesthasher -S

Examples

Typescript

Use like a middleware

import { Server } from 'vados';
import { hasher } from 'vados-hasher';

Server.use(hasher('Key is 8 characters', {
    baseOnRequest: false,
    mode: ['query', 'body', 'response']
}))

Use in controller (Manual apis which you want encrypt data when you not declare in Server.use)

import { GET, POST, PUT, DELETE, HEAD, INJECT } from 'vados-route';
import { HASHER, Hasher } from 'vados-requesthasher';

const key = Hasher.create('Key is 8 characters');

export default class TestController {
    @GET('/test')
    @HASHER(key, {
        baseOnRequest: false,
        mode: ['query', 'body', 'response']
    })
    static async test({ body, headers, query }) {
    	return {
    		name: 'thanh'
    	};
    }
}

In that:

  • baseOnRequest: Plugin auto detect to encrypt, decrypt base on request from client via "accept" field is "text/encryption"
  • mode: Which is encrypted or decrypted.
    • query: Decrypt query string on request which is sent by client
    • body: Decrypt body data in POST, PUT (except multipart type) which is sent by client
    • response: Encrypt response body data which is sent from server to client
5.0.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago