Recovering a smartcard shadow
import { hsm } from "@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 main() {
let conn;
try {
// Conecta ao HSM
conn = await hsm.connect(options);
// PIN do smartcard a ser inserido
const pin = "12345678"; // Substitua pelo PIN real do smartcard
// Obtém shadow do smartcard
console.log("Insert the smartcard...");
try {
const shadow = await conn.management.getShadow(pin);
console.log(`Shadow retrieved: ${shadow}`);
} catch (error) {
console.error("Error retrieving shadow:", error.message);
throw error;
}
} catch (error) {
console.error("An error occurred:", error.message);
} finally {
if (conn) {
// Desconecta do HSM
await conn.disconnect();
}
}
}
// Executa a função principal
main();