I decided to create a module ( C / C ++ Addons ) for NW.js to work with Rutoken and share the code with the community, and also invite you to participate in this Open source project.
The idea is that you can use all the features of Rutoken in the NW application using pure and clear JavaScript, and this module can also be used in Node.JS or io.js.
API RutokenJS
CKR initialize ()
bool isInitialize ()
CKR finalize ()
object countSlot ()
object getLibInfo ()
object getSlotInfo (int slot)
object getTokenInfo (int slot)
object getMechanismList (int slot)
object getObjectList ()
CKR login (int slot, string pin)
CKR loguot ()
object random (int size)
CKR initToken (int slot)
CKR openSession ()
CKR closeSession ()
CKR closeAllSessions ()
object getSessionInfo ()
CKR getOperationState ()
CKR setOperationState ()
')
Usage example:
var rutoken = require('./rutoken/rutoken'); var cntSlot = rutoken.countSlot(); console.log('cntSlot: ', cntSlot); if(cntSlot > 0) { for(var i=0; i <= cntSlot-1; i++) { rutoken.getSlotInfo(i, function(data) { console.log('Slot info #' + i + "\n", data); }); rutoken.getTokenInfo(i, function(data) { console.log('Token info #' + i + "\n", data); }); rutoken.getMechanismList(i, function(data) { console.log('Mechanism list #' + i + "\n", data); }); } }