Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yigitsadic/onetimecode
This project saves given identifier in memory and gives back random 7 character string. Can be used as user identifier.
https://github.com/yigitsadic/onetimecode
Last synced: about 1 month ago
JSON representation
This project saves given identifier in memory and gives back random 7 character string. Can be used as user identifier.
- Host: GitHub
- URL: https://github.com/yigitsadic/onetimecode
- Owner: yigitsadic
- Created: 2020-08-11T16:38:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-27T15:55:08.000Z (over 4 years ago)
- Last Synced: 2024-06-19T15:04:18.871Z (7 months ago)
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Onetimecodego
This project, designed for mapping random strings to given identifiers. For example with given identifier `c96e40ed-1a06-427b-9c2d-a85ebea7d9e8`
is mapped to random **x** length of string (*HPI05VM*) for **y** seconds.Application does not handle any authentication nor authorization and it's designed for single instance use only.
Generated codes stores in memory, because of that, any time service is down, your codes will go down.
## Configuration
Application configurable through environment variables.
```
CODE_EXP = 60
```## Grpc
Example client can be found in **client.go**
```protobuf
syntax = "proto3";
package otcgo;option go_package = "grpc;grpc";
message OneTimeCodeGen {
string identifier = 1;
}message ReadCodeReq {
string value = 1;
}message OneTimeCodeResponse {
string identifier = 1;
int64 expiresAt = 2;
string value = 3;
}service OneTimeCodeService {
rpc CreateCode(OneTimeCodeGen) returns (OneTimeCodeResponse) {}
rpc ReadCode(ReadCodeReq) returns (OneTimeCodeResponse) {}
}
```## Docker
You can run ` docker run --rm -e CODE_EXP=5 -p 9000:9000 yigitsadic/onetimecodego:latest`
For client: `go run client.go`