Generate keypairs
gpg --full-generate-key
# use any email, i used [email protected], passphrase=123456
$ gpg --output public.pgp --armor --export [email protected]
$ gpg --output private.pgp --armor --export-secret-key [email protected]
package main | |
import ( | |
"encoding/base64" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"go.dedis.ch/kyber/v3/pairing/bn256" |
package main | |
import ( | |
"encoding/base64" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"go.dedis.ch/kyber/v4/encrypt/ecies" |
Generate keypairs
gpg --full-generate-key
# use any email, i used [email protected], passphrase=123456
$ gpg --output public.pgp --armor --export [email protected]
$ gpg --output private.pgp --armor --export-secret-key [email protected]
package main | |
import ( | |
"net/http" | |
"database/sql" | |
"fmt" | |
"log" | |
"os" | |
) |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
This demonstrates how to make client side certificates with go | |
First generate the certificates with | |
./makecert.sh [email protected] | |
Run the server in one terminal | |
go run server.go |
import ( | |
... | |
rc "firebase-authentication-with-react-and-go/backend/router/context" | |
m "firebase-authentication-with-react-and-go/backend/router/middleware" | |
) | |
func main() { | |
// ... | |
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ |
package middleware | |
import ( | |
"context" | |
"net/http" | |
"strings" | |
firebase "firebase.google.com/go" | |
"github.com/labstack/echo" |
package middleware | |
import ( | |
"context" | |
"net/http" | |
"strings" | |
firebase "firebase.google.com/go" | |
"github.com/labstack/echo" |