eid
The common ground of electronic identity cards, in pure Dart: commands, file
reading, card insertion and the values national cards share. Country packages
such as eid_belgium read the cards themselves.
Install
dependencies:
eid: ^0.1.0
Transports
A CardTransport carries bytes to a card. Adapters:
| eid_ccid | A USB or PC/SC card reader |
Any other is one method:
final class MyTransport implements CardTransport {
@override
Future<Uint8List> transmit(Uint8List command) async {
// Return the response, status bytes included.
}
}
Read a file
final channel = CardChannel(transport, onApdu: print);
await channel.selectPath([0x3F00, 0xDF01, 0x4031]);
final file = await channel.readTransparentFile();
A refused command throws a CardException, an unreachable card a
CardTransportException. onApdu never sees a PIN.
Cards going in and out
final watcher = CardWatcher(AnyCardTerminal(listTerminals))..start();
watcher.events.listen((event) {
switch (event) {
case CardInserted inserted:
read(inserted.connection);
case CardRemoved _:
clear();
}
});
AnyCardTerminal watches every terminal, those plugged in later included.
Shared values
PartialDate is a birth date whose day or month may be unknown, with
ageOn and minimumAgeOn. Sex holds the three values of ICAO 9303.
Countries
| eid_belgium | The Belgian eID, Kids ID and residence cards |
License
Released under the MIT licence.
More from COMAPPS
Every package COMAPPS publishes is listed at packages.comapps.be.
Libraries
- eid
- Talks to electronic identity cards over any transport.