@uploadcare/signed-uploads
v6.14.2
Published
Library for work with Uploadcare Signed Uploads
Downloads
5,797
Readme
Uploadcare Signed Uploads Client
This is Uploadcare Signed Uploads wrapper to work with Node.js.
Install
npm install @uploadcare/signed-uploads
Usage
NOTE: The Uploadcare API accepts expire
as unix time in seconds. However, this library accepts time in milliseconds, as per the Node.js standard.
import { generateSecureSignature } from '@uploadcare/signed-uploads'
// by the expiration timestamp in milliseconds since the epoch
const { secureSignature, secureExpire } = generateSecureSignature('YOUR_SECRET_KEY', {
expire: Date.now() + 60 * 30 * 1000 // expire in 30 minutes
})
// by the expiration date
const { secureSignature, secureExpire } = generateSecureSignature('YOUR_SECRET_KEY', {
expire: new Date("2099-01-01") // expire on 2099-01-01
})
// by the lifetime in milliseconds
const { secureSignature, secureExpire } = generateSecureSignature('YOUR_SECRET_KEY', {
lifetime: 60 * 30 * 1000 // expire in 30 minutes
})
A pair of secureSignature
and secureExpire
(string with a unixtime in seconds) can be passed directly to the corresponding options of @uploadcare/upload-client
.
Security issues
If you think you ran into something in Uploadcare libraries that might have security implications, please hit us up at [email protected] or Hackerone.
We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.
Feedback
Issues and PRs are welcome. You can provide your feedback or drop us a support request at [email protected].