Sending encrypted pin in ChangePin request

For PATCH /v1/corporate-cards/{cardId}/pin, send pinEncrypted field.
Encrypt the PIN with the 2048-bit RSA public key exchanged with Altery during onboarding, using RSA-OAEP padding with SHA-1 (MGF1-SHA1). If you do not have the public key, contact your Altery representative to complete the key exchange.

const crypto = require('crypto');

const publicKey = '... your public key ...';
const pin = '1234';

const pinEncrypted = crypto.publicEncrypt(
    {
        key: publicKey,
        padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
        oaepHash: 'sha1'
    },
    Buffer.from(pin, 'utf8')
).toString('base64');

const requestBody = {
    pinEncrypted
};

console.log(JSON.stringify(requestBody, null, 2));