Retrieving information from a smartcard
const { hsm } = require("@dinamonetworks/hsm-dinamo");
// Define os parâmetros de conexão com o HSM
const options = {
host: "127.0.0.1",
authUsernamePassword: {
username: "master",
password: "12345678",
},
};
async function getScInfo() {
let conn;
try {
// Conecta ao HSM
conn = await hsm.connect(options);
// Obtém informações do smartcard
const info = await conn.management.getScInfo();
// Exibe as informações
console.log(`Smart Card Informations: ${info}`);
} catch (error) {
const errorMessage = error instanceof Error ? error.message : "An unknown error occurred.";
console.error(`An error occurred: ${errorMessage}`, error);
} finally {
if (conn) {
await conn.disconnect();
}
}
}
getScInfo();