The fm:Encrypt component allows you to encrypt a key/value pair.
The key/value pair can be of any type and has to be passed together.
The component also allows the user to set the values for the optional parameters init_vector and secret_key, which can be of any variable type.
This component was developed to encrypt media and user ids, so that media downloads can be tracked against each user.
One use of the fm:Encrypt component is to track the views (downloads) of media by users.
When you use the fm:Encrypt component to display a media, the views are tracked against the viewer, in the media usage table.
This differs from showing the media using < img src="http://fmdev.s3.amazonaws.com/storage/5048149/11" > which will log the view against the media views, (in the media table).
The following code will encrypt media 5048299 (to be shown in size 15) and user 1927628 to a url that displays the image and logs its view against user 1927628.
Please note: if this code is to be used to log the user's bandwidth usage, then it is necessary to include the media size (15) to be shown, and to do so using "/15".
Name | Required | Default | Description |
---|---|---|---|
encrypt_key | Required | N/A | (Any variable type) The encrypted strings key. If more than one key needs to be provided please use a csv list. |
encrypt_value | Required | N/A | (Any variable type) The encrypted strings value. If more than one value is provided please ensure the are delimited by commas. |
init_vector | Optional | N/A | (Any variable type) This is the initilization vector you will need to use with the provided secret_key |
secret_key | Optional | N/A | (Any variable type) If you want to pass the secret/key directly to the component you can use this optional key, if not used the system will use a self generated secret/key |
The following code will encrypt the media and user ids while also setting the optional values for the init_vector and secret_key, which can be of any type.