API di Verylot
L'API di Verylot dà ai membri qualsiasi cifra passata con la sua prova. Ogni endpoint richiede una richiesta firmata con la tua chiave API.
Nozioni di base
- URL di base:
https://api.verylot.online— ogni percorso inizia con/v1. - Orario: tutto è in UTC. Gli orari sono in formato ISO 8601 (
2026-10-07T06:00:00Z). - Slot: il tempo è suddiviso in slot di 10 secondi,
slot = unix_seconds / 10. Una cifra per slot; lo slot 179135280 corrisponde al 2026-10-07 06:00:00 UTC. - Cache: gli intervalli conclusi non cambiano mai. Per questi
/v1/stream/blockinviaCache-Control: public, max-age=600. - Costo: gratuito. Si applicano limiti di uso corretto (vedi Limiti).
Endpoint
Ogni endpoint con i suoi parametri, una richiesta in diversi linguaggi e una risposta di esempio. Sono tutti per i membri e richiedono richieste firmate (vedi Richieste firmate più sotto).
Come verificare una prova passo dopo passo: Come funziona.
Richieste firmate
Gli endpoint per i membri usano una coppia di chiavi API (Ed25519), non un segreto condiviso:
- Nel pannello membri crei una chiave. La coppia di chiavi viene generata nel tuo browser; Verylot conserva solo la chiave pubblica. La chiave privata la tieni tu (mostrata una sola volta, oppure scaricata come file
.pem). Puoi anche incollare una chiave pubblica che hai generato tu stesso. →/panel/api-keys· passo dopo passo nella guida - Ogni richiesta porta quattro header:
| Header | Valore |
|---|---|
X-Verylot-Key |
l'id della chiave, ad es. vk_7Qm2xR9a |
X-Verylot-Timestamp |
l'orario UTC attuale; accettato entro ±5 minuti |
X-Verylot-Nonce |
16 byte casuali, base64url; uno nuovo per ogni richiesta |
X-Verylot-Signature |
base64 della firma Ed25519 del testo qui sotto |
Il testo firmato è composto da queste cinque righe unite con \n:
GET
/v1/stream?at=2026-10-07T06:00:00Z&digits=6
2026-10-07T10:15:00Z
q8Jm1Xb3oV0p9nW2rT5yZA
<hex SHA-256 of the request body; of an empty string for GET>
REQ='/v1/stream?at=2026-10-07T06:00:00Z&digits=6'
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
NONCE=$(openssl rand -base64 16 | tr '+/' '-_' | tr -d '=')
HASH=$(printf '' | sha256sum | cut -d' ' -f1)
printf 'GET\n%s\n%s\n%s\n%s' "$REQ" "$TS" "$NONCE" "$HASH" > signed.txt
SIG=$(openssl pkeyutl -sign -inkey verylot.pem -rawin -in signed.txt | base64 -w0)
curl "https://api.verylot.online$REQ" \
-H "X-Verylot-Key: vk_7Qm2xR9a" -H "X-Verylot-Timestamp: $TS" \
-H "X-Verylot-Nonce: $NONCE" -H "X-Verylot-Signature: $SIG"
import { createHash, createPrivateKey, randomBytes, sign } from 'node:crypto'
import { readFileSync } from 'node:fs'
const key = createPrivateKey(readFileSync('verylot.pem'))
const path = '/v1/stream?at=2026-10-07T06:00:00Z&digits=6'
const ts = new Date().toISOString().replace(/\.\d+Z$/, 'Z')
const nonce = randomBytes(16).toString('base64url')
const text = ['GET', path, ts, nonce, createHash('sha256').update('').digest('hex')].join('\n')
const signature = sign(null, Buffer.from(text), key).toString('base64')
const res = await fetch('https://api.verylot.online' + path, {
headers: {
'X-Verylot-Key': 'vk_7Qm2xR9a', 'X-Verylot-Timestamp': ts,
'X-Verylot-Nonce': nonce, 'X-Verylot-Signature': signature,
},
})
const result = await res.json()
import base64, datetime, hashlib, os
import requests
from cryptography.hazmat.primitives.serialization import load_pem_private_key # pip install cryptography
key = load_pem_private_key(open('verylot.pem', 'rb').read(), None)
path = '/v1/stream?at=2026-10-07T06:00:00Z&digits=6'
ts = datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
nonce = base64.urlsafe_b64encode(os.urandom(16)).rstrip(b'=').decode()
text = '\n'.join(['GET', path, ts, nonce, hashlib.sha256(b'').hexdigest()])
signature = base64.b64encode(key.sign(text.encode())).decode()
result = requests.get('https://api.verylot.online' + path, headers={
'X-Verylot-Key': 'vk_7Qm2xR9a', 'X-Verylot-Timestamp': ts,
'X-Verylot-Nonce': nonce, 'X-Verylot-Signature': signature}).json()
// dotnet add package NSec.Cryptography (Ed25519)
using System.Security.Cryptography;
using System.Text;
using NSec.Cryptography;
var key = Key.Import(SignatureAlgorithm.Ed25519, File.ReadAllBytes("verylot.pem"), KeyBlobFormat.PkixPrivateKeyText);
var path = "/v1/stream?at=2026-10-07T06:00:00Z&digits=6";
var ts = DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'");
var nonce = Convert.ToBase64String(RandomNumberGenerator.GetBytes(16)).TrimEnd('=').Replace('+', '-').Replace('/', '_');
var hash = Convert.ToHexStringLower(SHA256.HashData([]));
var text = string.Join('\n', "GET", path, ts, nonce, hash);
var signature = Convert.ToBase64String(SignatureAlgorithm.Ed25519.Sign(key, Encoding.UTF8.GetBytes(text)));
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.verylot.online" + path);
request.Headers.Add("X-Verylot-Key", "vk_7Qm2xR9a");
request.Headers.Add("X-Verylot-Timestamp", ts);
request.Headers.Add("X-Verylot-Nonce", nonce);
request.Headers.Add("X-Verylot-Signature", signature);
var response = await http.SendAsync(request);
// Ed25519 with PHP's built-in sodium; the PEM (PKCS#8) ends with the 32-byte seed.
$der = base64_decode(preg_replace('/-----[^-]+-----|\s/', '', file_get_contents('verylot.pem')));
$secret = sodium_crypto_sign_secretkey(sodium_crypto_sign_seed_keypair(substr($der, -32)));
$path = '/v1/stream?at=2026-10-07T06:00:00Z&digits=6';
$ts = gmdate('Y-m-d\TH:i:s\Z');
$nonce = rtrim(strtr(base64_encode(random_bytes(16)), '+/', '-_'), '=');
$text = implode("\n", ['GET', $path, $ts, $nonce, hash('sha256', '')]);
$signature = base64_encode(sodium_crypto_sign_detached($text, $secret));
$ch = curl_init('https://api.verylot.online' . $path);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Verylot-Key: vk_7Qm2xR9a', "X-Verylot-Timestamp: $ts",
"X-Verylot-Nonce: $nonce", "X-Verylot-Signature: $signature",
],
]);
$result = json_decode(curl_exec($ch), true);
Un database trafugato non può firmare richieste al posto tuo, e una richiesta intercettata non può essere riprodotta.
Errori
Gli errori usano i problem details dell'RFC 7807. code è stabile; title è tradotto nella lingua di Accept-Language.
{ "status": 401, "code": "error.auth.signature-invalid", "title": "The request signature is missing or invalid." }
| Stato | Quando |
|---|---|
| 400 | input non valido |
| 401 | firma mancante o non valida — error.auth.signature-required, error.auth.signature-invalid, error.auth.timestamp-invalid, error.auth.nonce-reused, error.api-key.invalid |
| 403 | membro non attivo — error.tenant.inactive |
| 404 | non trovato |
| 429 | limite raggiunto; vedi Retry-After |
Limiti
Ogni chiave ha un limite di richieste:
| Limite | Predefinito |
|---|---|
| Richieste API al minuto (per chiave) | 10 |
Se ti serve di più, scrivici dalla pagina dei contatti.
Al limite di una chiave contano solo le richieste firmate correttamente. I tentativi falliti (chiave sconosciuta, firma errata, timestamp vecchio, nonce riutilizzato) si contano per IP: 30 in un minuto bloccano quell'IP per 15 minuti (429 con Retry-After).
Strumenti
- Verificatore:
@verylot/verifierricalcola e controlla qualsiasi intervallo di cifre, nel browser o dalla riga di comando:
verylot-verify --file verylot-proof.json
verylot-verify --api https://api.verylot.online --key vk_7Qm2xR9a --pem verylot.pem --at 2026-10-05T12:00:00Z --digits 6
- OpenAPI: la descrizione leggibile dalle macchine di questa API:
https://api.verylot.online/openapi/v1.json.