diff options
author | zelig <viktor.tron@gmail.com> | 2015-01-18 16:03:39 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-02-06 07:00:34 +0800 |
commit | 88167f39a6437e282ff75a6ec30e8081d6d50441 (patch) | |
tree | 2d9e361a02cbd81509485bfe790468c2ed9e372c /p2p/client_identity.go | |
parent | c8a8aa0d43336491f6aa264467968e06b489d34c (diff) | |
download | go-tangerine-88167f39a6437e282ff75a6ec30e8081d6d50441.tar.gz go-tangerine-88167f39a6437e282ff75a6ec30e8081d6d50441.tar.zst go-tangerine-88167f39a6437e282ff75a6ec30e8081d6d50441.zip |
add privkey to clientIdentity + tests
Diffstat (limited to 'p2p/client_identity.go')
-rw-r--r-- | p2p/client_identity.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/p2p/client_identity.go b/p2p/client_identity.go index f15fd01bf..fca2756bd 100644 --- a/p2p/client_identity.go +++ b/p2p/client_identity.go @@ -7,8 +7,9 @@ import ( // ClientIdentity represents the identity of a peer. type ClientIdentity interface { - String() string // human readable identity - Pubkey() []byte // 512-bit public key + String() string // human readable identity + Pubkey() []byte // 512-bit public key + PrivKey() []byte // 512-bit private key } type SimpleClientIdentity struct { @@ -17,10 +18,11 @@ type SimpleClientIdentity struct { customIdentifier string os string implementation string + privkey []byte pubkey []byte } -func NewSimpleClientIdentity(clientIdentifier string, version string, customIdentifier string, pubkey []byte) *SimpleClientIdentity { +func NewSimpleClientIdentity(clientIdentifier string, version string, customIdentifier string, privkey []byte, pubkey []byte) *SimpleClientIdentity { clientIdentity := &SimpleClientIdentity{ clientIdentifier: clientIdentifier, version: version, @@ -28,6 +30,7 @@ func NewSimpleClientIdentity(clientIdentifier string, version string, customIden os: runtime.GOOS, implementation: runtime.Version(), pubkey: pubkey, + privkey: privkey, } return clientIdentity @@ -50,8 +53,12 @@ func (c *SimpleClientIdentity) String() string { c.implementation) } +func (c *SimpleClientIdentity) Privkey() []byte { + return c.privkey +} + func (c *SimpleClientIdentity) Pubkey() []byte { - return []byte(c.pubkey) + return c.pubkey } func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string) { |