This API implements a checkpoint-based key system, where users must complete a sequence of steps (e.g., Linkvertise pages) before receiving a valid key.
Instead of generating keys instantly, the system enforces a flow:
- User requests access
- Receives a monetized link
- Completes the checkpoint
- Repeats if necessary
- Receives a key after finishing all checkpoints
Configure the following environment variables:
DB_URL=your_database_url
DB_PASSWORD=your_database_password
The system is based on checkpoints:
- Each user/session has a
Checkpoint - Each checkpoint tracks progress (
currentCheckpoint) - The total required checkpoints is configurable
Once all checkpoints are completed, a Key is generated and returned.
Main configurable values:
Number of checkpoints:
public int checkpoints = 1;
Key duration (default: 24 hours):
public long duration = 24 * 60 * 60 * 1000;
Checkpoint expiration:
public long checkpointDuration = 60 * 60 * 1000;
Linkvertise ID:
public long linkvertise_id = 0;
Anti-bypass token:
public String antiBypassToken = "...";
- A
Checkpointis created - Progress starts at
0
Main flow controller:
handleCheckpoint(UUID id, String hash, boolean completed)
Condition:
currentCheckpoint >= checkpoints
- Generate a new key (
UUID) - Save the key with expiration
- Delete checkpoint
- Return the key
Condition:
completed == true
- Validate anti-bypass hash
- Increment checkpoint progress
- Redirect to next step
- Generate Linkvertise URL
- Return link to user
Steps:
-
Build return URL:
/v1/checkpoints/get-key?id=UUID&completed=true -
Encode in Base64
-
Inject into Linkvertise template:
https://linkvertise.com/access/{id}/{random}/dynamic?...&r={encoded_url}
To prevent users from skipping checkpoints:
- Every "completed" request must include a valid
hash - Hash is validated using
AntibypassToken
If invalid:
400 Bad Request - "invalid hash"
- Expire after a defined duration
- Prevents infinite reuse or farming
- Have a fixed lifetime (e.g., 24 hours)
- Automatically become invalid after expiration
CheckpointFlowService→ Main logic controllerCheckpointService→ Handles checkpoint persistenceKeyService→ Handles key storageAntibypassToken→ Security validation
User → Request
↓
Receives Link
↓
Completes Checkpoint
↓
Validated + Progress++
↓
Repeat until done
↓
Receives Key
- Checkpoint-based access control
- Linkvertise integration
- Anti-bypass protection
- Expiring keys
- Expiring checkpoints
- UUID-based key generation
- Increase
checkpointsto make the flow longer - Keep
antiBypassTokensecret - Use strong validation to avoid bypass exploits