diff options
Diffstat (limited to 'swarm/storage/mru/resource_sign.go')
-rw-r--r-- | swarm/storage/mru/resource_sign.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/swarm/storage/mru/resource_sign.go b/swarm/storage/mru/resource_sign.go index a9f7cb629..58196f10e 100644 --- a/swarm/storage/mru/resource_sign.go +++ b/swarm/storage/mru/resource_sign.go @@ -60,7 +60,16 @@ func (s *GenericSigner) Sign(data common.Hash) (signature Signature, err error) return } -// PublicKey returns the public key of the signer's private key +// Address returns the public key of the signer's private key func (s *GenericSigner) Address() common.Address { return s.address } + +// getUserAddr extracts the address of the resource update signer +func getUserAddr(digest common.Hash, signature Signature) (common.Address, error) { + pub, err := crypto.SigToPub(digest.Bytes(), signature[:]) + if err != nil { + return common.Address{}, err + } + return crypto.PubkeyToAddress(*pub), nil +} |