Overview
The provider list in the config file holds only Provider IDs and SHA-256 hashes of domains. Before applying premium parameters, the app asks the premium server whether premium is active and whether this device fits the paid limit. The domain is never sent in clear text.
Request
GET https://nyaclient.com/api/p?h=<domain sha256>&d=<device number>| Parameter | Type | Required | Description |
|---|---|---|---|
h | string | yes | SHA-256 of the lowercase subscription domain, 64 hex chars |
d | string | no | Anonymous device number, 32 hex chars: first 32 chars of SHA-256 of nya-stats: + HWID. The HWID cannot be recovered from it |
Response
If the domain is not registered:
{"premium": false}If it is registered, the response is encrypted with a key derived from the domain. Only someone who knows the domain can read it:
{
"v": 1,
"n": "<base64, 16 bytes>",
"d": "<base64, encrypted data>",
"t": "<base64, 16 bytes, authentication tag>"
}| Decrypted field | Type | Description |
|---|---|---|
id | string | Provider ID |
premium | boolean | Premium applies to this device |
deviceLimitExceeded | boolean | The device limit is used up and this device is new |
until | number | Premium end, Unix time |
at | number | Response time |
Encryption
- Key: HMAC-SHA256 keyed with
nya-provider-api/1over the subscription domain. - Stream: 32-byte HMAC-SHA256(key, nonce ‖ block number) blocks XORed with the data.
- Integrity: first 16 bytes of HMAC-SHA256(key,
tag‖ nonce ‖ data). A response with a wrong tag is discarded.
Device limits
- The device is already counted. It keeps premium even when the limit is used up.
- New device, limit not reached. The device is counted and gets premium.
- New device, limit reached. The response is
premium: false,deviceLimitExceeded: true. Premium features are off, the VPN works as usual.
A device is active if it checked in during the last 30 days.
Caching
- The app checks premium on launch, when a subscription is added and together with the config file, about once an hour.
- The answer is stored on the device for three days. If the server is unreachable, the last answer applies.
- No more than 60 requests per IP per 10 minutes, otherwise
429.