@seedalpha/signature

functions for generating, verifying keyed hash to protect seedalpha's services which are exposed to public traffic

Usage no npm install needed!

<script type="module">
  import seedalphaSignature from 'https://cdn.skypack.dev/@seedalpha/signature';
</script>

README

seed-signature Ψ

Functions for generating, verifying keyed hash to protect SeedAlpha's services which are exposed to public traffic.

Changelog

1.0.1

  • bugfix on missing context binding

1.0.0

  • project init

Usage

  var Signature = require('seed-signature');
  var signature = new Signature({
    secret:     'yoursecret',   // required
    expiryTime: 10 * 60 * 1000  // optional, default 5 minutes
  });
  var rs = signature.generate();
  /**
   * {
   *   timestamp: 1453792759859,
   *   token:     '0099aazz',
   *   signature: '8f16771f9f8851b26f4d460fa17de93e2711c7e51337cb8a608a0f81e1c1b6ae'
   * }
   */
  var verified = signature.verify(rs.timestamp, rs.token, rs.signature);

Author

Marvin Lam lam@seedalpha.net

License

Copyright © 2016 SeedAlpha, All rights reserved.