npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-rockeyarm

v1.0.0

Published

A javascript library for Feitian ROCKEY ARM dongle.

Downloads

4

Readme

js-rockeyarm

English | 中文

Intruduction

js-rockeyarm, it provides a simplistic Object Oriented interface for interacting with Feitian ROCKEY-ARM dongle.

|Hardware|Firmware|OS|Architecture| |-|-|-|-| |ROCKEY-ARM Standard|2.23|Windows 10|x64| |ROCKEY-ARM Time|2.23|Windows 10|x64|

Preparation

You need to install Node.js locally.

You also need to buy ROCKEY-ARM dongle hardware and it's SDK.

js-rockeyarm depends on dynamic link library in ROCKEY-ARM SDK.

|Filename|Platform|Arch| |-|-|-| |Dongle_d.dll|Windows|x64| |libRockeyARM.so.0.3|Linux|x64|

Installation

npm install js-rockeyarm

Copy the dynamic link library to the path js-rockeyarm/lib/x64.

Documentation

User manual of ROCKEY-ARM,you can get it from Feitian.

Examples

Example 1

Enumerate a list of ROCKEY-ARM dongle,and find a dongle which product ID is 'FFFFFFFF'. If the dongle is exits,open the dongle.

import  RockeyArm  from  '../src/index.js'

var dongle = new RockeyArm()
var ret
var i = 0
var item
var index = null
var pid = 'FFFFFFFF'
console.log('ROCKEY-ARM node.js api test')
ret = dongle.Enum()
if(ret.param === null){
    console.log('failed')
}
for (i=0; i<ret.param.length; i++){
    item = JSON.parse(ret.param[i])
    if(item.productId === pid){
        index = i
        break
    }
}
if (index === null){
    console.log('Do not find ROCKEY-ARM Product ID:%s', pid)
}
ret = dongle.Open(index)
console.log('Open ret:',ret)

ret = dongle.Close()
console.log('Close ret:',ret)

Example 2

Initialize a new ROCKEY-ARM dongle.

import  RockeyArm  from  '../src/index.js'

var dongle = new RockeyArm()
var ret
var i = 0
var item
var index = null
var pid = 'FFFFFFFF'
console.log('ROCKEY-ARM node.js api test')
ret = dongle.Enum()
if(ret.param === null){
    console.log('failed')
}
for (i=0; i<ret.param.length; i++){
    item = JSON.parse(ret.param[i])
    if(item.productId === pid){
        index = i
        break
    }
}
if (index === null){
    console.log('Do not find ROCKEY-ARM Product ID:%s', pid)
}
ret = dongle.Open(index)
console.log('Open ret:',ret)

ret = dongle.VerifyPIN(1, 'FFFFFFFFFFFFFFFF')
console.log('VerifyPIN ret:',ret)

//6 is length of seed bytes,'123456' is seed bytes.
ret = dongle.GenUniqueKey(6, '123456')
console.log('GenUniqueKey ret:',ret)
// you must remember the seed bytes. you will get a new admin PIN and a new product ID.
ret = dongle.Close()
console.log('Close ret:',ret)

Example 3

Write and read user data zone.

import  RockeyArm  from  '../src/index.js'

var dongle = new RockeyArm()
var ret
var i = 0
var item
var index = null
var pid = 'FFFFFFFF'
console.log('ROCKEY-ARM node.js api test')
ret = dongle.Enum()
if(ret.param === null){
    console.log('failed')
}
for (i=0; i<ret.param.length; i++){
    item = JSON.parse(ret.param[i])
    if(item.productId === pid){
        index = i
        break
    }
}
if (index === null){
    console.log('Do not find ROCKEY-ARM Product ID:%s', pid)
}
ret = dongle.Open(index)
console.log('Open ret:',ret)

//Offset:1  Length:8
ret = dongle.ReadData(1, 8)
console.log('ReadData ret:',ret)

//Offset:0 Bytes to write:'0102030405060708' Length of bytes to write:8
ret = dongle.WriteData(0, '0102030405060708', 8)
console.log('WriteData ret:',ret)

// you must remember the seed bytes. you will get a new admin PIN and a new product ID.
ret = dongle.Close()
console.log('Close ret:',ret)

