baridimob library

Unofficial Dart and Flutter SDK for BaridiMob (Algérie Poste).

Start with BaridiMob:

import 'package:baridimob/baridimob.dart';

final bm = BaridiMob(storage: FileStorage('session.json'));
await bm.auth.login(login: 'login', password: 'password');
final balance = await bm.accounts.balance();

Classes

Account
A bank account.
AccountsModule
Accounts, balance and transaction history.
AuthModule
Login, device confirmation and logout.
BaridiMob
Client for the BaridiMob API.
BaridiMobCard
A payment card.
CardlessCode
A cardless withdrawal code: what to type at an Algérie Poste ATM to take the cash without a card. Treat code like cash.
CardlessForm
The form of a new cardless withdrawal code, as BaridiMob sends it.
CardlessInput
A field of the form of a new cardless withdrawal code.
CardlessModule
Cash withdrawals without a card. A code is created for an amount and an expiry; at an Algérie Poste ATM, the code takes the cash out.
CardlessSource
Where a cardless withdrawal takes the money from.
CardLimit
One spending or operation limit on a card.
CardsModule
Cards, their history and limits.
DeviceKeys
A device identity: the RSA key pair that signs every request.
DynamicAmount
An amount as BaridiMob writes it in a dynamic form.
DynamicAmountChoice
One amount offered by a money field in DynamicAmountMode.select.
DynamicCheckResult
The result of dynamic.check(): a prepared operation waiting for its confirmation code.
DynamicChoice
One choice of a dynamic select field.
DynamicCompleteResult
The result of dynamic.complete().
DynamicDetail
A piece of information BaridiMob returns about an operation, for a bill the subscriber, the bill number or the amount due.
DynamicExecResult
The result of dynamic.exec().
DynamicGroup
A group of dynamic operations.
DynamicOperationInfo
Metadata of a dynamic operation.
DynamicOperationRef
Reference to a dynamic operation or step.
DynamicPaymentsModule
Dynamic payment forms.
DynamicSource
Where a dynamic payment takes the money from.
DynamicStep
A step of a dynamic form.
DynamicStepInput
A field of a dynamic form step.
FileStorage
Saves the session to a JSON file, compatible with the TypeScript and Python SDKs.
HistoryPage
A page of the transaction history.
LoginResult
Result of auth.login() and auth.confirmDevice().
MemoryStorage
Keeps the session in memory only. It is lost when the process stops, so the device must be confirmed again at every start.
PaymentCategory
A payment category, for example mobile networks.
PaymentCheckResult
A payment prepared by payments.check(), waiting for its SMS code.
PaymentExecResult
Result of an executed payment.
PaymentProvider
A biller, for example Mobilis.
PaymentsModule
Payment verification and bill payments.
PaymentSource
The card or account a payment is taken from.
Profile
Holder information.
ProfileModule
Holder information.
ProviderParam
A field a provider needs, for example the phone number to top up.
ReceiptsModule
Recent operations and PDF receipts.
RecentOperation
A recent operation, with the uid needed to download its receipt.
SessionStorage
Where a session is saved between runs.
StoredSession
Everything needed to resume a session: device keys and cookies.
Transaction
An entry of the transaction history.
TransferArmResult
A transfer prepared by transfers.arm(), waiting for its SMS code.
TransferExecResult
Result of an executed transfer.
TransferPending
A transfer whose SMS code has been sent. Call confirm with the code.
TransfersModule
Transfers to other accounts.
VerifyPaymentResult
Result of payments.verifyPayment().

Enums

BaridiMobLocale
Language of server messages and labels.
DynamicAmountMode
How a money field is filled.
LoginState
Outcome of a login attempt.
PaymentSourceType
Kind of payment source.
VerifyPaymentReason
Why VerifyPaymentResult.verified is true or false.

Constants

defaultCardlessDatePattern → const String
Date pattern of the cardless expiry field.
devkeyAlgorithm → const String
Algorithm name sent to BaridiMob for 2048-bit device keys.
devkeyAlgorithmHash → const String
Base64 SHA-256 of devkeyAlgorithm, as expected by the login endpoint.
initialStamp → const String
Placeholder value of the stamp field while the request is being signed.

Functions

