Registering your wallets (Enterprise)
The operators and the SSP see a wallet's identity public key but do not know whose wallet it is. Your backend tells IBIRAPAY which identity keys belong to your account, with a registration key (section 5.1) that never leaves your server. To stop anyone from claiming a wallet they do not control, the wallet signs its own registration: the app signs a short text with the wallet's identity key and your backend forwards the signature.
1. In the app (or in your backend, for the central wallet), after connecting: get the identity public key, build the exact text below, and sign it with the SDK. The SDK hashes the text with SHA-256 and signs it with the wallet's identity key.
ibirapay-spark-registro:v1:<account ID>:<identity public key>:<unix seconds>
<account ID> is shown on your account page; <identity public key> is the 66-character hex key in lowercase;
<unix seconds> is the current UTC time. No spaces, no line break at the end.
Future<({String identity, String signature, int timestamp})> signRegistration(breez.BreezSdk sdk, String accountId) async {
final info = await sdk.getInfo(request: breez.GetInfoRequest(ensureSynced: false));
final identity = info.identityPubkey.toLowerCase(); // 66 hex characters
final ts = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000; // unix seconds
final signed = await sdk.signMessage(
request: breez.SignMessageRequest(
message: 'ibirapay-spark-registro:v1:$accountId:$identity:$ts',
compact: true, // 64-byte hex; DER is accepted too
),
);
return (identity: identity, signature: signed.signature, timestamp: ts);
}
2. The app sends identity, signature and timestamp to your backend, which authenticates the user in its own way.
The account ID is not a secret and may be in the app; the registration key and secret must not be.
3. Your backend calls the registration API with HTTP Basic (registration key as the user name, its secret as the password):
# a quick test from a trusted shell; production code uses its HTTP client's Basic auth setting
curl -sS -u "$REGISTRO_KEY:$REGISTRO_SECRET" -H 'Content-Type: application/json' \
-d '{"identity_pubkey":"<66 hex>","signature":"<hex>","timestamp":1790000000}' \
https://ibirapay.com/spark/api/carteiras
| Answer | Meaning |
|---|---|
201 {"ok":true,"estado":"criada"} or "reativada" |
Registered (or registered again after a removal) |
200 {"ok":true,"estado":"existente"} |
Already registered to your account; nothing changed |
400 {"erro":"..."} |
Not a valid identity key, a signature that is missing, wrong or older or newer than 10 minutes, or the limit of 100,000 registered wallets; the text says which (in Portuguese) |
401 |
Wrong key or secret, a revoked key, a suspended account, or a proxy key used here |
409 |
The wallet is registered to another account. The first account to register an identity keeps it for good |
429 |
Too many calls; wait and try again |
To take a wallet off your account: DELETE https://ibirapay.com/spark/api/carteiras/<identity public key> with the same Basic
authentication. 204 means removed (repeating it is fine), 404 means it is not on your account. A removed wallet registers again
with a new signature.
Rules:
- The timestamp must be within 10 minutes of the server's clock, so sign when you register, not earlier, and keep your servers'
clocks on NTP. A retry after the 10 minutes needs a new signature (a wallet already registered answers
200without one). - The signed text is checked as written above: lowercase identity key, your account ID, no extra characters.
- Register a wallet once, right after it is created or restored. A new registration reaches the SSP in about 30 seconds.
- Register your central wallet the same way (your backend signs with its own SDK instance): it pays your users' invoices, so it needs the priority too.
- Limits: 300 calls per minute per IP address, 120 per minute per key, 600 per minute for the whole service, 100,000 registered (not removed) wallets and 5 active keys per account. The proxy accepts up to 128 simultaneous connections per proxy key.