Hashtag Helpers
PKC Encrypt
Asymmetrically encrypts data for secure service communication
This hashtag helper enables asymmetric encryption of sensitive data, ensuring that only intended services can decrypt the information. When used without arguments, any Stubber service can decrypt the data. When a service is specified, only that service will be able to decrypt the data. You can further restrict decryption by specifying an identifier that the service must be using.
The encryption happens at substitution time. Make sure the data you want to encrypt is available in the service performing the encryption.
Uses
- Secure sensitive data transmission between services
- Restrict data access to specific services
- Encrypt PINs, passwords, and other sensitive information
- Ensure data can only be decrypted by intended services
- Hide data from the Stubber System and Stubber UI completely
- Restrict decryption to specific identifiers within a service
Usage
Helper name: pkc_encrypt
Arguments
Parameters
eg.
~~#pkc_encrypt#value_to_encrypt
or
~~#pkc_encrypt 'service_name'#value_to_encrypt
or
~~#pkc_encrypt 'service_name' 'identifier'#value_to_encrypt
The actual encrypted data will look something like this:
The system automatically handles the decryption process when the data reaches the appropriate service with the correct identifier.
Examples
Basic Encryption
This example shows basic encryption where any service can decrypt the data.
Usage Example
Result
Service-Specific Encryption
Usage Example
Result
Identifier-Specific Encryption
This example shows how to encrypt data that can only be decrypted by a specific service when using a specific identifier.
Usage Example
Result
Combined with Target Helper
This example shows how to use PKC Encrypt with the Target helper to control where encryption happens.
Usage Example
In this example:
- The encryption only happens in the API Call service (where apiresult is available)
- Only the WhatsApp service can decrypt the final encrypted value
- WhatsApp can only decrypt when sending to the phone number 27713334444
- Other services will see the encrypted data but cannot decrypt it
Result (When processed by API Call service)
Result (When processed by other services)
API Call with URL-specific Encryption
This example shows how to encrypt data that can only be decrypted by the API Call service when making a request to a specific URL.
Usage Example
In this example:
- The API key is encrypted so that only the API Call service can decrypt it
- The API Call service can only decrypt it when making a request to the specific URL
- This prevents the API key from being used with other endpoints
When encrypting data that's only available in a specific service (like API results), always use the Target helper to ensure the encryption happens in the correct service.
For different services, the identifier has different meanings:
- WhatsApp: The phone number (e.g., '27713334444')
- API Call: The URL of the API endpoint
- Other services may use different identifiers