/** * @NApiVersion 2.x * @NScriptType Suitelet */ define([‘N/crypto’, ‘N/log’], function (crypto, log) { function onRequest(context) { let text = ‘Sample Data’; // Encode to Base64 let encoded = crypto.encode({ input: text, outputEncoding: crypto.Encoding.BASE_64 }); log.debug(‘Encoded (Base64):’, encoded); // Decode from Base64 let decoded = crypto.decode({ input: encoded, inputEncoding: crypto.Encoding.BASE_64 }); log.debug(‘Decoded:’, decoded); context.response.write(‘Encoded:… Continue reading Encoding and Decoding Base64 with the N/crypto Module
Tag: base64
How to validate if input in input field has base64 encoded string using express-validator
In HTML forms, we often required validation of different types. Validate existing email, validate password length, validate confirm password, validate to allow only integer inputs, these are some examples of validation. If In a certain input field only base 64 encoded string are allowed i.e there not allowed any other form of string which not… Continue reading How to validate if input in input field has base64 encoded string using express-validator