From 27feadfd9947bada6097acbfb8ae6fd4c11a66fd Mon Sep 17 00:00:00 2001 From: Nicholas Orr Date: Tue, 15 Oct 2024 16:08:12 +1100 Subject: [PATCH] More functions --- docs/Functions/BE_CreateKeyPair.md | 42 +++++++++++++++++++ docs/Functions/BE_CurlGetInfo.md | 43 +++++++++++++++++++ docs/Functions/BE_DecryptWithKey.md | 39 ++++++++++++++++++ docs/Functions/BE_EncryptWithKey.md | 37 +++++++++++++++++ docs/Functions/BE_GetPublicKey.md | 36 ++++++++++++++++ docs/Functions/BE_JSON_jq.md | 64 +++++++++++++++++++++++++++++ 6 files changed, 261 insertions(+) create mode 100644 docs/Functions/BE_CreateKeyPair.md create mode 100644 docs/Functions/BE_CurlGetInfo.md create mode 100644 docs/Functions/BE_DecryptWithKey.md create mode 100644 docs/Functions/BE_EncryptWithKey.md create mode 100644 docs/Functions/BE_GetPublicKey.md create mode 100644 docs/Functions/BE_JSON_jq.md diff --git a/docs/Functions/BE_CreateKeyPair.md b/docs/Functions/BE_CreateKeyPair.md new file mode 100644 index 000000000..0fc0a8751 --- /dev/null +++ b/docs/Functions/BE_CreateKeyPair.md @@ -0,0 +1,42 @@ +## BE_CreateKeyPair + + BE_CreateKeyPair + +**Description** + +Generates an RSA Private Key in text format as : + +-----BEGIN RSA PRIVATE KEY----- +MIIJKQIBAAKCAgEAsbUeQ/7WK0Dltk4Ko/MAkAyowbHL7OkCRIBLjdd54nJIwFbF +... +WzdSYrUaE5Dnwdf8V0GjBKg6HsiFzgDXW2sEKd/Y8zQ91Pqnhh914bLczCf7 +-----END RSA PRIVATE KEY----- + +**Parameters** + +NA + +**Keywords** + +RSA PrivateKey PublicKey + +**Version History** + +* 5.0.0 : First Release + +**Notes** + +You can extract the public key from Private Keys using BE_GetPublicKey. + +**Compatibility** + +| Platform | Compatibility | +|-----------|-----------| +| Status | Active | +| Mac FMP | Yes | +| Win FMP | Yes | +| FMS | Yes | +| iOS | Yes | +| Linux | Yes | + +**Example Code** diff --git a/docs/Functions/BE_CurlGetInfo.md b/docs/Functions/BE_CurlGetInfo.md new file mode 100644 index 000000000..1c2a328f8 --- /dev/null +++ b/docs/Functions/BE_CurlGetInfo.md @@ -0,0 +1,43 @@ +## BE_CurlGetInfo + + BE_CurlGetInfo ( getInfoOption ) + +**Description** + +This function returns a value for the most recent curl operation ( HTTP, FTP, SMTP ) using the list of options that are supported by the BE_CurlSetOption function, and documented here : + +https://curl.se/libcurl/c/curl_easy_getinfo.html + +**Parameters** + +* *getInfoOption* : Any of the values as a text string that are documented as working in the BE_CurlSetOption function. + +**Keywords** + +curl option get set http ftp sftp smtp + +**Version History** + +* 5.0.0 : First Release + +**Notes** + +Not all options are supported in the plugin vs what is on the curl website, but the website documents them well to understand their usage. + +**Compatibility** + +| Platform | Compatibility | +|-----------|-----------| +| Status | Active | +| Mac FMP | Yes | +| Win FMP | Yes | +| FMS | Yes | +| iOS | Yes | +| Linux | Yes | + +**Example Code** + + BE_CurlSetOption ( "CURLOPT_CERTINFO" ; 1 ) & + BE_HTTP_GET ( "https://goya.com.au" ) & + BE_CurlGetInfo ( "CURLINFO_CERTINFO" ) + diff --git a/docs/Functions/BE_DecryptWithKey.md b/docs/Functions/BE_DecryptWithKey.md new file mode 100644 index 000000000..8f9c1e122 --- /dev/null +++ b/docs/Functions/BE_DecryptWithKey.md @@ -0,0 +1,39 @@ +## BE_DecryptWithKey + + BE_DecryptWithKey ( encryptedText ; keyText ) + +**Description** + +Decrypts some text that was previously encrypted using the public RSA version of this key. + +**Parameters** + +* *encryptedText* : the encrypted text as base64. +* *keyText* : the key in RSA PRIVATE KEY format as text. + +**Keywords** + +encrypt decrypt rsa publicKey privateKey base64 + +**Version History** + +* 5.0.0 : First Release + +**Notes** + +Uses the same logic as openssl on the command line so should be compatible with that. These keys can be used as access keys for SSH or converted to other formats. + +If you have issues with the keys, check the line endings. The DataViewer can mangle line endings in copy and pasted text, and line breaks in keys need to be Char ( 10 ). + +**Compatibility** + +| Platform | Compatibility | +|-----------|-----------| +| Status | Active | +| Mac FMP | Yes | +| Win FMP | Yes | +| FMS | Yes | +| iOS | Yes | +| Linux | Yes | + +**Example Code** diff --git a/docs/Functions/BE_EncryptWithKey.md b/docs/Functions/BE_EncryptWithKey.md new file mode 100644 index 000000000..b0296368d --- /dev/null +++ b/docs/Functions/BE_EncryptWithKey.md @@ -0,0 +1,37 @@ +## BE_EncryptWithKey + + BE_EncryptWithKey ( text ; keyText ) + +**Description** + +Encrypts the **text** with they **keyText** supplied. + +**Parameters** + +* *text* : description. +* *keyText* : description. + +**Keywords** + +encrypt decrypt rsa publicKey privateKey + +**Version History** + +* 1.0.0 : First Release + +**Notes** + +If you have issues with the keys, check the line endings. The DataViewer can mangle line endings in copy and pasted text, and line breaks in keys need to be Char ( 10 ). + +**Compatibility** + +| Platform | Compatibility | +|-----------|-----------| +| Status | Active | +| Mac FMP | Yes | +| Win FMP | Yes | +| FMS | Yes | +| iOS | Yes | +| Linux | Yes | + +**Example Code** diff --git a/docs/Functions/BE_GetPublicKey.md b/docs/Functions/BE_GetPublicKey.md new file mode 100644 index 000000000..daf2eb6df --- /dev/null +++ b/docs/Functions/BE_GetPublicKey.md @@ -0,0 +1,36 @@ +## BE_GetPublicKey + + BE_GetPublicKey ( privateKey ) + +**Description** + +Generates the public key from a given **privateKey** generated with the BE_CreateKeyPair function. + +**Parameters** + +* *privateKey* : the RSA Private Key in text format. + +**Keywords** + +RSA PrivateKey PublicKey + +**Version History** + +* 5.0.0 : First Release + +**Notes** + +If you have issues with the keys, check the line endings. The DataViewer can mangle line endings in copy and pasted text, and line breaks in keys need to be Char ( 10 ). + +**Compatibility** + +| Platform | Compatibility | +|-----------|-----------| +| Status | Active | +| Mac FMP | Yes | +| Win FMP | Yes | +| FMS | Yes | +| iOS | Yes | +| Linux | Yes | + +**Example Code** diff --git a/docs/Functions/BE_JSON_jq.md b/docs/Functions/BE_JSON_jq.md new file mode 100644 index 000000000..cd622583d --- /dev/null +++ b/docs/Functions/BE_JSON_jq.md @@ -0,0 +1,64 @@ +## BE_JSON_jq + + BE_JSON_jq ( json ; filter { ; options } ) + +**Description** + +jq is a lightweight and flexible command-line JSON processor akin to sed,awk,grep, and friends for JSON data. It allows you to easily slice, filter, map, and transform structured data. + +**Parameters** + +* *json* : the input to the jq function. +* *filter* : the filter(s) to run on the input. +* *options* : one or more of the following characters : V c j r - see notes. + +**Keywords** + +jq json + +**Version History** + +* 5.0.0 : First Release + +**Notes** + +More info is here : https://jqlang.github.io/jq/ + +And a manual with all the details is here : https://jqlang.github.io/jq/manual/ + +For testing your filters use : https://jqplay.org + +The option values are : + +c - compact - By default, jq pretty-prints JSON output. Using this option will result in more compact output by instead putting each JSON object on a single line. + +r - raw output ( ie not quoted text strings ) - With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems. + +j - join output : Like -r but jq won't print a newline after each output. + +V - version info. + +**Compatibility** + +| Platform | Compatibility | +|-----------|-----------| +| Status | Active | +| Mac FMP | Yes | +| Win FMP | No | +| FMS | Yes | +| iOS | Yes | +| Linux | Yes | + +**Example Code** + +Get all the names of product types : + + BE_JSON_jq ( $json ; ".productTypes[].name" ) + +In an array of prices select the ones where quantity is 1, then sort by price, and find the largest, and return that price : + + BE_JSON_jq ( $json ; "[ .prices[] | select(.quantity == 1 ) ] | max_by(.price) | .price" ; "r" ) + +Find all possible values of a node, deep in a json object : + + BE_JSON_jq ( $json ; “.data.products.edges[].node.category.name” ; “r” ) \ No newline at end of file