Skip to content

Instantly share code, notes, and snippets.

@jayant-yadav
Last active March 3, 2017 17:55
Show Gist options
  • Save jayant-yadav/1a36183b12162936a60e0ce80a64630c to your computer and use it in GitHub Desktop.
Save jayant-yadav/1a36183b12162936a60e0ce80a64630c to your computer and use it in GitHub Desktop.
Objective: Make Js script that can replicate the way ordering is done in Golang JSON.
We need to do this because we need to preserve the order in Js Json so that the Mig action string can be encoded in js the same
it is done in Golang. Since we need to verify thr actions in Golabg using PGP signature, which willbe done by Mig agent.
refer: https://golang.org/src/encoding/json/encode.go | find "map" , line 137
step2: find an example which of an action being converted to golang Json to userstand the how "map" is working.
Drop this shit!
New Idea:
1. Make a Golang script.
2. send the operation parameters to it (POST).
3. The API endpoint will serialize it for me in string. This would require the knowledge of various modules. So, we
are implementing for "file" and "netstat" initial.
4. return the Stringified object to JS.
5. sign the object and convert it into JSON.
6. send it to Mig agent via action/create API endpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment