Skip to content

Instantly share code, notes, and snippets.

View bitkidd's full-sized avatar
🎯
Focusing

Chirill Ceban bitkidd

🎯
Focusing
View GitHub Profile
@bitkidd
bitkidd / generateToken.ts
Last active February 7, 2022 14:21
KeyCDN Secure Token
const domain = 'domain'
const secret = 'supersecret'
const expire = Math.round(Date.now() / 1000) + 120
const links: { original?: string } = {}
const path = `/${this.filetype}/${this.uid}.${this.fileext}`
const generateToken = ({ path, query = '' }: { path: string; query?: string }): string => {
// generate md5 token
const md5String = crypto