Fixed message ed25519 usage
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-06-12 02:15:08 +02:00
parent 2830b4f879
commit b0522a8abc
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
2 changed files with 3 additions and 4 deletions

2
api.go
View file

@ -1,7 +1,7 @@
package dns_api
import (
"crypto/ed25519"
"git.gammaspectra.live/givna.me/dns-api/ed25519"
"net/http"
"time"
)

View file

@ -2,10 +2,10 @@ package dns_api
import (
"bytes"
"crypto/ed25519"
"encoding/hex"
"errors"
"fmt"
"git.gammaspectra.live/givna.me/dns-api/ed25519"
"net/url"
"sort"
"strconv"
@ -57,8 +57,7 @@ func CreateSignatureMessage(method string, host string, requestUrl *url.URL, pri
return nil, err
}
publicKey := make([]byte, ed25519.PublicKeySize)
copy(publicKey, privateKey[ed25519.PublicKeySize:])
publicKey := privateKey.Public().(ed25519.PublicKey)
newRequestUrl.Query().Set(KeyPublicKey, hex.EncodeToString(publicKey))
newRequestUrl.Query().Set(KeyExpiration, strconv.FormatInt(expirationTime.UTC().Unix(), 10))