Skip to content

Commit

Permalink
minor adjustments for go check
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeUrban committed Jan 24, 2023
1 parent 8ccbe3d commit 2ee1c58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions exp/services/webauth/internal/serve/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func (h tokenHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

l.Info("Start verifying challenge transaction.")

var muxedAccount xdr.MuxedAccount
if muxedAccount, err = xdr.AddressToMuxedAccount(clientAccountID); err == nil {
muxedAccount, err := xdr.AddressToMuxedAccount(clientAccountID)
if err == nil {
clientAccountID = muxedAccount.ToAccountId().Address()
}

Expand Down
6 changes: 4 additions & 2 deletions txnbuild/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,8 @@ func BuildChallengeTx(serverSignerSecret, clientAccountID, webAuthDomain, homeDo
return nil, errors.New("memos are not valid for challenge transactions with a muxed client account")
}
} else if memo != nil {
if xdrMemo, err := memo.ToXDR(); err != nil || xdrMemo.Type != xdr.MemoTypeMemoId {
var xdrMemo xdr.Memo
if xdrMemo, err = memo.ToXDR(); err != nil || xdrMemo.Type != xdr.MemoTypeMemoId {
return nil, errors.New("memo must be of type MemoID")
}
}
Expand Down Expand Up @@ -1182,7 +1183,8 @@ func ReadChallengeTx(challengeTx, serverAccountID, network, webAuthDomain string
err = errors.New("memos are not valid for challenge transactions with a muxed client account")
return tx, clientAccountID, matchedHomeDomain, memo, err
} else if rawOperations[0].SourceAccount.Type == xdr.CryptoKeyTypeKeyTypeEd25519 && memo != nil {
if rawMemo, err := memo.ToXDR(); err != nil || rawMemo.Type != xdr.MemoTypeMemoId {
var rawMemo xdr.Memo
if rawMemo, err = memo.ToXDR(); err != nil || rawMemo.Type != xdr.MemoTypeMemoId {
err = errors.New("invalid memo, only ID memos are permitted")
return tx, clientAccountID, matchedHomeDomain, memo, err
}
Expand Down

0 comments on commit 2ee1c58

Please sign in to comment.