Example 4

Get time from real time clock in ROCKEY-ARM dongle,and set time license.

import  RockeyArm  from  '../src/index.js'

var dongle = new RockeyArm()
var ret
var i = 0
var item
var index = null
var pid = 'FFFFFFFF'
console.log('ROCKEY-ARM node.js api test')
ret = dongle.Enum()
if(ret.param === null){
    console.log('failed')
}
for (i=0; i<ret.param.length; i++){
    item = JSON.parse(ret.param[i])
    if(item.productId === pid){
        index = i
        break
    }
}
if (index === null){
    console.log('Do not find ROCKEY-ARM Product ID:%s', pid)
}
ret = dongle.Open(index)
console.log('Open ret:',ret)

//get UTC time from real time clock in dongle
ret = dongle.GetUTCTime()
console.log('GetUTCTime ret:',ret)

//var deadline = {type: 'hours', time: 3} //set reamain hours
//var deadline = {type: 'nolimit', time: 0} //do not limit time
var deadline = {type: 'timestamp', time: new Date(2024,0,1,0,0,0,0).getTime().toString(10)} //set expired time: 2024.1.1 0:0:0
ret = dongle.SetDeadline(deadline)
console.log(ret)

ret = dongle.GetDeadline()
console.log(ret)

ret = dongle.Close()
console.log('Close ret:',ret)

Example 5

Run internal executable file.You should download a execuable file to dongle.

import  RockeyArm  from  '../src/index.js'

var dongle = new RockeyArm()
var ret
var i = 0
var item
var index = null
var pid = 'FFFFFFFF'
console.log('ROCKEY-ARM node.js api test')
ret = dongle.Enum()
if(ret.param === null){
    console.log('failed')
}
for (i=0; i<ret.param.length; i++){
    item = JSON.parse(ret.param[i])
    if(item.productId === pid){
        index = i
        break
    }
}
if (index === null){
    console.log('Do not find ROCKEY-ARM Product ID:%s', pid)
}
ret = dongle.Open(index)
console.log('Open ret:',ret)

//fileId: 0x0002  input data buffer:'000102', length of input data:32
//real length of input data buffer is less than length passed into,js-rockeyarm will pad zero.
ret = dongle.RunExeFile(2, '000102', 32)
console.log('RunExeFile ret:',ret)

ret = dongle.Close()
console.log('Close ret:',ret)

Example 6

Generate RSA key pairs.Use RSA private key encrypt data,and user RSA public key decrypt cipher data.

import  RockeyArm  from  '../src/index.js'

var dongle = new RockeyArm()
var ret
var i = 0
var item
var index = null
var pid = 'FFFFFFFF'
console.log('ROCKEY-ARM node.js api test')
ret = dongle.Enum()
if(ret.param === null){
    console.log('failed')
}
for (i=0; i<ret.param.length; i++){
    item = JSON.parse(ret.param[i])
    if(item.productId === pid){
        index = i
        break
    }
}
if (index === null){
    console.log('Do not find ROCKEY-ARM Product ID:%s', pid)
}
ret = dongle.Open(index)
console.log('Open ret:',ret)

ret = dongle.VerifyPIN(1, '0102030405060708')
console.log('VerifyPIN ret:',ret)

//RSA private key file ID:0x0003
ret = dongle.RsaGenPubPriKey(0x0003)
console.log('RsaGenPubPriKey ret:', ret)
var privateKey = ret.param.privateKey
var publicKey = ret.param.publicKey //Public key vendor should save as common data file.
console.log(publicKey, privateKey)

//RSA private key file ID: 0x0003, flag:0 - encrypt, plain text: '010203040506', length of plain text: 6
ret = dongle.RsaPri(3, 0, '010203040506', 6)
console.log('RsaPri ret:', ret)
var cipher = ret.param.result
var cipherLen = ret.param.len

//flag:1 - decrypt, public key data: publickey, cipher text: cipher, length of cipher text: cipherLen
ret = dongle.RsaPub(1, publicKey, cipher, cipherLen)
console.log('RsaPub ret:', ret)

ret = dongle.Close()
console.log('Close ret:',ret)