Skip to content

Instantly share code, notes, and snippets.

@sudhirj
Created June 21, 2023 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudhirj/5248ecb05eed47dc8a632b979922240f to your computer and use it in GitHub Desktop.
Save sudhirj/5248ecb05eed47dc8a632b979922240f to your computer and use it in GitHub Desktop.
Bunny Token Signer
const getSignedBunnyUrl = function(opts) {
const expiryStamp = Math.floor(opts.expiry.getTime() / 1000)
const token = createHash('sha256').update(opts.token).update(opts.url).update(expiryStamp.toString()).digest('base64url')
return `${opts.url}?token=${token}&expires=${expiryStamp.toString()}`
}
@ceelsoin
Copy link

ceelsoin commented Jul 9, 2023

what is inside of opts.token?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment