You can use LibHaLo as a single standalone JavaScript file, which could be included in a classic HTML application.
Please check GitHub releases page in order to grab the recent build of libhalo.js
library.
Include the libhalo.js
on your webpage:
<script src="libhalo.js"></script>
Create a minimal user interface:
<div id="statusText">Please click on the button below.</div>
<button onclick="btnPressed();">Click here</button>
Call the library inside the button click routine:
async function btnPressed() {
let command = {
name: "sign",
keyNo: 1,
digest: "6e76e202b71892e9ee32a634eefcf522ba1c4cb4eadd7e4562ced1270214c41e"
};
document.getElementById('statusText').innerText = "Please tap NFC tag to the back of your smartphone...";
try {
let res = await execHaloCmdWeb(command);
// display operation result
document.getElementById('statusText').innerText = JSON.stringify(res, null, 4);
} catch (e) {
// display error
document.getElementById('statusText').innerText = e;
}
}
Please review the following demonstrative applications:
- Simple digest signing demo (version >=C4)
- Simple digest signing demo (earlier versions)
- More advanced message signing demo (all versions)
If you don't want to use the pre-built library file, you can build the library on your own.
- Install Node.JS
- Clone the libhalo repository.
git clone https://github.com/arx-research/libhalo.git cd libhalo
- Install dependencies.
npm install
- Build the library.
cd web webpack
- Done! The library will be built in
web/dist
directory.