This is Uploadcare Signed Uploads wrapper to work with Node.js.
npm install @uploadcare/signed-uploads
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
.
If you think you ran into something in Uploadcare libraries that might have security implications, please hit us up at bugbounty@uploadcare.com or Hackerone.
We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.
Issues and PRs are welcome. You can provide your feedback or drop us a support request at hello@uploadcare.com.