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