{"id":19190106,"url":"https://github.com/brucify/cola","last_synced_at":"2025-02-23T03:46:32.110Z","repository":{"id":247983321,"uuid":"357250201","full_name":"brucify/cola","owner":"brucify","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-11T20:42:01.000Z","size":837,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-04T06:29:59.545Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brucify.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-04-12T15:43:44.000Z","updated_at":"2024-07-11T14:57:35.000Z","dependencies_parsed_at":"2024-07-11T18:37:50.239Z","dependency_job_id":null,"html_url":"https://github.com/brucify/cola","commit_stats":null,"previous_names":["brucify/cola"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Fcola","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Fcola/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Fcola/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brucify%2Fcola/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brucify","download_url":"https://codeload.github.com/brucify/cola/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240266856,"owners_count":19774075,"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":[],"created_at":"2024-11-09T11:32:58.003Z","updated_at":"2025-02-23T03:46:32.067Z","avatar_url":"https://github.com/brucify.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"cola\n=====\n\nAn Erlang application based on cowboy http server\n\nBuild\n-----\n\n    $ rebar3 compile\n\nRunning\n-----\n\n    $ rebar3 shell\n\n\nRunning eunit tests\n-----\n\n    $ rebar3 eunit\n\n\nRunning integration tests\n-----\n\n    $ rebar3 ct\n\n\nThe app will be running at https://localhost:8443 as configured in `config/dev/sys.config`. \n\nThe Swagger UI will be served at https://localhost:8443/api-docs/. \n\nTesting against localhost using the curl scripts in `scripts`:\n\n    HOST=https://localhost:8443 ./post_bookings_coke | jq\n    HOST=https://localhost:8443 ID=fa293f3f-8fca-478e-b718-159ff669d85f ./get_bookings_id_coke | jq\n    HOST=https://localhost:8443 ID=fa293f3f-8fca-478e-b718-159ff669d85f ./get_bookings_id_proof_coke | jq\n    HOST=https://localhost:8443 ./post_bookings_merkle_coke | jq\n    HOST=https://localhost:8443 ./post_bookings_merkle_verify_coke | jq\n    HOST=https://localhost:8443 ID=fa293f3f-8fca-478e-b718-159ff669d85f ./delete_bookings_id_coke | jq\n\nSwitching between public and private mode:\n\n    1\u003e cola_worker_permission:public_mode().\n    ok\n    2\u003e cola_worker_permission:current_mode().\n    public\n    3\u003e cola_worker_permission:reset().\n    ok\n    4\u003e cola_worker_permission:current_mode().\n    private\n\nUsage\n-----\n\n```bash\n$ HOST=https://localhost:8443 ./get_rooms_coke | jq\n\u003c HTTP/2 200\n[\n  {\n    \"occupied\": [\n      {\n        \"start_time\": \"2021-04-10T17:24:31Z\",\n        \"end_time\": \"2021-04-10T18:24:31Z\"\n      }\n    ],\n    \"name\": \"C01\"\n  },\n  {\n    \"occupied\": [],\n    \"name\": \"C02\"\n  },\n  {\n    \"occupied\": [],\n    \"name\": \"C03\"\n  },\n  ...\n]\n\n$ HOST=https://localhost:8443 ./post_bookings_coke | jq\n\u003c HTTP/2 200\n{\n  \"start_time\": \"2021-04-10T17:24:31Z\",\n  \"signature\": \"MEYCIQCX3Y639yIcrOHcz2flAOzJJQJBgqGZFQGLBEpTXZFXsgIhANSm52RejFqRIl3C9RSknqiQ/VT5dKwgri7gv5myvGgF\",\n  \"room\": \"C01\",\n  \"hash_value\": \"Crku/YArhTvwybz1MI7RJWpr63uJT8iYYOmUu29CkUk=\",\n  \"end_time\": \"2021-04-10T18:24:31Z\",\n  \"created\": true,\n  \"booking_id\": \"6570b42c-3783-4521-9c71-059aa33f57ad\"\n}\n\n$ HOST=https://localhost:8443 ID=6570b42c-3783-4521-9c71-059aa33f57ad ./get_bookings_id_coke | jq\n\u003c HTTP/2 200\n{\n  \"start_time\": \"2021-04-10T17:24:31Z\",\n  \"signature\": \"MEYCIQCWnblvZkWRukti51uphD1+bklqAGcCyY9Pi84MTZOwGgIhAIXbLe8/FASWvk8G5DevwTWSTkYAdYREnAJI2Ma/1Evk\",\n  \"room\": \"C01\",\n  \"hash_value\": \"Crku/YArhTvwybz1MI7RJWpr63uJT8iYYOmUu29CkUk=\",\n  \"end_time\": \"2021-04-10T18:24:31Z\",\n  \"booking_id\": \"6570b42c-3783-4521-9c71-059aa33f57ad\"\n}\n\n$ HOST=https://localhost:8443 ID=6570b42c-3783-4521-9c71-059aa33f57ad ./get_bookings_id_pepsi | jq\n\u003c HTTP/2 404\n        \nHOST=https://localhost:8443 ./post_merkle_coke  | jq\n\u003c HTTP/2 200 \n{\n  \"root_hash\": \"OOs7xC8o7f+QCNL+4ZO1paCgMs7p6kY1lH4FEunmTug=\"\n}\n\nHOST=https://localhost:8443 ID=6570b42c-3783-4521-9c71-059aa33f57ad ./get_bookings_id_proof_coke | jq\n\u003c HTTP/2 200\n{\n  \"proof\": \"g2wAAAABaAJkAAVyaWdodG0AAAAgGqIkxqYIql1TX08L/LL/V4CLF1EpAgu7s4QuN6FAKHNq\"\n}\n\nHOST=https://localhost:8443 ./post_merkle_verify_coke  | jq\n\u003c HTTP/2 200\n{\n  \"result\": true\n}\n\n$ HOST=https://localhost:8443 ID=6570b42c-3783-4521-9c71-059aa33f57ad ./delete_bookings_id_coke | jq\n\u003c HTTP/2 200\n{\n  \"result\": true\n}\n\n```\n\nCertificates\n-----\n\nGenerate and self-sign server certificate (RSA). This is used for hosting over HTTPS:\n\n    $ openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.crt -nodes -days 365 -subj \"/CN=localhost/O=Client\\ Certificate\\ Demo\"\n\nGenerate and client certificates (RSA) and sign using server's public key. These are used for sending the HTTP request: \n\n    $ openssl req -newkey rsa:2048 -keyout coke.key -out coke.csr\n    $ openssl req -newkey rsa:2048 -keyout pepsi.key -out pepsi.csr\n    $ openssl x509 -req -CA server.crt -CAkey server.key -in coke.csr -out coke.crt -set_serial 02 -days 365\n    $ openssl x509 -req -CA server.crt -CAkey server.key -in pepsi.csr -out pepsi.crt -set_serial 02 -days 365\n\nWrap client certificates in PKCS12 to be used in browsers:\n\n    $ openssl pkcs12 -export -clcerts -in coke.crt -inkey coke.key -out coke.p12\n    $ openssl pkcs12 -export -clcerts -in pepsi.crt -inkey pepsi.key -out pepsi.p12\n\nServer's EC key, used to issue ECDSA signature:\n\n    $ openssl ecparam -genkey -name secp256r1 -noout -out server_ec.key\n    $ openssl ec -in server_ec.key -pubout -out server_ec.pub\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucify%2Fcola","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrucify%2Fcola","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucify%2Fcola/lists"}