Skip to content

Commit

Permalink
Merge pull request #174 from shawakash/go2
Browse files Browse the repository at this point in the history
feat: add user authentication from jwt using jose in mote
  • Loading branch information
shawakash authored Mar 6, 2024
2 parents f407474 + e89381b commit 4aa3bd2
Show file tree
Hide file tree
Showing 18 changed files with 440 additions and 64 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,21 @@ jobs:

- name: Push @paybox/ws Docker image
run: docker push shawakash/paybox-ws:${{ github.sha }}

mote_image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build @paybox/mote Docker image
run: docker build -t shawakash/paybox-mote:${{ github.sha }} -f ./docker/mote/Dockerfile .

- name: Push @paybox/mote Docker image
run: docker push shawakash/paybox-mote:${{ github.sha }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
table:
name: account
schema: public
object_relationships:
- name: bitcoin
using:
foreign_key_constraint_on:
column: accountId
table:
name: bitcoin
schema: public
- name: client
using:
foreign_key_constraint_on: clientId
- name: eth
using:
foreign_key_constraint_on:
column: accountId
table:
name: eth
schema: public
- name: sol
using:
foreign_key_constraint_on:
column: accountId
table:
name: sol
schema: public
- name: wallet
using:
foreign_key_constraint_on: walletId
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
table:
name: address
schema: public
object_relationships:
- name: client
using:
foreign_key_constraint_on: client_id
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
table:
name: bitcoin
schema: public
object_relationships:
- name: account
using:
foreign_key_constraint_on: accountId
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
table:
name: client
schema: public
object_relationships:
- name: address
using:
foreign_key_constraint_on:
column: client_id
table:
name: address
schema: public
array_relationships:
- name: accounts
using:
foreign_key_constraint_on:
column: clientId
table:
name: account
schema: public
- name: transactions
using:
foreign_key_constraint_on:
column: clientId
table:
name: transactions
schema: public
- name: wallets
using:
foreign_key_constraint_on:
column: clientId
table:
name: wallet
schema: public
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
table:
name: eth
schema: public
object_relationships:
- name: account
using:
foreign_key_constraint_on: accountId
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
table:
name: sol
schema: public
object_relationships:
- name: account
using:
foreign_key_constraint_on: accountId
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
table:
name: transactions
schema: public
object_relationships:
- name: client
using:
foreign_key_constraint_on: clientId
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
table:
name: wallet
schema: public
object_relationships:
- name: client
using:
foreign_key_constraint_on: clientId
array_relationships:
- name: accounts
using:
foreign_key_constraint_on:
column: walletId
table:
name: account
schema: public
6 changes: 5 additions & 1 deletion backend/mote/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ SEPOLIA_URL=
INFURA_PROJECT_ID=
SEPOLIA_URL_HTTP=https://sepolia.infura.io/v3/
REDIS_SECRET=
REDIS_URL=redis://localhost:6379
REDIS_URL=redis://localhost:6379
BTC_RPC_USER=""
BTC_RPC_PASS=""
BTC_RPC_HOST=""
BTC_RPC_PORT=""
31 changes: 19 additions & 12 deletions backend/mote/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
module mote

go 1.20
go 1.21

toolchain go1.22.0

require (
github.com/ethereum/go-ethereum v1.13.14
github.com/gagliardetto/binary v0.7.9
github.com/gagliardetto/solana-go v1.8.4
github.com/go-playground/validator/v10 v10.19.0
github.com/gorilla/mux v1.8.1
github.com/joho/godotenv v1.5.1
)

require (
contrib.go.opencensus.io/exporter/stackdriver v0.13.14 // indirect
Expand All @@ -13,7 +24,7 @@ require (
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/blocto/solana-go-sdk v1.27.0 // indirect
github.com/btcsuite/btcd v0.24.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
Expand All @@ -25,28 +36,24 @@ require (
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dfuse-io/logging v0.0.0-20201110202154-26697de88c79 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/ethereum/go-ethereum v1.13.14 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gagliardetto/binary v0.7.9 // indirect
github.com/gagliardetto/solana-go v1.8.4 // indirect
github.com/gagliardetto/treeout v0.1.4 // indirect
github.com/go-jose/go-jose/v4 v4.0.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/rpc v1.2.0 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
Expand Down Expand Up @@ -74,13 +81,13 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/ratelimit v0.3.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.15.0 // indirect
Expand Down
14 changes: 14 additions & 0 deletions backend/mote/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.1.3 h1:xM/n3yIhHAhHy04z4i43C8p4ehixJZMsnrVJ
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8=
Expand Down Expand Up @@ -126,8 +128,12 @@ github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6
github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/dfuse-io/logging v0.0.0-20201110202154-26697de88c79 h1:+HRtcJejUYA/2rnyTMbOaZ4g7f4aVuFduTV/03dbpLY=
github.com/dfuse-io/logging v0.0.0-20201110202154-26697de88c79/go.mod h1:V+ED4kT/t/lKtH99JQmKIb0v9WL3VaYkJ36CfHlVECI=
Expand Down Expand Up @@ -165,6 +171,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jose/go-jose/v4 v4.0.0 h1:gHOVQyfrqsagdy/Yj9PTz5HMYzr3UpYh1CcFpktmRoY=
github.com/go-jose/go-jose/v4 v4.0.0/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
Expand Down Expand Up @@ -236,6 +244,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk=
github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
Expand Down Expand Up @@ -497,6 +507,8 @@ golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -632,6 +644,8 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
77 changes: 52 additions & 25 deletions backend/mote/src/config/config.go
Original file line number Diff line number Diff line change
@@ -1,46 +1,73 @@
package config

import (
"github.com/joho/godotenv"
"log"
"os"

"github.com/go-jose/go-jose/v4"
"github.com/joho/godotenv"
)

var (
SEPOLIA_URL = ""
INFURA_PROJECT_ID = ""
SEPOLIA_URL_HTTP = "https://sepolia.infura.io/v3/"
REDIS_SECRET = ""
REDIS_URL = "redis://localhost:6379"
INFURA_SEPOLIA_URL = ""
SEPOLIA_URL = ""
INFURA_PROJECT_ID = ""
SEPOLIA_URL_HTTP = "https://sepolia.infura.io/v3/"
REDIS_SECRET = ""
REDIS_URL = "redis://localhost:6379"
INFURA_SEPOLIA_URL = ""
BTC_RPC_USER = "user"
BTC_RPC_PASS = "pass"
BTC_RPC_HOST = "localhost:8332"
BTC_RPC_PORT = "8332"
BTC_POST_MODE = true
JWT_ALG = jose.RS256
AUTH_JWT_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqx+7XJxJR+0Lp8hLFKYr5Gc+0RPIdaZJ18GH8b//oMn7PCVe0gLQDkxjvhKo2ySMgWSOSGaNJkZXLhN4jlot/xaulN3dSbrgQPxvx3ALd3nXJaTLOb7xBODd196r+Ylg1QPICdrBQVi6qAXacq/UBK8K7BWQ0TG2/R9aB5mNSGtY3Ogj9xp2MP5LTi7f2Alj6IwSFRN+9SCmH3NiQzNUPBWJB02Lgx1oxwtfevkQ3BpwIqzkOTTE1G7PXgKbYRBUlUNqwvMIjk89tRf/qHgMbRPGYYNu7XoRt8AOVgNFUcL51Gb9vM75XstWoAh6BwYQsceEXUU7dgIJem9zItFRdwIDAQAB-----END PUBLIC KEY-----"
AUTH_JWT_PRIVATE_KEY = "-----BEGIN PRIVATE KEY-----MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCrH7tcnElH7QunyEsUpivkZz7RE8h1pknXwYfxv/+gyfs8JV7SAtAOTGO+EqjbJIyBZI5IZo0mRlcuE3iOWi3/Fq6U3d1JuuBA/G/HcAt3edclpMs5vvEE4N3X3qv5iWDVA8gJ2sFBWLqoBdpyr9QErwrsFZDRMbb9H1oHmY1Ia1jc6CP3GnYw/ktOLt/YCWPojBIVE371IKYfc2JDM1Q8FYkHTYuDHWjHC196+RDcGnAirOQ5NMTUbs9eApthEFSVQ2rC8wiOTz21F/+oeAxtE8Zhg27tehG3wA5WA0VRwvnUZv28zvley1agCHoHBhCxx4RdRTt2Agl6b3Mi0VF3AgMBAAECggEAMom1kN1LOyXDynJ50ghdcCAZyi+YhT5uEn1Cg+AbQ8ZDH3k97rIL9h0TXAAwxD+gC1rCNpmq2AHwH1h6wzfY27w8JRT9FJhPQIINFQ5/JHLkWma36j78+V7bxbQqgBDVezOZsWdcqcrlnVfVMwfAiv2TMTQRR+bxzwGiWho8QoWNq1UcA8GGOE3vzWGrZJbgVwG43xUVDJtMem9w4QwlHLwekP3Q46Lqx1AOtesN39h/HduJtWtYGcw/t2TkIW9UibmBqZy7rkZW+4hCXhGBI6YhAUYnuyP6ZT+r1+J2aPlJeo2yIyjc6YVxoFwUR7QWtINzuBtG9v/YXfmtYCnEIQKBgQDd3E/nX4Vc7xolvoQZzN+0XWnyLqPgtAL63RLFfb8/lhnHHzca2k2eI0+P6I9etDa9c+i4l7/RM5LUkwxd8RGH6S4m8FiUkdKyaiwK1PAGRiUbWaij9WjKVjp7QhEtisQvtyMa9quwpv3C02zbD31/PqgeTmXOH0Aweh162qyeBwKBgQDFdMQ13JCkQe3GNO06EEPE+NjFkLqBVP2leDXmUVZRnHUN4OMpjCb9H0+/4rOAusCRmS9kALoeo6U9ykC5mqUViVzeTqnHXctD4llvEzSngDU/4+cbUQG3obj8JG9lupe/p3r6gRvB13nWiwVzj2wgK2SY0HGG1gaRaIS3K2nVEQKBgQCNhlJ6V9as9+GIHkYKZ0R0u/ovgU0MtAgKmye0T4jGOSvsd58hRAyrSf8g38tFMFSS+fOEfVjhTLLnY35KFtOGDVthf4QiEfuD0HKT3k3W0rws/D61iID2QZdAtV5b3N9VSM/eDWhsYboSo+gWvYTivMdlvcD3gbvisKNJkWD31QKBgCdgIqSPCHUJBK6K7WevyKPl7+xt8RNLbI1rzGvSeoEpzxnmZ8ZoQXomnVOplJwuIaqnPpEVqAfmIFSTGZcppJQH4XIfg7HTHW67G5SP4ucoJPZJr1N+MvZ4lJgLd/90V0CL2HVN+8gK/SvwazThO/GqVZQ3tPvrgEHM8vJIAQHRAoGAEjFMNmitScLogo9Cq5oX88/KpDOfCi+IG19g0HdaepgzreDzallcKf/XnXX9d7wuTuoSRNsq7RfCmLAUlzC+Waw0dpwLkZjgeVvFdrADGOFDKEovesZ0NBQ+Ln0SXJVRaynRxgnrjYINE+1I3uE8XZie4NMh5pybTXBpyx/cIz0=-----END PRIVATE KEY-----"
)

const (
CLIENT_URL = "http://localhost:3000"
PORT = 8085
PORT = 8085
)


func init() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}

if ENV_SEPOLIA_URL := os.Getenv("SEPOLIA_URL"); ENV_SEPOLIA_URL != "" {
SEPOLIA_URL = ENV_SEPOLIA_URL
}
if ENV_INFURA_PROJECT_ID := os.Getenv("INFURA_PROJECT_ID"); ENV_INFURA_PROJECT_ID != "" {
INFURA_PROJECT_ID = ENV_INFURA_PROJECT_ID
}
if ENV_SEPOLIA_URL_HTTP := os.Getenv("SEPOLIA_URL_HTTP"); ENV_SEPOLIA_URL_HTTP != "" {
SEPOLIA_URL_HTTP = ENV_SEPOLIA_URL_HTTP
INFURA_SEPOLIA_URL = SEPOLIA_URL_HTTP + INFURA_PROJECT_ID
}
if ENV_REDIS_SECRET := os.Getenv("REDIS_SECRET"); ENV_REDIS_SECRET != "" {
REDIS_SECRET = ENV_REDIS_SECRET
}
if ENV_REDIS_URL := os.Getenv("REDIS_URL"); ENV_REDIS_URL != "" {
REDIS_URL = ENV_REDIS_URL
}
if ENV_SEPOLIA_URL := os.Getenv("SEPOLIA_URL"); ENV_SEPOLIA_URL != "" {
SEPOLIA_URL = ENV_SEPOLIA_URL
}
if ENV_INFURA_PROJECT_ID := os.Getenv("INFURA_PROJECT_ID"); ENV_INFURA_PROJECT_ID != "" {
INFURA_PROJECT_ID = ENV_INFURA_PROJECT_ID
}
if ENV_SEPOLIA_URL_HTTP := os.Getenv("SEPOLIA_URL_HTTP"); ENV_SEPOLIA_URL_HTTP != "" {
SEPOLIA_URL_HTTP = ENV_SEPOLIA_URL_HTTP
INFURA_SEPOLIA_URL = SEPOLIA_URL_HTTP + INFURA_PROJECT_ID
}
if ENV_REDIS_SECRET := os.Getenv("REDIS_SECRET"); ENV_REDIS_SECRET != "" {
REDIS_SECRET = ENV_REDIS_SECRET
}
if ENV_REDIS_URL := os.Getenv("REDIS_URL"); ENV_REDIS_URL != "" {
REDIS_URL = ENV_REDIS_URL
}
if ENV_BTC_RPC_USER := os.Getenv("BTC_RPC_USER"); ENV_BTC_RPC_USER != "" {
BTC_RPC_USER = ENV_BTC_RPC_USER
}
if ENV_BTC_RPC_PASS := os.Getenv("BTC_RPC_PASS"); ENV_BTC_RPC_PASS != "" {
BTC_RPC_PASS = ENV_BTC_RPC_PASS
}
if ENV_BTC_RPC_HOST := os.Getenv("BTC_RPC_HOST"); ENV_BTC_RPC_HOST != "" {
BTC_RPC_HOST = ENV_BTC_RPC_HOST
}
if ENV_BTC_RPC_PORT := os.Getenv("BTC_RPC_PORT"); ENV_BTC_RPC_PORT != "" {
BTC_RPC_PORT = ENV_BTC_RPC_PORT
}
if ENV_AUTH_JWT_PUBLIC_KEY := os.Getenv("AUTH_JWT_PUBLIC_KEY"); ENV_AUTH_JWT_PUBLIC_KEY != "" {
AUTH_JWT_PUBLIC_KEY = ENV_AUTH_JWT_PUBLIC_KEY
}
if ENV_AUTH_JWT_PRIVATE_KEY := os.Getenv("AUTH_JWT_PRIVATE_KEY"); ENV_AUTH_JWT_PRIVATE_KEY != "" {
AUTH_JWT_PRIVATE_KEY = ENV_AUTH_JWT_PRIVATE_KEY
}
}
2 changes: 1 addition & 1 deletion backend/mote/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func main() {

// Routers
txnRouter := app.PathPrefix("/txn").Subrouter()

// txnRouter.Use(middle.ExtractClientId)
txnRouter.HandleFunc("/send", routes.SignHandler).Methods("POST")
txnRouter.HandleFunc("/", routes.GetTransactionHandler).Methods("GET")

Expand Down
Loading

0 comments on commit 4aa3bd2

Please sign in to comment.