{"id":23175930,"url":"https://github.com/pintu544/encrypted-timeseries","last_synced_at":"2026-05-05T15:31:52.407Z","repository":{"id":232899884,"uuid":"716849112","full_name":"pintu544/encrypted-timeseries","owner":"pintu544","description":"A small backend application which can generate and emit an encrypted data stream over a socket, listens to incoming data stream on a socket, decrypts and decodes it, saved to a time series db and then emit the saved data to a small frontend app.","archived":false,"fork":false,"pushed_at":"2023-11-10T02:08:53.000Z","size":342,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T01:25:00.530Z","etag":null,"topics":["nodejs","reactjs","socket-io"],"latest_commit_sha":null,"homepage":"https://encryptedtimeseries.netlify.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pintu544.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-11-10T02:08:42.000Z","updated_at":"2023-11-10T02:11:54.000Z","dependencies_parsed_at":"2024-04-12T06:29:10.949Z","dependency_job_id":null,"html_url":"https://github.com/pintu544/encrypted-timeseries","commit_stats":null,"previous_names":["pintu544/encrypted-timeseries"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pintu544/encrypted-timeseries","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pintu544%2Fencrypted-timeseries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pintu544%2Fencrypted-timeseries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pintu544%2Fencrypted-timeseries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pintu544%2Fencrypted-timeseries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pintu544","download_url":"https://codeload.github.com/pintu544/encrypted-timeseries/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pintu544%2Fencrypted-timeseries/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262047900,"owners_count":23250444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["nodejs","reactjs","socket-io"],"created_at":"2024-12-18T06:10:35.638Z","updated_at":"2026-05-05T15:31:52.371Z","avatar_url":"https://github.com/pintu544.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### encrypted-timeseries\n\u003ch1\u003eLive Hosted Url\u003c/h1\u003e\n\n\u003cp\u003e\u003ca href=\"https://encryptedtimeseries.netlify.app/\"\u003eencryptedtimeseries\u003c/a\u003e\u003c/p\u003e\n### Problem Statement\n\nMake a small backend application which can generate and emit an encrypted data stream over a socket, listens to incoming data stream on a socket, decrypts and decodes it, save to a time series db and then emit the saved data to a small frontend app. Backend services can be in any language (Node JS is preferred, but use Go or any other that you are comfortable with).\n\n\n## Emitter service\nThis service should generate a periodic data stream of encrypted messages where the number of encrypted strings can be anywhere between 49-499 so randomise this to good effect.\n\nEach message should contain an object with 3 keys: `name, origin, destination` and a `secret_key` which is a hash of these 3 fields. randomize the values for `name, origin, destination` from a constant list provided in `data.json` file\n\n```\nexmaple\n\noriginalMessage = {\n  name: 'Jack Reacher',\n  origin: 'Bengaluru',\n  destination: 'Mumbai'\n}\n\nadd a secret_key by creating a sha-256 hash of the above object\n\nsumCheckMessage = {\n  name: 'Jack Reacher',\n  origin: 'Bengaluru',\n  destination: 'Mumbai',\n  secret_key: \"sha-256 ash of originalMessage\",\n}\n\nencrypt this payload using encryption algorithm `aes-256-ctr` with a pass key\n\nencryptedMessage = \"encrypted message string\"\n```\n\nthe data stream is long string of `|` separated encrypted messages and can look like this\n\n\"e84742dedd1ddc924e5bfe9a5d912a1918e217f98e5578d04fd5c12426022240|4bbf088f4fc646d7a65b1f84172a59f665a09beb226368ff53d46a5edfd75dc6|3743c3ff07694a3e5540dfc14d57dcfdd6868439f9b5b83162be9162d8032999|26ccd3d082227c49907af7d3e4f19aec764f73d20b73ca4337df818b68cf6975|8d5c45f45be31d657dd58ae4e2c8222f61a779ad11fe36da7b00511ac2b5c01a|e97451a0c72d4202915f6c43b48bc4c0a500851e4c71b66b51b3a588e6522316|99624125591ebecb2c4e34695bf8d1e8a36b73087fd0c8e6c4fad087fa244d5c|b70ed78f5befa9c64ecd9ddcb64f18868ba86debf6b833ce440bcb772be3171c|a9bec91a127fb7b76a462fadeac5090b8dc753841f1fd54ac758f4cdb9af5fc0|2c345c51005cd0b0df92b089dba17e82e321725f539b1cdfceebd6eab69c336a\"\n\nThe emitter service should connect to the listener service over sockets and periodically send out a new message stream every 10s\n\n## Listener Service\n\nThe Listener service will allow an emitter to connect to it via sockets. On receipt of the encrypted message stream, the listener should decrypt this string and retrieve the data in the payload. Validate the objects using the secret_key to ensure data integrity. If the data integrity of any object is compromised then discard that operation and move on to the next in the queue.\n\nOn successful object data integrity validation, add a timestamp to that object and save it to a mongoDB collection modelled for saving time-series data where each document should be corresponding to the minute in which it is received. e.g. for data received for a person between 14:00 to 14:01 all records are added in a single document as a timeseries. Design the schema is such a manner to allow for optimal performance for aggregation timeseries queries.\n\n## Frontend\n\nAll the valid data saved should be displayed in a real-time manner on a small frontend app along with the success rate for data transmission and decoding\n\n### How will the assignment be evaluated?\n- Functionality: Is the app functional and performant?\n- Code Quality: Code Readability and structuring.\n- Exception Handling: No crashes and proper error messages logged.\n- Git Commit practices: Manage your code in github and make frequent commits.\n- Bonus consideration will be given if tests are also written.\n- Bonus for Dockerising the apps\n\n### Submission\nShare the github repository and hosted app link with a readme on how to run the code. If you have any other doubts, get in touch with us\n\n\n# Solution\n\n**client.js** - forms and send random number of encrypted message over spefic interval of time\n![image](https://user-images.githubusercontent.com/22377758/128535408-73389842-4402-43fa-bdf5-52decb1604c9.png)\n\n**server.js** - listens the incoming message, decrypt it and forms the batch of data every mintue.\n\n\n**db.js** - inserts the data in time-series optimized collection\n\n\n**util.js** - contains the helper function\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpintu544%2Fencrypted-timeseries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpintu544%2Fencrypted-timeseries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpintu544%2Fencrypted-timeseries/lists"}