Identity verification
Make your server sign each user ID, so a modified app can't claim someone else's pushes.
Without identity verification, any copy of your app can call setUserID with any ID, and a modified app could link itself to another user and receive their pushes. With it on, Pushwren accepts a user ID only with a signature from your server.
Turn it on
In the portal, open Settings › Identity verification and turn it on. Pushwren shows the app’s identity secret. Keep it on your server, like a secret key; it’s off until you turn it on.
Sign the user ID on your server
The signature is HMAC-SHA256 of the user ID with the identity secret, as 64 lowercase hex characters. In Node.js:
import { createHmac } from 'node:crypto';
const signature = createHmac('sha256', process.env.PUSHWREN_IDENTITY_SECRET).update(userId).digest('hex');
In Python:
import hashlib, hmac, os
signature = hmac.new(os.environ["PUSHWREN_IDENTITY_SECRET"].encode(), user_id.encode(), hashlib.sha256).hexdigest()
Send it to the app with the user’s session, for example in your sign-in response.
Pass it from the app
Pushwren.setUserID("u_123", signature: signatureFromYourServer)
A missing or wrong signature is refused with invalid_user_signature: the device keeps its record without the user, and diagnostics() shows the error. Clearing the user, and your server’s own calls with a secret key, need no signature.
Rotating the secret
Rotate it in the same settings page. The previous secret keeps working for 24 hours, so apps signed in before the rotation aren’t cut off.