UNPKG

@adyen/api-library

Version:

The Adyen API Library for NodeJS enables you to work with Adyen APIs.

39 lines 2.21 kB
"use strict"; /* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ * ############# #####( ###### #####. ###### ############# ############# * ###### #####( ###### #####. ###### ##### ###### ##### ###### * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### * ###### ###### #####( ###### #####. ###### ##### ##### ###### * ############# ############# ############# ############# ##### ###### * ############ ############ ############# ############ ##### ###### * ###### * ############# * ############ * Adyen NodeJS API Library * Copyright (c) 2026 Adyen B.V. * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.deriveKeyMaterial = void 0; const crypto_1 = require("crypto"); const nexoDerivedKey_1 = require("../../typings/clouddevice/security/nexoDerivedKey"); function deriveKeyMaterial(passphrase) { const pass = Buffer.from(passphrase, "binary"); const salt = Buffer.from("AdyenNexoV1Salt", "binary"); // Iteration count fixed at 4000 as mandated by the Nexo protocol specification (AdyenNexoV1) // Reference https://docs.adyen.com/point-of-sale/design-your-integration/choose-your-architecture/local/protect const iterations = 4000; const keylen = nexoDerivedKey_1.NEXO_HMAC_KEY_LENGTH + nexoDerivedKey_1.NEXO_CIPHER_KEY_LENGTH + nexoDerivedKey_1.NEXO_IV_LENGTH; const key = (0, crypto_1.pbkdf2Sync)(pass, salt, iterations, keylen, "sha1"); return { hmacKey: key.slice(0, nexoDerivedKey_1.NEXO_HMAC_KEY_LENGTH), cipherKey: key.slice(nexoDerivedKey_1.NEXO_HMAC_KEY_LENGTH, nexoDerivedKey_1.NEXO_HMAC_KEY_LENGTH + nexoDerivedKey_1.NEXO_CIPHER_KEY_LENGTH), iv: key.slice(nexoDerivedKey_1.NEXO_HMAC_KEY_LENGTH + nexoDerivedKey_1.NEXO_CIPHER_KEY_LENGTH), }; } exports.deriveKeyMaterial = deriveKeyMaterial; //# sourceMappingURL=nexoDerivedKeyGenerator.js.map