redfly-client
redfly-client is the client for Redfly, in two parts: a Kotlin library that apps and services use to sign people in, verify tokens and submit telemetry, and a WordPress plugin that signs WordPress users in with Redfly.
What redfly-client is
The Kotlin client library for Redfly plus redfly-auth, a WordPress plugin for PHP 8.2+ and WordPress 6.5+.
How it benefits you
Apps and WordPress sites get phone sign-in, offline token verification and pseudonymous telemetry without writing any of it themselves.
How it works
The library calls Redfly over HTTP/2 with the JDK client and verifies PASETO tokens against cached public keys; the plugin does the same in PHP with sodium.
Sign-in in a few calls
Request a code, verify it, add TOTP if Redfly asks for it, then refresh or log out.
requestCode,verifyCode(signed in, or needs TOTP),verifyTotp,refreshandlogout.
Offline token verification
verify(token) checks the signature, expiry and key id, and returns the user, session, tenants, app, expiry and token id.
- Public keys are cached from
/v1/auth/keysand refetched on an unknown key id.
Telemetry made safe
Submit telemetry in batches of up to 500 events, with helpers that compute the pseudonymous user hash and enforce attribute limits.
TelemetryEvent.userHash(redflyUserId, tenantSalt)computes HMAC-SHA256.- Construction enforces at most 32 attribute keys of 256 characters each.
Lean dependencies
The library uses the JDK java.net.http.HttpClient over HTTP/2. Its only other dependency is a PASETO v4 verifier with Ed25519 support.
The redfly-auth WordPress plugin
Replaces the WordPress login form with phone and code (and TOTP if Redfly asks), and maps each Redfly user to a WordPress user by redfly_user_id user meta.
- Verifies PASETO tokens locally on every request with PHP’s built-in sodium extension.
- Submits pseudonymous telemetry, with an on/off switch on its admin page.
- Checks a private update endpoint for new versions.
Get redfly-client
Source code, compiled builds are on the Downloads page.