Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harshsinghvi/golang-fido2-passkeys-api
Password less FIDO2 Passkey API in golang, Passwordless future
https://github.com/harshsinghvi/golang-fido2-passkeys-api
api authentication fido2 gin golang gorm password-less-authentication
Last synced: 28 days ago
JSON representation
Password less FIDO2 Passkey API in golang, Passwordless future
- Host: GitHub
- URL: https://github.com/harshsinghvi/golang-fido2-passkeys-api
- Owner: harshsinghvi
- License: gpl-3.0
- Created: 2023-11-27T16:18:31.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-03-14T22:16:35.000Z (8 months ago)
- Last Synced: 2024-10-21T18:13:38.081Z (30 days ago)
- Topics: api, authentication, fido2, gin, golang, gorm, password-less-authentication
- Language: Go
- Homepage: https://fido2-passkey.onrender.com
- Size: 4.33 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# golang2-fido-passkeys-api
> Passwordless FIDO Passkey API in golang, Passwordless future
- - ChatGPT Prompts
- - Postman Collection## Deployment
- elasticemail.com
- render.com
- supabase.com## Documentation to be updated soon
- WIP: Documentation
## Usecases
- CLI Apps suthentication like ssh
- Mobile based passkeys (Passwordless authentication)## CLI Usage
```bash
go install github.com/harshsinghvi/golang-fido2-passkeys-api/cli # install locally after cloning
go install github.com/harshsinghvi/golang-fido2-passkeys-api/cli@latest # install directlycli decrypt -c challenge-string # manually decrypt challenge string and solve manually too
cli sign -m challenge-solution # sign the challenge solutioncli gen # generate RSA keys
cli register -n "User fullname" -e "user email" --server-url http://localhost:8080 # register user with previously generated rsa keys and verify challenge
cli register-new-key -e email -d description --server-url http://localhost:8080 # add key to user account
cli login --server-url http://localhost:8080 # login user using stored keys
cli logout # Business logic
cli get-me # Business logic
```this creates `$HOME/.FIDO2` Folder with rsa keys and config.yml file
you can import or export keys in this folder- passkey.pem - private key
- passkey.pub - public key
- config.yml - config file (not to be edited)## Build Multi Arch Binary for CLI and Server
- `./go-executable-build.bash github.com/harshsinghvi/golang-fido2-passkeys-api`
- reference script:
- go supported arch and os## TODO
- Add Event Status to all postEvent occurances, (failed / success)
- check public key encoding
- async logging
- orgs- error handeling
- rate limit
- user preferneces
- check BillingDisable- Workflow for releasing binaries
- token roles
- clean code in `cli` and `crypto` library- make new repos for cli and `autoroutes` routes
UI
- admin portal
- org login
- WIP: Documentation### TEST DB
#### -- make changes in this
```sql
CREATE DATABASE test_db_savepoint;
```#### create test db from savepoint
```sql
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE pg_stat_activity.datname in ('test_db_savepoint' ,'test_db') AND pid <> pg_backend_pid();CREATE DATABASE test_db WITH TEMPLATE test_db_savepoint OWNER postgres;
```#### reset to savepoint
```sql
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity
WHERE pg_stat_activity.datname in ('test_db_savepoint' ,'test_db') AND pid <> pg_backend_pid();
DROP DATABASE test_db;
CREATE DATABASE test_db WITH TEMPLATE test_db_savepoint OWNER postgres;
```#### hard delete
```sql
DELETE FROM access_logs WHERE deleted_at IS NOT NULL;
DELETE FROM access_tokens WHERE deleted_at IS NOT NULL;
DELETE FROM challenges WHERE deleted_at IS NOT NULL;
DELETE FROM events WHERE deleted_at IS NOT NULL;
DELETE FROM passkeys WHERE deleted_at IS NOT NULL;
DELETE FROM users WHERE deleted_at IS NOT NULL;
DELETE FROM verifications WHERE deleted_at IS NOT NULL;
```#### hard delete All
```sql
DELETE FROM access_logs;
DELETE FROM access_tokens;
DELETE FROM challenges;
DELETE FROM events;
DELETE FROM passkeys;
DELETE FROM users;
DELETE FROM verifications;
```#### Drop All tables
```sql
DROP TABLE access_logs;
DROP TABLE access_tokens;
DROP TABLE challenges;
DROP TABLE events;
DROP TABLE passkeys;
DROP TABLE users;
DROP TABLE verifications;
```