algorithmHash(String algorithm) → String
Base64 SHA-256 of an algorithm name, for example devkeyAlgorithm.
dayBounds(DateTime? from, DateTime? to) → ({DateTime? end, DateTime? start})
First and last instant (UTC) of the days covered by from and to, in Algeria time. A null bound is open.
deriveDevkey(String publicKeyPem) → String
Derives the devkey sent to BaridiMob from a public key in SPKI PEM format (-----BEGIN PUBLIC KEY-----).
formatDatePattern(DateTime date, String pattern) → String
Formats date in Algeria time (UTC+1) with a Java date pattern: yyyy, MM, dd, HH, mm, ss, SSS, an offset (XXX, Z) and quoted literals.
generateDeviceKeys({int bits = 2048}) → DeviceKeys
Generates a new device identity with a fresh RSA key pair.
isWithinBounds(Transaction transaction, DateTime? start, DateTime? end) → bool
Whether transaction happened between start and end (inclusive).
parseAccount(Map<String, Object?> raw) → Account
Parses one account entry.
parseAccounts(Map<String, Object?> body) → List<Account>
Parses the accounts response.
parseCard(Map<String, Object?> raw) → BaridiMobCard
Parses one card.
parseCardlessCode(Map<String, Object?> raw) → CardlessCode
Parses one cardless operation.
parseCardlessCodes(Map<String, Object?> body) → List<CardlessCode>
Parses the operations/cardless/list response.
parseCardlessForm(Map<String, Object?> body) → CardlessForm
Parses the operations/cardless/inputs response.
parseCardLimits(Map<String, Object?> body) → List<CardLimit>
Parses the cardLimits response.
parseCards(Map<String, Object?> body) → List<BaridiMobCard>
Parses the cards response.
parseDynamicCheck(Map<String, Object?> body) → DynamicCheckResult
Parses the dynamic/operation/check response.
parseDynamicComplete(Map<String, Object?> body) → DynamicCompleteResult
Parses the dynamic/operation/complete response.
parseDynamicDetails(Object? value) → List<DynamicDetail>
Parses the details of a dynamic check or execution (and the additionalData of a cardless code).
parseDynamicExec(Map<String, Object?> body) → DynamicExecResult
Parses the dynamic/operation/execute response.
parseDynamicGroups(Map<String, Object?> body) → List<DynamicGroup>
Parses the dynamic/groups response.
parseDynamicOperation(Map<String, Object?> body) → DynamicOperationInfo
Parses the dynamic/operation response.
parseDynamicStep(Map<String, Object?> body) → DynamicStep
Parses the dynamic/operation/step response. Fields come in the order of their ordinalNumber; a response without a step is DynamicStep.done.
parseHistory(Map<String, Object?> body) → List<Transaction>
Parses the accountHistory response.
parsePaymentCategories(Map<String, Object?> body) → List<PaymentCategory>
Parses the paymentCategories response.
parsePaymentProviders(Map<String, Object?> body) → List<PaymentProvider>
Parses the paymentProviders response.
parseProfile(Map<String, Object?> body) → Profile
Parses the profile response.
parseRecentOperations(Map<String, Object?> body) → List<RecentOperation>
Parses the recentOperations response.
parseTimestamp(String value) → DateTime?
Parses a yyyyMMddHHmmss server timestamp (Algeria time) to a UTC DateTime. Returns null for malformed values.
parseTransaction(Map<String, Object?> raw) → Transaction
Parses one history entry.
resultNameFor(int code) → String
Symbolic name of a BaridiMob result code, for example SUCCESS for 0.
sha256Hex(String value) → String
Hex SHA-256 of a UTF-8 string.
signJsonBody(Map<String, Object?> body, String privateKeyPem) → String
Encodes body as JSON and signs it, with the same placeholder rule as signParams.
signParams(Map<String, String> params, String privateKeyPem) → String
Encodes params as a form body (or query string) and signs it.
toDateParam(DateTime value) → String
Formats value as the yyyyMMdd date expected by the server.

Typedefs

PasswordHasher = FutureOr<String> Function(String login, String password)
Computes the password sent to login/hash when the server asks for a hashed login (result 143).

Exceptions / Errors

AccountLockedError
The account is locked or blocked.
ApiResultError
The server answered with a non-zero result code.
BaridiMobError
Base class of every error thrown by this SDK.
DeviceConfirmationRequiredError
This device is not trusted yet: request an OTP and confirm the device.
DeviceFlowError
A step of the login or device flow was called in the wrong order.
ExpiredOtpError
The SMS code has expired.
HashedRetryError
The server rejected the hashed login retry.
InvalidCredentialsError
Wrong login or password.
InvalidOtpError
The SMS code is wrong.
InvalidSignatureError
The server rejected the request signature.
NetworkError
The request could not reach the server.
PasswordExpiredError
The password expired and must be changed in the official app.
RegistrationRequiredError
The account registration must be updated in the official app.
ServerError
The server failed or returned an invalid response.
SessionExpiredError
The session expired and no credentials are available to log in again.
TermsRequiredError
The terms of use must be accepted in the official app.
TimeoutError
The server did not answer in time.
TooManyAttemptsError
Too many failed attempts.