owncloud-sign-url
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 = ; const 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;
Verify url on resource side
const errorCode = this;
License
MIT