How to use the fabric-network.HsmX509Provider function in fabric-network

To help you get started, we’ve selected a few fabric-network examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / test / integration / network-e2e / invoke-hsm.js View on Github external
const walletPromise = (async () => {
	const wallet = await Wallets.newInMemoryWallet();
	const hsmOptions = {
		lib: pkcsLibPath,
		pin: PKCS11_PIN,
		slot: PKCS11_SLOT
	const hsmProvider = new HsmX509Provider(hsmOptions);

	const idManager = new IDManager(JSON.parse(ccp.toString()), hsmOptions);
	await idManager.initialize();

	const adminEnrollment = await idManager.enroll(adminUser, adminSecret);
	const adminIdentity = {
		credentials: {
			certificate: adminEnrollment.certificate,
			privateKey: adminEnrollment.key.toBytes()
		type: 'X.509'
	await wallet.put(adminUser, adminIdentity);