aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-10 14:17:23 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-10 14:17:23 +0100
commit32215b65656e77c2064fd0f0318bbc30ca96ce29 (patch)
tree10b58e34b0806a48eb6ca4c6aa3bc5dcd2986dec /account.go
parent180dda5b51fafcc972ece0f4cfedc25a615e3ecb (diff)
WIP
Diffstat (limited to 'account.go')
-rw-r--r--account.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/account.go b/account.go
index a74f2d0..33f4e12 100644
--- a/account.go
+++ b/account.go
@@ -12,6 +12,7 @@ import (
// KeySize is a default RSA key size
const KeySize = 2048
+// Account ...
type Account struct {
Contact []string `json:"contact"`
PrivKey *rsa.PrivateKey `json:"key"`
@@ -19,6 +20,7 @@ type Account struct {
nonce chan string
}
+// NewAccount ...
func NewAccount(email string, bits int) (*Account, error) {
m, err := mail.ParseAddress(email)
if err != nil {
@@ -38,6 +40,11 @@ func LoadAccount(email string) (*Account, error) {
return nil, nil
}
+// Signer describes a signing interface
+type Signer interface {
+ Sign([]byte, jose.NonceSource) ([]byte, error)
+}
+
func (a *Account) Sign(msg []byte, n jose.NonceSource) ([]byte, error) {
if a.signer == nil {
var err error