aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
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