JSPM

@transloadit/utils

4.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4211
  • Score
    100M100P100Q98165F
  • License MIT

Transloadit shared utilities

Package Exports

  • @transloadit/utils
  • @transloadit/utils/node
  • @transloadit/utils/package.json

Readme

@transloadit/utils

Shared runtime helpers used across Transloadit JavaScript SDKs.

Install

npm install @transloadit/utils

Web / Edge usage

import { signParams, verifyWebhookSignature } from '@transloadit/utils'

const signature = await signParams(paramsString, authSecret)
const verified = await verifyWebhookSignature({
  rawBody,
  signatureHeader,
  authSecret,
})

Node usage

import { signParamsSync, getSignedSmartCdnUrl } from '@transloadit/utils/node'

const signature = signParamsSync(paramsString, authSecret)
const url = getSignedSmartCdnUrl({
  workspace,
  template,
  input,
  authKey,
  authSecret,
})

API

  • signParams(paramsString, authSecret, algorithm?): WebCrypto-based HMAC signature for params.
  • verifyWebhookSignature({ rawBody, signatureHeader, authSecret }): validates webhook signatures.
  • signParamsSync(paramsString, authSecret, algorithm?): Node-only sync signature helper.
  • getSignedSmartCdnUrl(options): Node-only Smart CDN URL signer.