Belfius Reader
Last updated
Last updated
The Belfius container in the T1C-JS library is an abstraction layer built on top of the [Remote Loading] (../belfius-reader.md)
It offers the following functions:
The readerId is passed to the readerapi
handler object on initialization. For example, opening a session on reader with id f56c0ffe15a07d09
would look like this:
All function return Promises by default.
If you prefer callbacks, each function also has an optional parameter to pass in a callback function. If a callback function is provided, the function will still return a promise, but the callback function will be called when the promise resolves/gets rejected.
This is the main difference between the Remote Loading and the Belfius containers. Where the sessionId is optional in the ReLo API, it isalways required for the Belfius container!
All responses follow a similar structure:
The success
property indicates whether or not the request was completed successfully. The data
property is where returned information will be found; the type of data
varies with each function.
Opens a new session. Returns the sessionId, which will need to be stored by the client application for later use.
openSession(timeout?: number, callback?: (error, data))
timeout (optional): session timeout in seconds. If not provided, will default to value set in GCLConfig. Must be a number > 0.
Closes _all _currently open sessions.
closeSession(callback?: (error, data))
none
Get nonce for the session.
The value in the HASH field is calculated by the host and verified by the reader. The hash algorithm and length of the HASH field are specified by the selected STX method. The hash value is calculated over the nonce and the message. If the reader calculates a different hash value than specified in the HASH field, then the reader shall discard this STX command.
nonce(sessionId: string, callback?: (error, data))
sessionId: id of the session to use.
Sends an STX command to the reader.
The Vasco secure transfer (STX) model offers an interface towards Vasco client devices with several methods to secure the data to be sent. Such methods include data signing and/or encryption using symmetric or asymmetric algorithms. The host can secure the data towards the reader with the specific method that has been selected during initialization of the secure transfer interface.
stx(sessionId: string, command: string, callback?: (error, data))
sessionId: id of the session to use.
command: STX command string to be sent to reader.
Checks if the selected reader is a Belfius Vasco 870 reader.
This method returns a promise that will resolve to a boolean (or will call the provided callbck function with a boolean). If true, the selected reader is a Belfius reader and it can be used for the STX and Nonce endpoints.
Because Nonce and STX cannot work on non-Belfius readers, these methods will also call the isBelfiusReader method internally, to make sure the selected reader is compatible. If this is not the case, they will return an error.
isBelfiusReader(sessionId: string, callback?: (error, data))
sessionId: id of the session to use.
function
Input
Output
Description
openSession
session timeout in seconds
sessionId
Opens a remote session, the session will be accessible through a session-id. The T1C will keep the session open and reusable.
closeSession
N/A
N/A
Close a session. When no session is available, a new session will be opened and closed. The T1C will be in its initial state.
nonce
sessionId
nonce
Returns a nonce generated inside a session. A valid sessionID is a required parameter.
stx
sessionId
STX response
Execute a STX request. A valid sessionID is a required parameter.
isBelfiusReader
sessionId
boolean
Check if the selected reader is a Belfius Vasco 870 reader