aboutsummaryrefslogtreecommitdiff
path: root/type.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-10-23 13:15:34 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-10-23 13:15:34 +0200
commit10046171a4205667adddf90211fe4c7eb61b90b3 (patch)
treefd4876fed157193e6d11df704ffc7b65e618fb77 /type.go
parent04393e4e38586854ac2846b97ef61941e6d4a39a (diff)
refactored add-entry code path
Diffstat (limited to 'type.go')
-rw-r--r--type.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/type.go b/type.go
index d47996e..9166209 100644
--- a/type.go
+++ b/type.go
@@ -121,18 +121,18 @@ func (i InclusionProofV1) String() string {
}
// StItemFromB64 creates an StItem from a serialized and base64-encoded string
-func StItemFromB64(s string) (*StItem, error) {
+func StItemFromB64(s string) (StItem, error) {
b, err := base64.StdEncoding.DecodeString(s)
if err != nil {
- return nil, fmt.Errorf("base64 decoding failed: %v", err)
+ return StItem{}, fmt.Errorf("base64 decoding failed: %v", err)
}
var item StItem
extra, err := tls.Unmarshal(b, &item)
if err != nil {
- return nil, fmt.Errorf("tls unmarshal failed: %v", err)
+ return StItem{}, fmt.Errorf("tls unmarshal failed: %v", err)
} else if len(extra) > 0 {
- return nil, fmt.Errorf("tls unmarshal found extra data: %v", extra)
+ return StItem{}, fmt.Errorf("tls unmarshal found extra data: %v", extra)
}
- return &item, nil
+ return item, nil
}