Skip to main content

Other Languages

Zero Ad Network's token protocol is open and language-agnostic. If you're building in Go, Ruby, Python, Rust, Java, or any other language, you can implement integration yourself using standard crypto primitives - no proprietary SDK required.

What your implementation needs to do

1. Generate your Welcome Header (once at startup)

Your site's partner header (X-Better-Web-Welcome) encodes your clientId and feature bitmask. The token value is static - compute it once at startup from the clientId and feature list you received when registering your site.

The format and encoding are documented in the zeroad-token-typescript reference implementation. The PHP and TypeScript implementations are both open source and serve as the authoritative reference.

2. Inject the header on every response

Set X-Better-Web-Welcome: <your_token_value> on every HTTP response from your server. This tells the browser extension that your site is a partner.

3. Parse and verify the subscriber token on each request

When a subscriber visits, the browser extension injects an X-Better-Web-Hello request header. Your server must:

  1. Read the X-Better-Web-Hello request header value
  2. Decode and verify its ED25519 signature against Zero Ad Network's public key
  3. Extract the feature bitmask and expiration timestamp from the payload
  4. Map the bitmask to a set of boolean feature flags
  5. Pass those flags to your route handlers and templates

If the header is absent, the signature is invalid, or the token is expired - treat all feature flags as false. The site renders normally for non-subscribers.

ED25519 public key

The current public key for verifying subscriber tokens is embedded in both reference implementations. Retrieve it from the TypeScript source or PHP source.

Feature flags produced after verification

HIDE_ADVERTISEMENTS
HIDE_COOKIE_CONSENT_SCREEN
HIDE_MARKETING_DIALOGS
DISABLE_NON_FUNCTIONAL_TRACKING
DISABLE_CONTENT_PAYWALL
ENABLE_SUBSCRIPTION_ACCESS

See the tokenContext reference for what each flag means and when to apply it.

Reference implementations

LanguageRepository
TypeScript / JavaScriptgithub.com/laurynas-karvelis/zeroad-token-typescript
PHPgithub.com/laurynas-karvelis/zeroad-token-php

Both repositories include test suites with known token fixtures - use them to verify your implementation produces correct results.

Contribute a module

If you implement Zero Ad Network for a new language and would like to make it the official library, we'd love to collaborate. Reach out at [email protected].