aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-21 16:42:06 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-21 16:42:06 +0100
commit352e343f51a7a923f50b275f188d82e08d8fa318 (patch)
tree5780c7506f02245f6c2108231e1dadf628f28518 /account.go
parentacb9c5d087924b77d83a3fc65813c19b65e90298 (diff)
Agree to TOS
Diffstat (limited to 'account.go')
-rw-r--r--account.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/account.go b/account.go
index e3a0392..e0d24b0 100644
--- a/account.go
+++ b/account.go
@@ -35,20 +35,22 @@ func newPhone(phone string) (Phone, error) {
}
// NewAccount ...
-func NewAccount(email, phone string, key *rsa.PrivateKey) (*Account, error) {
- var c Contacts
- m, err := newMail(email)
- if err != nil {
- return nil, err
+func NewAccount(key *rsa.PrivateKey) (*Account, error) {
+ return &Account{PrivKey: key}, nil
+}
+
+func (a *Account) AddMail(mail string) error {
+ if m, _ := newMail(mail); m != "" {
+ a.Contact = append(a.Contact, m)
}
- c = append(c, m)
+ return nil
+}
+
+func (a *Account) AddPhone(phone string) error {
if ph, _ := newPhone(phone); ph != "" {
- c = append(c, ph)
+ a.Contact = append(a.Contact, ph)
}
- return &Account{
- Contact: c,
- PrivKey: key,
- }, nil
+ return nil
}
// Signer describes a signing interface