eid-viewer
eid-viewer library
The eid-viewer library

This library was originally written for the eID Viewer. It allows for reading of identity data from an eID card, as well as interacting with the .eid XML files that the eID Viewer knows. While this is provided as a library to manage identity data and can be used as such, its heritage of being the base of an eID Viewer is still visible in some areas.

This is a C API, but wrapper libraries are also available for Objective-C (on OS X) and C# (on Windows).

A simple application that works with this library would look like this:

void newstringdata(const EID_CHAR* label, const EID_CHAR* data) {
printf("Received data with label %s and contents %s\n", label, data);
}
void newstate(enum eid_vwr_states new_state) {
switch(new_state) {
exit(0);
default:
break;
}
}
int main(void) {
struct eid_vwr_ui_callbacks *callbacks = eid_vwr_cbstruct();
callbacks->newstate = newstate;
}
Main include file.
void * eid_vwr_be_mainloop(void *val) NORETURN
Loops over waiting function for pkcs11 card and reader insertion/removal event.
DllExport int eid_vwr_createcallbacks(struct eid_vwr_ui_callbacks *cb)
Initialize the callbacks.
Definition: oslayer.c:13
eid_vwr_states
Possible states.
Definition: oslayer.h:75
struct eid_vwr_ui_callbacks * eid_vwr_cbstruct()
Create the eid_vwr_ui_callbacks struct.
Definition: backend.c:63
@ STATE_TOKEN_WAIT
The card has been read, we're now waiting for events to do something else.
Definition: oslayer.h:80
Callbacks which the backend can perform towards the UI.
Definition: oslayer.h:128
void(* newstringdata)(const EID_CHAR *label, const EID_CHAR *data)
new string data to be displayed in UI.
Definition: oslayer.h:170
void(* newstate)(enum eid_vwr_states new_state)
State machine transition.
Definition: oslayer.h:222

For more information, please see the C API

The same example in Objective-C would look like:

#import <BeidView/oslayer-objc.h>
@implementation App : NSObject<eIDOSLayerUI>
-(void)newstate:(eIDState)state {
switch(state) {
case eIDStateTokenWait:
exit(0);
default:
break;
}
}
-(void)newstringdata:(NSString *)data withLabel:(NSString *)label{
NSLog(@"Received data with label %@ and contents %@", label, data);
}
@end
int main(void) {
App* a = [[App alloc]init];
[eIDOsLayerBackend setUi:a];
[eIDOsLayerBackend mainloop];
}
Protocol for implementing a UI.
Definition: oslayer-objc.h:86
Definition: state.c:71

More details are in the Objective-C API overview