Skip to content

Commit

Permalink
Fix nonce/pubkey api (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
orkunkl authored Apr 7, 2020
1 parent b1c6a85 commit 8d3d079
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/bnsapi/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handlers

import (
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/iov-one/bns/cmd/bnsapi/models"
Expand Down Expand Up @@ -670,7 +671,12 @@ type NoncePubKeyHandler struct {
// @Router /account/nonce/pubkey/{pubKey} [get]
func (h *NoncePubKeyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
pubKeyStr := LastChunk(r.URL.Path)
pubKey := weavecrypto.PublicKey_Ed25519{Ed25519: []byte(pubKeyStr)}
hexKey, err := hex.DecodeString(pubKeyStr)
if err != nil {
JSONErr(w, http.StatusBadRequest, "please provide a hex public key")
return
}
pubKey := weavecrypto.PublicKey_Ed25519{Ed25519: hexKey}
addr := pubKey.Condition().Address()

var userData sigs.UserData
Expand Down

0 comments on commit 8d3d079

Please sign in to comment.