mirror of
https://github.com/mainnika/a-quest.git
synced 2026-05-23 16:23:36 +00:00
use keys from an ignored package
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package keys
|
||||
|
||||
var (
|
||||
PublicKey = []byte(`-----BEGIN PUBLIC KEY-----
|
||||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqtyaUimtphsWdH6aRxsFMi/TXkff
|
||||
lpM2JTy7A94ut9Gk2HhOF05hiJuwFQQUN78WNhauZnbU1lLWPKP5lJbZ7Q==
|
||||
-----END PUBLIC KEY-----`)
|
||||
PrivateKey = []byte(`-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEILLczON2Ou3TVZGzNZfNiP5XZCRALoPGLCoHe3m3jFQhoAoGCCqGSM49
|
||||
AwEHoUQDQgAEqtyaUimtphsWdH6aRxsFMi/TXkfflpM2JTy7A94ut9Gk2HhOF05h
|
||||
iJuwFQQUN78WNhauZnbU1lLWPKP5lJbZ7Q==
|
||||
-----END EC PRIVATE KEY-----`)
|
||||
Alg = `ES256`
|
||||
Answer = []byte(`9834876dcfb05cb167a5c24953eba58c4ac89b1adf57f28f2f9d09af107ee8f0`)
|
||||
)
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"github.com/mainnika/a-quest/keys"
|
||||
"github.com/mainnika/a-quest/task1-backend/lib"
|
||||
. "github.com/mainnika/a-quest/task1-backend/lib/configure"
|
||||
. "github.com/mainnika/a-quest/task1-backend/lib/env"
|
||||
@@ -63,22 +64,22 @@ func main() {
|
||||
log.Debugf("version: %s", version)
|
||||
log.Debugf("cfg: %v", Config)
|
||||
|
||||
pubKey, err := jwtgo.ParseECPublicKeyFromPEM(publicKey)
|
||||
pubKey, err := jwtgo.ParseECPublicKeyFromPEM(keys.PublicKey)
|
||||
if err != nil {
|
||||
log.Fatalf("can not parse jwt key: %s", err)
|
||||
}
|
||||
|
||||
privKey, err := jwtgo.ParseECPrivateKeyFromPEM(privateKey)
|
||||
privKey, err := jwtgo.ParseECPrivateKeyFromPEM(keys.PrivateKey)
|
||||
if err != nil {
|
||||
log.Fatalf("can not parse jwt key: %s", err)
|
||||
}
|
||||
|
||||
apiserv := &lib.Api{
|
||||
Base: Config.HttpAPI.Base,
|
||||
Alg: alg,
|
||||
Pub: pubKey,
|
||||
Priv: privKey,
|
||||
Answer: answer,
|
||||
Alg: keys.Alg,
|
||||
Answer: keys.Answer,
|
||||
}
|
||||
|
||||
httpStart(apiserv)
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"github.com/mainnika/a-quest/keys"
|
||||
"github.com/mainnika/a-quest/task2-backend/lib"
|
||||
. "github.com/mainnika/a-quest/task2-backend/lib/configure"
|
||||
. "github.com/mainnika/a-quest/task2-backend/lib/env"
|
||||
@@ -70,19 +71,19 @@ func main() {
|
||||
DB: 0, // use default DB
|
||||
})
|
||||
|
||||
pubKey, err := jwtgo.ParseECPublicKeyFromPEM(publicKey)
|
||||
pubKey, err := jwtgo.ParseECPublicKeyFromPEM(keys.PublicKey)
|
||||
if err != nil {
|
||||
log.Fatalf("can not parse jwt key: %s", err)
|
||||
}
|
||||
|
||||
privKey, err := jwtgo.ParseECPrivateKeyFromPEM(privateKey)
|
||||
privKey, err := jwtgo.ParseECPrivateKeyFromPEM(keys.PrivateKey)
|
||||
if err != nil {
|
||||
log.Fatalf("can not parse jwt key: %s", err)
|
||||
}
|
||||
|
||||
apiserv := &lib.Api{
|
||||
Base: Config.HttpAPI.Base,
|
||||
Alg: alg,
|
||||
Alg: keys.Alg,
|
||||
Pub: pubKey,
|
||||
Priv: privKey,
|
||||
ScoresKey: Config.Redis.ScoreKey,
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"github.com/mainnika/a-quest/keys"
|
||||
"github.com/mainnika/a-quest/task3-backend/lib"
|
||||
. "github.com/mainnika/a-quest/task3-backend/lib/configure"
|
||||
. "github.com/mainnika/a-quest/task3-backend/lib/env"
|
||||
@@ -92,12 +93,12 @@ func main() {
|
||||
log.Fatalf("can not init docklient: %s", err)
|
||||
}
|
||||
|
||||
pubKey, err := jwtgo.ParseECPublicKeyFromPEM(publicKey)
|
||||
pubKey, err := jwtgo.ParseECPublicKeyFromPEM(keys.PublicKey)
|
||||
if err != nil {
|
||||
log.Fatalf("can not parse jwt key: %s", err)
|
||||
}
|
||||
|
||||
privKey, err := jwtgo.ParseECPrivateKeyFromPEM(privateKey)
|
||||
privKey, err := jwtgo.ParseECPrivateKeyFromPEM(keys.PrivateKey)
|
||||
if err != nil {
|
||||
log.Fatalf("can not parse jwt key: %s", err)
|
||||
}
|
||||
@@ -109,7 +110,7 @@ func main() {
|
||||
}
|
||||
|
||||
taskserv := &lib.Server{
|
||||
Alg: alg,
|
||||
Alg: keys.Alg,
|
||||
Pub: pubKey,
|
||||
Priv: privKey,
|
||||
Docker: docklient,
|
||||
|
||||
Reference in New Issue
Block a user