From c52f850743c08dbbc4b7b724877cfe94b893d465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Cidre?= Date: Fri, 8 Jun 2018 17:33:24 +0200 Subject: [PATCH] Fix login overriden address --- account.go | 13 +++++++------ chan.go | 2 +- sdk.go | 7 ++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/account.go b/account.go index 18fc7c6..96e93e0 100644 --- a/account.go +++ b/account.go @@ -6,12 +6,13 @@ import ( // Account represents a logged in user on statusd node type Account struct { - conn *SDK - Address string - PubKey string - Mnemonic string - Username string - channels []*Channel + conn *SDK + Address string + AddressKeyID string + PubKey string + Mnemonic string + Username string + channels []*Channel } // JoinPublicChannel joins a status public channel diff --git a/chan.go b/chan.go index dcc60e7..0c844a5 100644 --- a/chan.go +++ b/chan.go @@ -117,7 +117,7 @@ func (c *Channel) ContactUpdateRequest(username, image string) error { // SendPostRawMsg sends a shh_post message with the given body. func (c *Channel) SendPostRawMsg(body string) error { msg := Message{ - Signature: c.account.Address, + Signature: c.account.AddressKeyID, SymKeyID: c.ChannelKey, Payload: rawrChatMessage(body), Topic: c.TopicID, diff --git a/sdk.go b/sdk.go index b5b91b3..be328b4 100644 --- a/sdk.go +++ b/sdk.go @@ -26,14 +26,15 @@ func (c *SDK) Login(addr, pwd string) (a *Account, err error) { return a, err } return &Account{ - conn: c, - Address: res.AddressKeyID, + conn: c, + AddressKeyID: res.AddressKeyID, }, err } // Signup creates a new account with the given credentials func (c *SDK) Signup(pwd string) (a *Account, err error) { res, err := statusSignupRequest(c, pwd) + if err != nil { return a, err } @@ -53,7 +54,7 @@ func (c *SDK) SignupAndLogin(password string) (a *Account, err error) { return } la, err := c.Login(a.Address, password) - a.Address = la.Address + a.AddressKeyID = la.AddressKeyID return }