Secure Unique Download Link Generation: Protect Digital Goods

Imagine a buyer pays for a digital product, but the download link is accessible to anyone who guesses the order ID. Or a one-time link ends up in a public chat, and the file is downloaded by hundreds of strangers. According to statistics, over 70% of digital goods leaks are linked to predictable or

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1283
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1238
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    981
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1029
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1104
  • image_website-_0.webp
    Website development for Red Pear
    552

Imagine a buyer pays for a digital product, but the download link is accessible to anyone who guesses the order ID. Or a one-time link ends up in a public chat, and the file is downloaded by hundreds of strangers. According to statistics, over 70% of digital goods leaks are linked to predictable or unprotected URLs. Such incidents stem from using direct file links or tokens generated without cryptographic strength. We solve this completely: we design and implement cryptographically strong unique link generation with brute-force protection, rotation, and monitoring. Our team has 10+ years of experience in secure solutions for digital goods and has delivered over 50 content protection projects.

Why Unique Links Are Critical for Digital Goods

A unique link is the primary access control mechanism. Unlike a direct file link, the token prevents guessing another purchase's URL and ties the download to a specific transaction. A cryptographically secure pseudorandom number generator (CSPRNG) ensures unpredictability: an attacker cannot derive the token from sequential numbers or timestamps. The definition of CSPRNG can be found on Wikipedia.

Minimum token requirements:

  • entropy of at least 128 bits (32 bytes → 64 hex characters)
  • uniqueness in the database (UNIQUE constraint + collision handling)
  • URL part length no more than 64–80 characters

How We Generate Cryptographically Strong Tokens

We use a generator based on random_bytes() — in PHP it reads from /dev/urandom or CryptGenRandom. The result is converted to hex (64 characters). For short, readable links (SMS, QR), we apply Base62 with 16 characters (~95 bits entropy). Both approaches provide sufficient entropy for commercial use.

class DownloadTokenGenerator { public function generate(): string { return bin2hex(random_bytes(32)); } } 
class ShortTokenGenerator { private const ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; public function generate(int $length = 16): string { $token = ''; $bytes = random_bytes($length); for ($i = 0; $i < $length; $i++) { $token .= self::ALPHABET[ord($bytes[$i]) % 62]; } return $token; } } 

Approach comparison:

Parameter Hex (64 chars) Base62 (16 chars)
Entropy 256 bits 95 bits
URL length 64 chars 16 chars
Readability Low (hex only) High (digits+letters)
Use case Default SMS, QR codes

How to Protect Against Token Brute-Forcing

Even a 256-bit token is vulnerable if an attacker can make millions of requests. We configure rate limiting with separate limits for viewing (30/min) and downloading (10/min). If 10 invalid tokens from one IP within an hour — automatic blocking. This is 1000× more effective than a single captcha on the download page. Additionally, we monitor anomalous activity: if one token is downloaded from multiple IPs, the system alerts a possible leak.

// Laravel route with throttle middleware Route::get('/dl/{token}', [DigitalDownloadController::class, 'show']) ->middleware(['throttle:30,1']); Route::get('/dl/{token}/get', [DigitalDownloadController::class, 'download']) ->middleware(['throttle:10,1']); 

How to Implement Rotation of Compromised Links

If a buyer reports a leaked link, we instantly invalidate the old token, generate a new one with the same limit and expiration, and send the buyer a notification. All rotations are logged — you always know who and when requested a replacement.

Parameter Old Token New Token
Status Revoked Active
Counter Frozen Reset
Limit As before As before

When to Use Signed URLs Instead of Storing Tokens

HMAC-signed URLs do not require storing a token in the database: the link itself contains the signature and time-to-live. This is ideal for mass distribution of corporate licenses where thousands of users receive the same link. However, revoking an individual link without changing the signing key is impossible. We help choose the optimal approach for your scenario.

Example of signed URL generation in Laravel:

use Illuminate\Support\Facades\URL; $signedUrl = URL::temporarySignedRoute( 'download', now()->addHours(24), ['file' => $fileId] ); 

Step-by-Step Implementation of Link Generation

  1. Security scheme design: choose CSPRNG or HMAC, define entropy, set up rate limiting.
  2. Token generation: implement hex/Base62 classes with database uniqueness checks.
  3. Integration with routing: throttle and signed middleware, controllers for verification and download.
  4. Rotation mechanism: token invalidation, new generation, user notification.
  5. Anomaly monitoring: log downloads, alert on suspicious activity.

What's Included in the Implementation

  • Security scheme design (CSPRNG, HMAC, rate limiting)
  • Token generation (hex/Base62) with uniqueness verification
  • Routing with middleware (throttle, signed)
  • Rotation mechanism with logging and notifications
  • Anomaly monitoring (download from multiple IPs)
  • Operation and maintenance documentation

Implementation Timeline and Cost

Basic generation with brute-force protection — 1–2 working days. Extended functionality (rotation, monitoring, signed URLs) — another 2 days. The implementation cost depends on integration complexity with your system. We will select the optimal solution within your budget. Preventing leaks pays for development costs after just 1000 downloads.

Get a consultation: describe your scenarios — we'll choose the optimal solution. Contact us to implement unique link generation turnkey, with guaranteed security and performance.