The Celigo platform JavaScript runtime module natively supports the sjcl library.
Library |
License |
Supported version |
Description |
---|---|---|---|
sjcl |
BSD-2 |
1.8.0 |
Widely used crypto library |
You can use the sjcl library after integrator.io imports it when the following statement is included at the start of your script:
import sjcl from 'sjcl'
Note
You can create a script using function stubs that are available within integrator.io. Select any required function stub and add the code with sjcl functions to your script, based on what you want to do in your flow.
If you want to encode any sensitive data from your export like your fax or email address, you can encode and decode the data using sjcl functions such as base64 , utf8String , and sha256 hashing as shown and then import the data (with the required field mapping).
/* Script using the preSavePage function stub that includes sjcl functions */ import sjcl from 'sjcl' function preSavePage (options) { var Fax = options.data[0].fax /* Convert the given string to Base64 encoding */ var FaxBase64 = sjcl.codec.base64.fromBits(sjcl.codec.utf8String.toBits(Fax)) /* Convert the given base64 string to utf8string format, decoding base64 */ var Faxutf8String = sjcl.codec.utf8String.fromBits(sjcl.codec.base64.toBits(FaxBase64)) var EmailAddress = options.data[0].altemail // Hash a string /* The hash value, an array of 16 big-endian words */ var EmailAddressBitArray = sjcl.hash.sha256.hash(EmailAddress) /* Convert from a bitArray to a hex string */ options.data[0].EmailAddressHash = sjcl.codec.hex.fromBits(EmailAddressBitArray) options.data[0].FaxEncoded = FaxBase64 options.data[0].FaxDecoded = Faxutf8String return { data: options.data, errors: options.errors, abort: false, newErrorsAndRetryData: [] } }
Comments
Please sign in to leave a comment.