ExOss.CDN.Qiniu (ExOss v0.1.0)

Copy Markdown View Source

Qiniu CDN adapter.

Implements ExOss.CDN.Behaviour to generate signed URLs for Qiniu's CDN service. This module is entirely self-contained — it does not depend on the qiniu hex package.

Download URL Signing

Qiniu CDN download URLs are signed with HMAC-SHA1 over the full URL (including a e deadline parameter), producing a token query parameter of the form {access_key}:{signature}.

Upload Credentials

Upload credentials use a Qiniu PutPolicy encoded as URL-safe Base64 JSON, signed with HMAC-SHA1 to produce an uptoken of the form {access_key}:{signature}:{encoded_policy}.

Configuration

config :my_app, MyApp.Storage,
  cdn: [
    provider: :qiniu,
    endpoint: "https://cdn.example.com"
  ]

Credentials (access_key_id / secret_access_key) are taken from the client's storage credentials, not from a separate CDN key configuration.