Skip to content

Latest commit

 

History

History
84 lines (62 loc) · 3.35 KB

File metadata and controls

84 lines (62 loc) · 3.35 KB

Uploadcare Signed Uploads Client

This is Uploadcare Signed Uploads wrapper to work with Node.js.

API Reference

Build Status NPM version GitHub release Uploadcare stack on StackShare

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 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.

Feedback

Issues and PRs are welcome. You can provide your feedback or drop us a support request at hello@uploadcare.com.