aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'account.go')
-rw-r--r--account.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/account.go b/account.go
index 33f4e12..c0f76a1 100644
--- a/account.go
+++ b/account.go
@@ -14,15 +14,23 @@ const KeySize = 2048
// Account ...
type Account struct {
- Contact []string `json:"contact"`
+ Contact []Contact `json:"contact"`
PrivKey *rsa.PrivateKey `json:"key"`
signer jose.Signer
nonce chan string
}
+func newMail(email string) (Mail, error) {
+ m, err := mail.ParseAddress(email)
+ if err != nil {
+ return "", err
+ }
+ return Mail(m.Address), nil
+}
+
// NewAccount ...
func NewAccount(email string, bits int) (*Account, error) {
- m, err := mail.ParseAddress(email)
+ m, err := newMail(email)
if err != nil {
return nil, err
}
@@ -31,7 +39,7 @@ func NewAccount(email string, bits int) (*Account, error) {
return nil, err
}
return &Account{
- Contact: []string{"mailto:" + m.Address},
+ Contact: []Contact{m},
PrivKey: key,
}, nil
}