owncloud-sign-url

1.0.3 • Public • Published

owncloud-sign-url

Build Status npm version Coverage Status

owncloud-sign-url is a little node.js library for signing urls and validating them based on secret key.

NOTE You need a Node 10.17.0 and higher.

Init

npm install owncloud-sign-url

or

yarn add owncloud-sign-url

Create signature object based on secret.

Secret string should not be known for anyone else, except your servers

const SignUrl = require('owncloud-sign-url');
 
const signUrl = new SignUrl({
  secretKey: 'your secret key string',
  ttl: 60, // optional (in seconds)
  algorithm: 'sha256' // optional
});

Generate signed url

const url = 'http://example.com/resource';
const httpMethod = 'get';
 
const signedUrl = signUrl.generateSignedUrl(url, httpMethod);

Verify url on resource side

const errorCode = this.verifySignedUrl(req);
 

License

MIT

Package Sidebar

Install

npm i owncloud-sign-url

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

12.9 kB

Total Files

10

Last publish

Collaborators

  • deepdiver