fayda_decoder library

Read and verify the QR code on the Ethiopian Fayda national ID card, entirely on-device.

For tests, package:fayda_decoder/testing.dart builds synthetic signed cards and QR images.

Community project. Not affiliated with or endorsed by Ethiopia's National ID Program (NIDP).

Classes

FaydaError
A failure code plus a human-readable message.
FaydaFace
The face thumbnail carried in the QR. Always a WebP image.
FaydaFailure
A decode that did not produce Fayda fields.
FaydaFields
The identity fields parsed from a Fayda QR.
FaydaRaw
Raw data kept alongside the parsed fields, since the format is unpublished and observational.
FaydaResult
The result of decoding a Fayda QR: either FaydaSuccess or FaydaFailure.
FaydaSignature
The signature carried in the QR, as found by the parser.
FaydaSuccess
A payload that parsed as a supported Fayda structure.
QrScan
The outcome of scanning one image for QR codes.
QrScanDecoded
One or more QR codes decoded to text.
QrScanner
A QR engine the image pipeline can call.
QrScanNone
No QR code was found.
QrScanUnreadable
A QR code was located but could not be decoded.
RgbaImage
Raw 8-bit RGBA pixels, row-major, same layout as the DOM's ImageData.
SignatureVerification
The outcome of verifySignature.
ZxingQrScanner
Pure-Dart QR scanner built on package:zxing2 (a port of ZXing).

Enums

FaydaErrorCode
Why a decode failed. Each code maps to one piece of caller UX.
FaydaGender
Gender as printed on the card.
KeySource
Which public key a verification used.
VerificationFailureReason
Why a signature did not verify.

Extensions

FaydaSuccessVerification on FaydaSuccess
Method-style access to verifySignature.

Constants

faydaV4PublicKeyPem → const String
FaydaEncode V4 RS256 public key.
libraryName → const String
Package name reported in FaydaSuccess.library.
libraryVersion → const String
Package version reported in FaydaSuccess.libraryVersion.

Functions

decodeImage(Uint8List bytes, {bool includeFace = false, QrScanner scanner = const ZxingQrScanner()}) → Future<FaydaResult>
Decodes a Fayda QR from encoded image bytes (JPEG, PNG, WebP, GIF, BMP, TIFF and more, via package:image).
decodeImageData(RgbaImage image, {bool includeFace = false, QrScanner scanner = const ZxingQrScanner()}) → Future<FaydaResult>
Decodes a Fayda QR from raw RGBA pixels, for example a camera frame.
decodeImageDataInBackground(RgbaImage image, {bool includeFace = false}) → Future<FaydaResult>
decodeImageData on a background isolate. See decodeImageInBackground.
decodeImageInBackground(Uint8List bytes, {bool includeFace = false}) → Future<FaydaResult>
decodeImage on a background isolate, so a Flutter UI keeps rendering while the photo is processed.
decodePayload(String text, {bool includeFace = false}) → FaydaResult
Parses the text content of a Fayda ID QR code.
imageBytesToRgba(Uint8List bytes) → RgbaImage
Decodes encoded image bytes to raw RGBA pixels.
isFaydaPayload(String text) → bool
Whether text has the structure of a Fayda QR payload.
verifySignature(FaydaSuccess result, {String? publicKeyPem}) → SignatureVerification
Verifies the detached JWS carried by a parsed Fayda QR.