Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Use checksum address for identicon (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
chikeichan authored Sep 21, 2018
1 parent db77ae4 commit e7ecdf6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/identicon/identicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"encoding/base64"
"fmt"
"github.com/dchest/siphash"
"github.com/kyokan/clef-ui/internal/utils"
"hash"
"image"
"image/color"
Expand Down Expand Up @@ -135,9 +136,13 @@ func (icon *identicon) Render(data []byte) []byte {
var renderer = New7x7([]byte("0x4b594f4b414e20495320415745534f4d45"))
var identicons = make(map[string]string)

func ToBase64Img(address string) (b string) {
cached := identicons[address]
func ToBase64Img(ad string) (b string) {
address, err := clefutils.ToChecksumAddress(ad)
if err != nil {
return ""
}

cached := identicons[address]
if len(cached) > 0 {
return cached
}
Expand Down

0 comments on commit e7ecdf6

Please sign in to comment.