aboutsummaryrefslogtreecommitdiff
path: root/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'account.go')
-rw-r--r--account.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/account.go b/account.go
index 62f1c78..46cc88c 100644
--- a/account.go
+++ b/account.go
@@ -4,6 +4,7 @@ import (
"crypto"
"crypto/rsa"
"encoding/base64"
+ "encoding/json"
"io"
"strings"
@@ -31,7 +32,7 @@ func NewAccount(key *rsa.PrivateKey) (*Account, error) {
// Signer describes a signing interface
type Signer interface {
- Sign([]byte, jose.NonceSource) (io.Reader, error)
+ Sign(interface{}, jose.NonceSource) (io.Reader, error)
}
type Thumber interface {
@@ -44,7 +45,11 @@ type ThumbSigner interface {
}
// Sign implements Signer interface
-func (a *Account) Sign(msg []byte, n jose.NonceSource) (io.Reader, error) {
+func (a *Account) Sign(v interface{}, n jose.NonceSource) (io.Reader, error) {
+ msg, err := json.Marshal(v)
+ if err != nil {
+ return nil, err
+ }
a.signer.SetNonceSource(n)
obj, err := a.signer.Sign(msg)
if err != nil {