{"id":21855588,"url":"https://github.com/zeropsio/zparser","last_synced_at":"2026-01-23T06:21:15.187Z","repository":{"id":210802322,"uuid":"572107634","full_name":"zeropsio/zParser","owner":"zeropsio","description":"Zerops file parser with support for functions and string modifiers.","archived":false,"fork":false,"pushed_at":"2024-10-18T15:02:32.000Z","size":164570,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-12T03:36:04.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeropsio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-29T15:12:10.000Z","updated_at":"2025-08-05T02:30:42.000Z","dependencies_parsed_at":"2023-12-05T01:37:02.705Z","dependency_job_id":"1038fb70-4954-4b7d-8897-8578759b317f","html_url":"https://github.com/zeropsio/zParser","commit_stats":null,"previous_names":["zeropsio/zparser","zerops-dev/zparser"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/zeropsio/zParser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2FzParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2FzParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2FzParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2FzParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeropsio","download_url":"https://codeload.github.com/zeropsio/zParser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeropsio%2FzParser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T02:16:30.059Z","updated_at":"2026-01-23T06:21:15.051Z","avatar_url":"https://github.com/zeropsio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zParser - Zerops Parser\n\nFile parser with support for functions and string modifiers.\n\n## Description\n\n### Basic syntax\n\n| symbol              | description                                      |\n|---------------------|--------------------------------------------------|\n| `\u003c@`                | beginning of a function                          |\n| `(`                 | beginning of function parameters                 |\n| `)`                 | end of function parameters                       |\n| `,`                 | function parameter delimiter                     |\n| `\u003c`                 | beginning of a string (without `@`)              |\n| `\u003e`                 | end of a string or a function                    |\n| \u003ccode\u003e\u0026#124;\u003c/code\u003e | modifier used at the end of a function or string |\n| `\\`                 | an escape character                              |\n\n#### Static string example\n\n```\n\u003cthis is a static string, with a modifier|upper\u003e\n```\n\n#### Function example\n\n```\n\u003c@generateRandomString(\u003c20\u003e)\u003e\n```\n\n---\n\n### Function parameters\n\nFunctions support 2 types of parameters\n\n1. variables\n    - text NOT enclosed in `\u003c` and `\u003e`\n    - spaces at the beginning and end are trimmed\n    - stored value under variable name is found and passed into the function (if no value is found, error is returned)\n2. static strings\n    - text enclosed in `\u003c` and `\u003e`\n    - spaces between `\u003c` and `\u003e` are NOT trimmed\n    - if modifiers are used, or there are multiple nested strings in one parameter, they are processed first\n    - equivalent of passing `\"my string\"` into function in some languages\n\n⚠️ When using `getVar` function, parameter MUST be a variable (not enclosed in `\u003c` and `\u003e`)!\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n```yaml\n  # This generates a random string 20 characters long and stores it into variable named myRandomString\n  \u003c@generateRandomStringVar(\u003cmyRandomString\u003e, \u003c20\u003e)\u003e\n\n  # This stores text `this is my custom string` into variable named myCustomString\n  \u003c@setVar(\u003cmyCustomString\u003e, \u003cthis is my custom string\u003e)\u003e\n\n  # Following function call will result in one of the following values\n  # my static string\n  # FpKWQv6LvVmPKb2CeXTN\n  # this is my custom string\n  \u003c@pickRandom(\u003cmy static string\u003e, myRandomString, myCustomString)\u003e\n\n  # This will return `THIS IS MY CUSTOM STRING`\n  \u003c@getVar(myCustomString)|upper\u003e\n```\n\n\u003c/details\u003e\n\n---\n\n### Spaces\n\nIn static strings, all leading/trailing spaces between `\u003c` and first occurrence of `|` or `\u003e` (whichever occurs first)\nare preserved, contrary to functions, which have all trailing spaces (between parameters and modifiers) trimmed.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\nStatic string:\n\n| input                                           | output                 | comment                                          |\n|-------------------------------------------------|------------------------|--------------------------------------------------|\n| \u003ccode\u003eThis is \u003c my string \u0026#124; upper\u003e.\u003c/code\u003e | `This is  MY STRING .` | notice two spaces before `MY` and one before `.` |\n| \u003ccode\u003eThis is \u003cmy string \u0026#124; upper\u003e.\u003c/code\u003e  | `This is MY STRING .`  | notice space before `.`                          |\n| \u003ccode\u003eThis is\u003c my string \u0026#124; upper\u003e.\u003c/code\u003e  | `This is MY STRING .`  | notice space before `.`                          |\n| \u003ccode\u003eThis is\u003c my string\u0026#124; upper\u003e.\u003c/code\u003e   | `This is MY STRING.`   | no extra spaces                                  |\n| \u003ccode\u003eThis is \u003cmy string\u0026#124; upper\u003e.\u003c/code\u003e   | `This is MY STRING.`   | no extra spaces (preferred syntax)               |\n\nFunction calls:\n\n| input                                                                                     | output                      |\n|-------------------------------------------------------------------------------------------|-----------------------------|\n| \u003ccode\u003eThis is my \u003c@pickRandom(\\\u003cfirst\u003e, \\\u003csecond\u003e, \\\u003cthird\u003e) \u0026#124; upper\u003e string.\u003c/code\u003e | `This is my SECOND string.` |\n| \u003ccode\u003eThis is my \u003c@pickRandom(\\\u003cfirst\u003e,\\\u003csecond\u003e,\\\u003cthird\u003e) \u0026#124; upper\u003e string.\u003c/code\u003e   | `This is my SECOND string.` |\n| \u003ccode\u003eThis is my \u003c@pickRandom(\\\u003cfirst\u003e,\\\u003csecond\u003e,\\\u003cthird\u003e)\u0026#124; upper\u003e string.\u003c/code\u003e    | `This is my SECOND string.` |\n\nFunction calls must begin with `\u003c@` (no space between `\u003c` and `@`), following syntax WILL NOT work\n\n| input                                                             | output                                 |\n|-------------------------------------------------------------------|----------------------------------------|\n| \u003ccode\u003eThis is \u003c @generateRandomString(\u003c10\u003e) \u0026#124; upper\u003e.\u003c/code\u003e | `This is  @GENERATERANDOMSTRING(10) .` |\n| \u003ccode\u003eThis is \u003c @generateRandomString(\u003c10\u003e)\u0026#124; upper\u003e.\u003c/code\u003e  | `This is @GENERATERANDOMSTRING(10).`   |\n\n\u003c/details\u003e\n\n### Modifiers\n\nModifiers work on function calls and on static strings.\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\nInput\n\n```yaml\n  RAND_UPPER_STRING: \"\u003c@generateRandomString(\u003c50\u003e) | upper\u003e\"\n  STATIC_UPPER_STRING: \"\u003cStatic string that will be turned into upper case| upper\u003e\"\n```\n\nOutput\n\n```yaml\n  RAND_UPPER_STRING: \"OWKFJZJIU74QRHRMXB8GERGCKNYUDQKT6ZUPYUFISPSTYCRRYO\"\n  STATIC_UPPER_STRING: \"STATIC STRING THAT WILL BE TURNED INTO UPPER CASE\"\n```\n\n\u003c/details\u003e\n\n### Nesting\n\nFunction calls and strings with or without modifier may be nested even multiple layers deep.\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\nInput\n\n```yaml\n  NESTED_FUNCTIONS: \"\u003c@generateRandomString(\u003c@generateRandomInt(\u003c10\u003e, \u003c50\u003e)\u003e)\u003e\"\n  NESTED_STRINGS: \"\u003cMy normal \u003cAnd My NeStED| upper\u003e strings\u003e\"\n  NESTED_STRING_MODIFIERS: \"\u003cMy normal \u003cAnd My NeStED| upper\u003e strings| sha256\u003e\"\n  NESTED_STRING_IN_FUNCTION: \"\u003c@setVar(\u003cname\u003e, \u003cnormal string \u003cTHAT IS ALL LOWER CASE| lower\u003e even though middle part was not\u003e)\u003e\"\n  YES_THIS_IS_EXCESSIVE: \"\u003c@setVar(\u003crandomLengthString\u003e, \u003c@generateRandomString(\u003c@generateRandomInt(\u003c@generateRandomInt(\u003c10\u003e, \u003c50\u003e)\u003e, \u003c@generateRandomInt(\u003c51\u003e, \u003c100\u003e)\u003e)\u003e)\u003e) | upper\u003e\"\n```\n\nOutput\n\n```yaml\n  RAND_UPPER_STRING: \"Lzkg38r27rq8xY6Y6VHvbqJ\"\n  NESTED_STRINGS: \"My normal AND MY NESTED strings\"\n  NESTED_STRING_MODIFIERS: \"57193af2e03136a21a6a88aace7a5ec5260689665a46b4eca5074656ac67a949\"\n  NESTED_STRING_IN_FUNCTION: \"normal string that is all lower case even though middle part was not\"\n  YES_THIS_IS_EXCESSIVE: \"FRQKTECZCSUEOCG6AOWJIRPJ2IWD623QZYUNSIJVEQEQH8APCMKJDGHU4MIZKTFGGEED6MGXJADA\"\n```\n\n\u003c/details\u003e\n\n### Escaping\n\nCharacters can be escaped using backslash `\\`. This also means it is mandatory to escape `\\` like so `\\\\` for it to be\nprinted out.\n\n⚠️ One caveat is usage in languages like YAML. If used inside YAML's quoted strings, all backslashes `\\` MUST be escaped\ntwice (`\\\\\\\\` instead of `\\\\`).  \nThis is needed so backslash is preserved through both zParser and YAML parsing (as both remove one `\\`).\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\nInput\n\n```yaml\n  ESCAPED_FUNCTIONS: \"\\\u003c@generateRandomString(\\\u003c@generateRandomInt(\\\u003c10\\\u003e, \\\u003c50\\\u003e)\\\u003e)\\\u003e\"\n  ESCAPED_BACKSLASHES: \"\\\u003c \\\u003c\\\\\\\\ \\\\\\\\\\\\\\\\ \\\\\\\\\\\u003c \u003c\\\\\\\\\u003e \\\\\\\\\\\u003e \\\\\\\\\\\\\\\\ \\\\\\\\\\\u003e \\\u003e\"\n  ESCAPE_TEST_WITH_ITEM: \"\\\\\\\\\u003csTriNG \\\\\\\\ witH, mOdiFiers| title\u003e\\\\\\\\\"\n```\n\nOutput\n\n```yaml\n  ESCAPED_FUNCTIONS: \"\u003c@generateRandomString(\u003c@generateRandomInt(\u003c10\u003e, \u003c50\u003e)\u003e)\u003e\"\n  ESCAPED_BACKSLASHES: \"\u003c \u003c\\\\ \\\\\\\\ \\\\\u003c \\\\ \\\\\u003e \\\\\\\\ \\\\\u003e \u003e\"\n  ESCAPE_TEST_WITH_ITEM: \"\\\\STriNG \\\\ WitH, MOdiFiers\\\\\"\n```\n\nDouble escaping example\n\n```yaml\n  # Here is how following string will look like\n  - \"\\\u003c \\\u003c\\\\\\\\ \\\\\\\\\\\\\\\\ \\\\\\\\\\\u003c \u003c\\\\\\\\\u003e \\\\\\\\\\\u003e \\\\\\\\\\\\\\\\ \\\\\\\\\\\u003e \\\u003e\"\n  # - after our parsing\n  - \"\u003c \u003c\\\\ \\\\\\\\ \\\\\u003c \\\\ \\\\\u003e \\\\\\\\ \\\\\u003e \u003e\"\n  # - after additional yaml parsing\n  - \"\u003c \u003c\\ \\\\ \\\u003c \\ \\\u003e \\\\ \\\u003e \u003e\"\n```\n\n\u003c/details\u003e\n\n## Usage\n\n### As a package\n\n```shell\ngo get git.vsh-labs.cz/zerops/zparser\n```\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/zeropsio/zParser/v2/src/parser\"\n)\n\nfunc main() {\n\tyml, err := os.Open(\"file.yml\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tp := parser.NewParser(yml, os.Stdout, 200)\n\tif err := p.Parse(context.TODO()); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n#### Error handling\n\n`Parse` function returns standard `error` or a [`MetaError`](./src/metaError/errors.go) that contains error string and\nmetadata in `map[string][]string` format\n\nStandard `metaData` fields (always present):\n\n| keyName            | desc                                                         |\n|--------------------|--------------------------------------------------------------|\n| functionCalls      | amount of function calls during parsing                      |\n| functionCallsLimit | max amount of function calls allowed during parsing          |\n| positionColumn     | column which was being parsed when error occurred            |\n| positionLine       | line at which the error occurred                             |\n| positionNear       | last 2 characters that were being parsed when error occurred |\n\nFollowing fields are set only when error occurred during item parsing:\n\n| keyName    | desc                                                              |\n|------------|-------------------------------------------------------------------|\n| item       | name of the processed function or content of the processed string |\n| itemParams | if itemType is function, all parsed params will be in this field  |\n| itemType   | type of the processed item, one of: `string, function`            |\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n```go\nmap[\nfunctionCalls:[66]\nfunctionCallsLimit:[200]\nitem:[mercuryInRetrograde]\nitemParams:[mercury is in retrograde mercury is not in retrograde my third unexpected param]\nitemType:[function]\npositionColumn:[140]\npositionLine:[92]\npositionNear:[e\u003e]\n]\n```\n\nJson formatted\n\n```json\n{\n  \"functionCalls\": [\n    \"66\"\n  ],\n  \"functionCallsLimit\": [\n    \"200\"\n  ],\n  \"item\": [\n    \"mercuryInRetrograde\"\n  ],\n  \"itemParams\": [\n    \"mercury is in retrograde\",\n    \"mercury is not in retrograde\",\n    \"my third unexpected param\"\n  ],\n  \"itemType\": [\n    \"function\"\n  ],\n  \"positionColumn\": [\n    \"140\"\n  ],\n  \"positionLine\": [\n    \"92\"\n  ],\n  \"positionNear\": [\n    \"e\u003e\"\n  ]\n}\n```\n\n\u003c/details\u003e\n\n### As a binary\n\n```shell\n# output to stdOut\n./bin/yamlParser-linux-amd64 ./example.yml\n\n# output to file\n./bin/yamlParser-linux-amd64 ./example.yml -f ./example.parsed.yml\n```\n\n#### Error handling\n\nWhen error occurs, binary returns a formatted error to the output\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n```yaml\n  #...\n  #...\n  MERCURY_RETROGRADE: \"\u003c@mercuryInRetrograde(\u003cmercury is in retrograde\u003e, \u003cmercury is not in retrograde\u003e, \u003cmy third unexpected param\u003e) | title\u003e\"\n  #...\n  #...\n```\n\n```text\nerror: invalid parameter count, 2 expected 3 provided\nfunctionCalls: 66\nfunctionCallsLimit: 200\nitem: mercuryInRetrograde\nitemParams: mercury is in retrograde\n            mercury is not in retrograde\n            my third unexpected param\nitemType: function\npositionColumn: 140\npositionLine: 97\npositionNear: e\u003e\n```\n\n\u003c/details\u003e\n\n## Supported functions\n\n| name                    | description                                                                      | example                                                                |\n|-------------------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------|\n| generateRandomString    | generates random string in requested length                                      | `\u003c@generateRandomString(\u003c50\u003e)\u003e`                                        |\n| generateRandomBytes     | generates requested amount of cryptographically random bytes                     | `\u003c@generateRandomBytes(\u003c50\u003e)\u003e`                                         |\n| generateRandomInt       | generates random integer in range [min, max]                                     | `\u003c@generateRandomInt(\u003c-999\u003e, \u003c999\u003e)\u003e`                                  |\n| pickRandom              | selects one of the provided parameters at random                                 | `\u003c@pickRandom(\u003cone\u003e, \u003ctwo\u003e, \u003cthree\u003e, \u003cfour\u003e)\u003e`                         |\n| generateRandomStringVar | generates random string and stores it for later use                              | `\u003c@generateRandomStringVar(\u003cmyName\u003e, \u003c50\u003e)\u003e`                           |\n| setVar                  | stores provided content for later use                                            | `\u003c@setVar(\u003cmyName\u003e, \u003cmy string content\u003e)\u003e`                             |\n| getVar                  | returns content of a stored variable                                             | `\u003c@getVar(myName)\u003e`                                                    |\n| getDateTime             | returns current date and time in specified format and a timezone                 | `\u003c@getDatetime(\u003cDD.MM.YYYY HH:mm:ss\u003e, \u003cGMT\u003e)\u003e`                         |\n| generateJWT             | Generates JWT signed by `HS256` algorithm using provided secret and payload.     | `\u003c@generateJWT(\u003cmySecretString\u003e, \u003c{\"role\":\"test\",\"exp\":1798761600}\u003e)\u003e` |\n| generateED25519Key      | generates Public and Private ED25519 key pairs and stores them for later use     | `\u003c@generateED25519Key(\u003cmyEd25519Key\u003e)\u003e`                                |\n| generateRSA2048Key      | generates Public and Private RSA 2048bit key pairs and stores them for later use | `\u003c@generateRSA2048Key(\u003cmyRSA2048Key\u003e)\u003e`                                |\n| generateRSA4096Key      | generates Public and Private RSA 4096bit key pairs and stores them for later use | `\u003c@generateRSA4096Key(\u003cmyRSA4096Key\u003e)\u003e`                                |\n| mercuryInRetrograde     | returns first parameter if Mercury IS in retrograde or second if it is not       | `\u003c@mercuryInRetrograde(\u003cYes\u003e, \u003cNo\u003e)\u003e`                                  |\n\n---\n\n### `generateRandomString(length)`\n\nGenerates random string, comprised of `[a-zA-Z0-9_-.]` character set, in requested length\n\u003cdetails\u003e\n\n#### Info\n\nIt is preferred to use `generateRandomBytes` with `toString` modifier: `\u003c@generateRandomBytes(length) | toString\u003e`.\n\n#### Parameters\n\n| name   | type  | description                                        |\n|--------|-------|----------------------------------------------------|\n| length | `int` | required string length (max. allowed value `1024`) |\n\n#### Example\n\n| input                           | output               |\n|---------------------------------|----------------------|\n| `\u003c@generateRandomString(\u003c20\u003e)\u003e` | bc84df942e8290438c21 |\n| `\u003c@generateRandomString(\u003c10\u003e)\u003e` | 94a2f484de           |\n\n\u003c/details\u003e\n\n---\n\n### `generateRandomBytes(length)`\n\nGenerates requested amount of cryptographically random bytes\n\u003cdetails\u003e\n\n#### Parameters\n\n| name   | type  | description                                      |\n|--------|-------|--------------------------------------------------|\n| length | `int` | required byte amount (max. allowed value `1024`) |\n\n#### Example\n\n| input                           | output             |\n|---------------------------------|--------------------|\n| `\u003c@generateRandomBytes(\u003c20\u003e)\u003e`  | �m�r�Fe�Gx�9������ |\n| `\u003c@generateRandomString(\u003c10\u003e)\u003e` | v�A��b�A           |\n\n\u003c/details\u003e\n\n---\n\n### `generateRandomInt(min, max)`\n\nGenerates random `int` in range `[min, max]`\n\u003cdetails\u003e\n\n#### Parameters\n\n| name | type  | description                |\n|------|-------|----------------------------|\n| min  | `int` | minimum number (inclusive) |\n| max  | `int` | maximum number (inclusive) |\n\n#### Example\n\n| input                                 | output |\n|---------------------------------------|--------|\n| `\u003c@generateRandomInt(\u003c-999\u003e, \u003c999\u003e)\u003e` | -155   |\n| `\u003c@generateRandomInt(\u003c0\u003e, \u003c999999\u003e)\u003e` | 6659   |\n\n\u003c/details\u003e\n\n---\n\n### `pickRandom(...param)`\n\nSelects one of the provided parameters at random\n\u003cdetails\u003e\n\n#### Parameters\n\n| name     | type     | description                             |\n|----------|----------|-----------------------------------------|\n| ...param | `string` | multiple parameters to be selected from |\n\n#### Example\n\n| input                                          | output |\n|------------------------------------------------|--------|\n| `\u003c@pickRandom(\u003cone\u003e, \u003ctwo\u003e, \u003cthree\u003e, \u003cfour\u003e)\u003e` | three  |\n| `\u003c@pickRandom(\u003cone\u003e, \u003ctwo\u003e, \u003cthree\u003e, \u003cfour\u003e)\u003e` | one    |\n\n\u003c/details\u003e\n\n---\n\n### `generateRandomStringVar(name, length)`\n\nGenerates random string and stores it for later use (using [`getVar`](#getvarname)) under provided name.\nString is also returned as the output of the function call.\n\nAny content that already existed under provided name is overwritten.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name   | type     | description                                                   |\n|--------|----------|---------------------------------------------------------------|\n| name   | `string` | name under which string may be retrieved later using `getVar` |\n| length | `int`    | required string length (max. allowed value `1024`)            |\n\n#### Example\n\n| input                                                | output                         |\n|------------------------------------------------------|--------------------------------|\n| `\u003c@generateRandomStringVar(\u003cmy20CharString\u003e, \u003c30\u003e)\u003e` | pj72x83UBgccTYfZRj3ytbApYeivq2 |\n| `\u003c@generateRandomStringVar(\u003cmy15CharString\u003e, \u003c15\u003e)\u003e` | yhaKq7gyPoiVhwL                |\n| `\u003c@getVar(my15CharString)\u003e`                          | yhaKq7gyPoiVhwL                |\n\n\u003c/details\u003e\n\n---\n\n### `setVar(name, content)`\n\nStores provided content for later use under provided name.\nString is also returned as the output of the function call.\n\nAny content that already existed under provided name is overwritten.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name    | type     | description                                                   |\n|---------|----------|---------------------------------------------------------------|\n| name    | `string` | name under which string may be retrieved later using `getVar` |\n| content | `string` | content to be stored                                          |\n\n#### Example\n\n| input                                                                | output                              |\n|----------------------------------------------------------------------|-------------------------------------|\n| `\u003c@setVar(\u003cmyFirstString\u003e, \u003ccontent of my first string\u003e)\u003e`           | content of my first string          |\n| `\u003c@setVar(\u003cmySecondString\u003e, \u003ccontent of my second string\u003e)\u003e`         | content of my second string         |\n| `\u003c@setVar(\u003cmySecondString\u003e, \u003cupdated content of my second string\u003e)\u003e` | updated content of my second string |\n| `\u003c@getVar(mySecondString)\u003e`                                          | updated content of my second string |\n\n\u003c/details\u003e\n\n---\n\n### `getVar(name)`\n\nReturns content stored under provided variable (parameter MUST NOT be enclosed in `\u003c` and `\u003e`).\nIf variable is not found, error is returned.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name | type     | description                            |\n|------|----------|----------------------------------------|\n| name | `string` | name under which the content is stored |\n\n#### Example\n\n| input                               | output                                                                   |\n|-------------------------------------|--------------------------------------------------------------------------|\n| `\u003c@getVar(myExistingCustomString)\u003e` | content of my existing custom string                                     |\n| `\u003c@getVar(nonExistingString)\u003e`      | parsing will fail with an error `variable [nonExistingString] not found` |\n\n\u003c/details\u003e\n\n---\n\n### `getDateTime(format, [timezone])`\n\nReturns current date and time in specified format.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name     | type     | description                                                                                                                    |\n|----------|----------|--------------------------------------------------------------------------------------------------------------------------------|\n| format   | `string` | see supported tokens below                                                                                                     |\n| timezone | `string` | timezone in format `UTC`, `GMT`, `Europe/Prague`, `Etc/GMT+2`, `America/Chicago` (optional, if not provided, `UTC` is assumed) |\n\n#### Supported tokens\n\n| Type         | Token | Output                                  |\n|--------------|-------|-----------------------------------------|\n| Year         | YYYY  | 2000, 2001, 2002 … 2012, 2013           |\n|              | YY    | 00, 01, 02 … 12, 13                     |\n| Month        | MMMM  | January, February, March …              |\n|              | MMM   | Jan, Feb, Mar …                         |\n|              | MM    | 01, 02, 03 … 11, 12                     |\n|              | M     | 1, 2, 3 … 11, 12                        |\n| Day of Year  | DDDD  | 001, 002, 003 … 364, 365                |\n| Day of Month | DD    | 01, 02, 03 … 30, 31                     |\n|              | D     | 1, 2, 3 … 30, 31                        |\n| Day of Week  | dddd  | Monday, Tuesday, Wednesday …            |\n|              | ddd   | Mon, Tue, Wed …                         |\n| Hour         | HH    | 00, 01, 02 … 23, 24                     |\n|              | hh    | 01, 02, 03 … 11, 12                     |\n|              | h     | 1, 2, 3 … 11, 12                        |\n| AM / PM      | A     | AM, PM                                  |\n|              | a     | am, pm                                  |\n| Minute       | mm    | 00, 01, 02 … 58, 59                     |\n|              | m     | 0, 1, 2 … 58, 59                        |\n| Second       | ss    | 00, 01, 02 … 58, 59                     |\n|              | s     | 0, 1, 2 … 58, 59                        |\n| Microsecond  | S     | 000000 … 999999                         |\n| Timezone     | ZZZ   | Asia/Baku, Europe/Warsaw, GMT           |\n|              | zz    | -07:00, -06:00 … +06:00, +07:00, +08, Z |\n|              | Z     | -0700, -0600 … +0600, +0700, +08, Z     |\n\n#### Example\n\n| input                                                    | output              |\n|----------------------------------------------------------|---------------------|\n| `\u003c@getDatetime(\u003cDD.MM.YYYY HH:mm:ss\u003e)\u003e`                  | 03.11.2022 12:32:35 |\n| `\u003c@getDatetime(\u003cDD.MM.YYYY HH:mm:ss\u003e, \u003cEurope/Prague\u003e)\u003e` | 03.11.2022 13:32:35 |\n| `\u003c@getDatetime(\u003cDD.MM.YYYY\u003e)\u003e`                           | 03.11.2022          |\n\n\u003c/details\u003e\n\n---\n\n### `generateJWT(tokenSecret, jsonPayload)`\n\nGenerates JWT (JSON Web Token) signed by `HS256` algorithm using provided secret and payload.\n\nPayload MUST be a valid JSON value.\n\nDefault values for `iss` and `iat` are set to `zerops` and current timestamp respectively.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name        | type     | description                            |\n|-------------|----------|----------------------------------------|\n| tokenSecret | `string` | secret used to sign your JWT           |\n| jsonPayload | `string` | payload part of the JWT in JSON format |\n\n#### Example\n\n| input                                                                                                  | output                                                                                                                                                                  |\n|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `\u003c@generateJWT(\u003cfixedSecretString\u003e, \u003c{\"role\":\"test\",\"exp\":1798761600}\u003e)\u003e`                              | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3OTg3NjE2MDAsImlhdCI6MTcyOTA2OTYzMiwiaXNzIjoiemVyb3BzIiwicm9sZSI6InRlc3QifQ.2ba5vp9irnTabfTR1Co8Hd2LY8JfdC473Bb5k7yR-zQ |\n| `\u003c@generateJWT(\u003cfixedSecretString\u003e, \u003c{}\u003e)\u003e`                                                            | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjkwNjk4NTcsImlzcyI6Inplcm9wcyJ9.xPrqHDtGhK5c7WMJliguwBeKI29qzAoD7KXrtACbjio                                           |\n| `\u003c@generateJWT(\u003c@generateRandomStringVar(\u003cjwtSecretKey\u003e, \u003c32\u003e)\u003e, \u003c{\"role\":\"test\",\"exp\":1798761600}\u003e)\u003e` | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3OTg3NjE2MDAsImlhdCI6MTcyOTA2OTYzMiwiaXNzIjoiemVyb3BzIiwicm9sZSI6InRlc3QifQ.ksbck_HQv44YXbqJk6lDrGFYTq3nmLydFIe0Xlejk5Q |\n| `\u003c@generateJWT(\u003c@getVar(jwtSecretKeyVar)\u003e, \u003c{\"role\":\"test\",\"exp\":1798761600}\u003e)\u003e`                       | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3OTg3NjE2MDAsImlhdCI6MTcyOTA2OTYzMiwiaXNzIjoiemVyb3BzIiwicm9sZSI6InRlc3QifQ.O0RaXzGFwj2t8P2kc4nU4PfuI43-dAuAl2d0T1uUlEE |\n\n\u003c/details\u003e\n\n---\n\n### `generateED25519Key(name)`\n\nGenerates Public and Private `ED25519` key pairs and stores them for later use under `name`+`version suffix`.\n\n⚠️ Function produces strings with newline characters and MUST be used with Literal scalar style in YAML.\nSame goes for retrieval of stored key parts except public ssh key which is in one line. See example.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name | type     | description                                                             |\n|------|----------|-------------------------------------------------------------------------|\n| name | `string` | name under which all key versions will be stored (with suffixes bellow) |\n\n#### Generated keys\n\n| suffix     | description                                                     | example                        |\n|------------|-----------------------------------------------------------------|--------------------------------|\n| Public     | public key version, also returned when the method is called     | `\u003c@getVar(keyNamePublic)\u003e`     |\n| PublicSsh  | ssh formatted version used for authorized keys file             | `\u003c@getVar(keyNamePublicSsh)\u003e`  |\n| Private    | private key version in standard format (not usable for OpenSSH) | `\u003c@getVar(keyNamePrivate)\u003e`    |\n| PrivateSsh | private key version in Open SSH format                          | `\u003c@getVar(keyNamePrivateSsh)\u003e` |\n\n#### Example\n\nInput\n\n```yaml\n  MY_PUBLIC_KEY: |\n    \u003c@generateED25519Key(\u003ckeyName\u003e)\u003e\n\n  MY_PUBLIC_SSH_KEY: \"\u003c@getVar(keyNamePublicSsh)\u003e\"\n\n  MY_PRIVATE_KEY: |\n    \u003c@getVar(keyNamePrivate)\u003e\n\n  MY_PRIVATE_SSH_KEY: |\n    \u003c@getVar(keyNamePrivateSsh)\u003e\n```\n\nOutput\n\n```yaml\n  MY_PUBLIC_KEY: |\n    -----BEGIN PUBLIC KEY-----\n    MCowBQYDK2VwAyEA+1xKm4nA/ATJrQm9xX2fZj5PLxyApZURTDmDm5DQ4e0=\n    -----END PUBLIC KEY-----\n\n  MY_PUBLIC_SSH_KEY: \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPtcSpuJwPwEya0JvcV9n2Y+Ty8cgKWVEUw5g5uQ0OHt\"\n\n  MY_PRIVATE_KEY: |\n    -----BEGIN PRIVATE KEY-----\n    MC4CAQAwBQYDK2VwBCIEIP9L2q781HpPRw0vgbiATskBeZNR4s5LXbGFKCm3V6iv\n    -----END PRIVATE KEY-----\n\n  MY_PRIVATE_SSH_KEY: |\n    -----BEGIN OPENSSH PRIVATE KEY-----\n    b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz\n    c2gtZWQyNTUxOQAAACD7XEqbicD8BMmtCb3FfZ9mPk8vHICllRFMOYObkNDh7QAA\n    AIiaywRCmssEQgAAAAtzc2gtZWQyNTUxOQAAACD7XEqbicD8BMmtCb3FfZ9mPk8v\n    HICllRFMOYObkNDh7QAAAED/S9qu/NR6T0cNL4G4gE7JAXmTUeLOS12xhSgpt1eo\n    r/tcSpuJwPwEya0JvcV9n2Y+Ty8cgKWVEUw5g5uQ0OHtAAAAAAECAwQF\n    -----END OPENSSH PRIVATE KEY-----\n```\n\n\u003c/details\u003e\n\n---\n\n### `generateRSA2048Key(name)`\n\nGenerates Public and Private `RSA` `2048bit` key pairs and stores them for later use under `name`+`version suffix`.\n\n⚠️ Function produces strings with newline characters and MUST be used with Literal scalar style in YAML.\nSame goes for retrieval of stored key parts except public ssh key which is in one line. See example.\n\nFor details see [`generateRSA4096Key(name)`](#generatersa4096keyname)\n\n---\n\n### `generateRSA4096Key(name)`\n\nGenerates Public and Private `RSA` `4096bit` key pairs and stores them for later use under `name`+`version suffix`.\n\n⚠️ Function produces strings with newline characters and MUST be used with Literal scalar style in YAML.\nSame goes for retrieval of stored key parts except public ssh key which is in one line. See example.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name | type     | description                                                             |\n|------|----------|-------------------------------------------------------------------------|\n| name | `string` | name under which all key versions will be stored (with suffixes bellow) |\n\n#### Generated keys\n\n| suffix    | description                                                 | example                       |\n|-----------|-------------------------------------------------------------|-------------------------------|\n| Public    | public key version, also returned when the method is called | `\u003c@getVar(keyNamePublic)\u003e`    |\n| PublicSsh | ssh formatted version used for authorized keys file         | `\u003c@getVar(keyNamePublicSsh)\u003e` |\n| Private   | private key version in standard format                      | `\u003c@getVar(keyNamePrivate)\u003e`   |\n\n#### Example\n\nInput\n\n```yaml\n  MY_PUBLIC_KEY: |\n    \u003c@generateED25519Key(\u003ckeyName\u003e)\u003e\n\n  MY_PUBLIC_SSH_KEY: \"\u003c@getVar(keyNamePublicSsh)\u003e\"\n\n  MY_PRIVATE_KEY: |\n    \u003c@getVar(keyNamePrivate)\u003e\n```\n\nOutput (keys are truncated)\n\n```yaml\n  MY_PUBLIC_KEY: |\n    -----BEGIN PUBLIC KEY-----\n    MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEArtYSRy47pzn4891nihMi\n    yf21Pd6qEHuJATbBiFBNm/QHJU7Swt5WQGfyvOiSrV7TgwvjUv9nh3vasgV7uStL\n    IbTJ3ZIQE/YOfNYWMZgEmxZjEcoH+6FRWRRIx6kXPiNfIynQr67F3afudrJ6ioyQ\n    YpOwnyxeBKq7qHCTPUC030gWXQBzLGE+sFxzyXZO/FgQb5EidARL3pqMpKEVRRiv\n    sm/PjVaYa6BvqQWlBXivTb7zBuAYxrZ24WY7Socx73UnaOzXVpXuF+rWROu7f73w\n    5hIVpQi/CY5JnnElWqKJsSfddaeX0tERl+n/TC4Lutr9plITg3wWWLg+QJPlz9Nz\n    IQXzZlc+CfHL1oJ4+hTfhc4zKbi30wg3H+WwMJFYrv1gwL5z9v/cMSzEOqc1cufL\n    OEG7wN/7OKuXO9HbIvzMX3Vmx6N/CWk9NSSjedOYfytkvOBRnkOfU4Nc+PcC4XIc\n    2+JfjokzFe1rpLmYNjz6Am9576xQPqdcS9rK2cLcuw1nC8oFZ6vRmz1CrLdWyV8H\n    ZYqdMV3Qc6DMzDFw8PyI9uirTgIoo5j6sgIAz+DY0S7+ZpdDwUWxBJaDhOrVSt6d\n    rh2jSPSDsmCa/keSU0mNKg/oj5ZBAWaDPM3PoS0Vr40O5KWGULSzzW+DiXDvqf7V\n    YZ/vPEeiaWP4L9rXZBDMA78CAwEAAQ==\n    -----END PUBLIC KEY-----\n\n  MY_PUBLIC_SSH_KEY: \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCu1hJHLjunOfjz3WeKEyLJ/bU93qoQe4kBNsGIUE2b9AclTtLC3lZAZ/....../gv2tdkEMwDvw==\"\n\n  MY_PRIVATE_KEY: |\n    -----BEGIN PRIVATE KEY-----\n    MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCu1hJHLjunOfjz\n    3WeKEyLJ/bU93qoQe4kBNsGIUE2b9AclTtLC3lZAZ/K86JKtXtODC+NS/2eHe9qy\n    BXu5K0shtMndkhAT9g581hYxmASbFmMRygf7oVFZFEjHqRc+I18jKdCvrsXdp+52\n    snqKjJBik7CfLF4EqruocJM9QLTfSBZdAHMsYT6wXHPJdk78WBBvkSJ0BEvemoyk\n    oRVFGK+yb8+NVphroG+pBaUFeK9NvvMG4BjGtnbhZjtKhzHvdSdo7NdWle4X6tZE\n    67t/vfDmEhWlCL8JjkmecSVaoomxJ911p5fS0RGX6f9MLgu62v2mUhODfBZYuD5A\n    k+XP03MhBfNmVz4J8cvWgnj6FN+FzjMpuLfTCDcf5bAwkViu/WDAvnP2/9wxLMQ6\n    pzVy58s4QbvA3/s4q5c70dsi/MxfdWbHo38JaT01JKN505h/K2S84FGeQ59Tg1z4\n    9wLhchzb4l+OiTMV7WukuZg2PPoCb3nvrFA+p1xL2srZwty7DWcLygVnq9GbPUKs\n    t1bJXwdlip0xXdBzoMzMMXDw/Ij26KtOAiijmPqyAgDP4NjRLv5ml0PBRbEEloOE\n    ......\n    qGNempfsElD4BbAtxwko8NqeTANjBiE=\n    -----END PRIVATE KEY-----\n\n```\n\n\u003c/details\u003e\n\n###\n\n\u003cdetails\u003e\n\u003csummary\u003e🥚\u003c/summary\u003e\n\n### `mercuryInRetrograde(contentIfYes, contentIfNo)`\n\nReturns first parameter if Mercury IS in retrograde or second if it is not.\n\u003cdetails\u003e\n\n#### Parameters\n\n| name         | type     | description                                            |\n|--------------|----------|--------------------------------------------------------|\n| contentIfYes | `string` | content to be returned if Mercury IS in retrograde     |\n| contentIfNo  | `string` | content to be returned if Mercury IS NOT in retrograde |\n\n#### Example\n\n| input                                 | output |\n|---------------------------------------|--------|\n| `\u003c@mercuryInRetrograde(\u003cYes\u003e, \u003cNo\u003e)\u003e` | No     |\n\n\u003c/details\u003e\n\u003c/details\u003e\n\n---\n\n## Supported modifiers\n\n| name     | description                                                             |\n|----------|-------------------------------------------------------------------------|\n| sha256   | hashes string using sha256 algorithm                                    |\n| sha512   | hashes string using sha512 algorithm                                    |\n| bcrypt   | hashes string using bcrypt algorithm                                    |\n| argon2id | hashes string using argon2id algorithm                                  |\n| toHex    | encodes provided string/bytes into hexadecimal                          |\n| toString | encodes provided string/bytes into string comprised of `[a-zA-Z0-9_-.]` |\n| upper    | maps all unicode letters to their upper case                            |\n| lower    | maps all unicode letters to their lower case                            |\n| title    | maps all words to title case (first letter upper case, rest lower case) |\n| noop     | does nothing - used in tests                                            |\n\n### Examples\n\n| input                                                     | output                                                                                                                           |\n|-----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| `\u003c@generateRandomStringVar(\u003cmyPassword\u003e, \u003c30\u003e)\u003e`          | 7a14c8e74bc98a0d74253b1d1a4ef6                                                                                                   |\n| \u003ccode\u003e\u003c@getVar(myPassword) \u0026#124; sha256\u003e\u003c/code\u003e          | 081b91d6dff5036229a92e2442fb65d7c8124571d4e70a2ac4729aeb86957407                                                                 |\n| \u003ccode\u003e\u003c@getVar(myPassword) \u0026#124; sha512\u003e\u003c/code\u003e          | 89c05547de0aa4926512a958f95ab8bf4096ceec63ad5aad4266890bfa059e0cc98917c54276ba4cd61f1dde4c8efda948fc967885c9dd50558ed939722ca10c |\n| \u003ccode\u003e\u003c@getVar(myPassword) \u0026#124; bcrypt\u003e\u003c/code\u003e          | $2a$10$CxKZX0yIxdc7ts6eI5aBu.g.heAsFcePdMDEpnlViTlo3vGc//PXe                                                                     |\n| \u003ccode\u003e\u003c@getVar(myPassword) \u0026#124; argon2id\u003e\u003c/code\u003e        | $argon2id$v=19$m=98304,t=1,p=3$uWBpmoUT3sfckXHyRF9hlg$8bGtNffuHxaRIgN99zCmJeGEYJF5BY2J9TwzqmezP28                                |\n| \u003ccode\u003e\u003c@generateRandomBytes(\u003c20\u003e) \u0026#124; toHex\u003e\u003c/code\u003e    | 830e5694b3844f47f805c91956bc80ba728ca804                                                                                         |\n| \u003ccode\u003e\u003c@generateRandomBytes(\u003c20\u003e) \u0026#124; toString\u003e\u003c/code\u003e | Yf_mG3hj9BGWL3GisrPN                                                                                                             |\n| \u003ccode\u003e\u003csTATic StrINg wiTH a mOdifIER\u0026#124; upper\u003e\u003c/code\u003e  | STATIC STRING WITH A MODIFIER                                                                                                    |\n| \u003ccode\u003e\u003csTATic StrINg wiTH a mOdifIER\u0026#124; lower\u003e\u003c/code\u003e  | static string with a modifier                                                                                                    |\n| \u003ccode\u003e\u003csTATic StrINg wiTH a mOdifIER\u0026#124; title\u003e\u003c/code\u003e  | Static String With A Modifier                                                                                                    |\n| \u003ccode\u003e\u003csTATic StrINg wiTH a mOdifIER\u0026#124; noop\u003e\u003c/code\u003e   | sTATic StrINg wiTH a mOdifIER                                                                                                    |\n\n### Bcrypt configuration\n\n- cost: `11`\n\n### Argon2id configuration\n\n- memory: `64MiB`\n- iterations: `4`\n- parallelism: `4`\n- saltLen: `16B`\n- keyLength: `32B`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeropsio%2Fzparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeropsio%2Fzparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeropsio%2Fzparser/lists"}