https://github.com/solrac97gr/crypto-api-fiber
Project create for encrypt information using random strings and a Cache system 🛡️
https://github.com/solrac97gr/crypto-api-fiber
cryptography firebase glang go
Last synced: about 2 months ago
JSON representation
Project create for encrypt information using random strings and a Cache system 🛡️
- Host: GitHub
- URL: https://github.com/solrac97gr/crypto-api-fiber
- Owner: solrac97gr
- Created: 2021-05-20T19:00:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-21T17:23:00.000Z (about 5 years ago)
- Last Synced: 2026-03-28T03:43:57.087Z (3 months ago)
- Topics: cryptography, firebase, glang, go
- Language: Go
- Homepage:
- Size: 67.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# START GUIDE
- Create a new firebase project from [firebase console](https://console.firebase.google.com/u/0/)
- Initialize a new Free Database, Must be in the **Realtime database service**
- Claim your Firebase credentials (Settings>Services Accounts> Go > Create New Credentials) and replace it in the serviceAccountKey.example.go
- Rename the file as serviceAccountKey.go
- In the same file replace your DB Url
- Execute Docker docker-compose -f docker-compose.yml up
- Access to the API from http://localhost:8080
The nex you will see it's a docker instance with 5 replicas of the API this will help for improve the performance in the Encrypt process
**How I solve the different tasks:**
- For save the logs in the Database I use a middleware for save the request before all the software execute the endpoint, very important for debug if you wanna determinate the complete error path.
- For cache system I use a simple Library permit me store the data as a "localstorage" and I create a logic for the number of times the key is saved
- Work with the Async call to a external API, I use for that a Package to Simulate the Async/Await behavior of other languages
- I decide use firebase because the facility for deploy and maintain
- Also I decided use Docker not only for make the deploy more easy, even for increase the performance implementing a load balancer with 5 replicas, every replica can make part of the request send it to the principal server **(Important: That means every Api will have a independent key and a independent counter, but every key will be only used 3 times until the expiration)**
**Your database will looks like this:**
```
{
"log" : {
"-MaCG3sW9Q4nXOdHHjjP" : {
"Method" : "POST",
"URL" : "/v1/encrypt"
},
"-MaCGFCaJriPjOVWCOpw" : {
"Method" : "GET",
"URL" : "/v1/decrypt/-MaCG4-7Ngf9tfEDqcKf"
},
},
"text" : {
"-MaCG4-7Ngf9tfEDqcKf" : {
"EncryptedText" : "2c1b47f08f09d55eb0f167783f4f885ddff746eb44fd8d67e245ee4377e1510da8ddd4ed5ada4e9528d16164a310e2da997fbcc24ae2ce48542de5758f763b7ecec1e9ab3bc771a800f4f56542cfa1fa5856df9b4b6643ce0917",
"EncryptionKey" : "25c0aca4-0a0d-44c4-a573-946f2cbdab75"
},
}
}
```