@15ms/secure

The secure utility for 15ms server and client.

Usage no npm install needed!

<script type="module">
  import 15msSecure from 'https://cdn.skypack.dev/@15ms/secure';
</script>

README

15ms-secure

Build Status Coverage Status

The secure utility for 15ms server and client.

Usage

npm install --save @15ms/secure
const Secure = require('@15ms/secure');
const secure = new Secure({
  secret: 'your-15ms-server-secret',
  maxage: 30 * 1000
});

// create hash at client
const data = { 'your': 'data' };
const hash = secure.createHMAC(data);

// verify hash at server
const { data, hash } = request;
if (secure.verifyHMAC(data, hash)) {
  // do something
}