Skip to content

Commit

Permalink
Temporarily disable checking phone hash commitments (ethereum#345)
Browse files Browse the repository at this point in the history
* Temporarily disable checking phone hash commitments
  • Loading branch information
marekolszewski authored Jul 14, 2019
1 parent 49724b8 commit 56f21be
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions abe/abe.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
// "errors"
"fmt"
"net/http"
"regexp"
Expand All @@ -29,7 +29,7 @@ import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
// "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
)

Expand All @@ -40,9 +40,10 @@ func decryptPhoneNumber(request types.AttestationRequest, account accounts.Accou
}
// TODO(asa): Better validation of phone numbers
r, _ := regexp.Compile(`^\+[0-9]{8,15}$`)
if !bytes.Equal(crypto.Keccak256(phoneNumber), request.PhoneHash.Bytes()) {
return string(phoneNumber), errors.New("Phone hash doesn't match decrypted phone number")
} else if !r.MatchString(string(phoneNumber)) {
// if !bytes.Equal(crypto.Keccak256(phoneNumber), request.PhoneHash.Bytes()) {
// return string(phoneNumber), errors.New("Phone hash doesn't match decrypted phone number")
//} else
if !r.MatchString(string(phoneNumber)) {
return string(phoneNumber), fmt.Errorf("Decrypted phone number invalid: %s", string(phoneNumber))
}
return string(phoneNumber), nil
Expand Down

0 comments on commit 56f21be

Please sign in to comment.