Skip to content

Commit e3d0121

Browse files
committed
fix: do not attempt to decode unimplemented types
1 parent f67183c commit e3d0121

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

ucan/container/container.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/alanshaw/ucantone/ucan/container/datamodel"
1313
"github.com/alanshaw/ucantone/ucan/delegation"
1414
"github.com/alanshaw/ucantone/ucan/invocation"
15-
"github.com/alanshaw/ucantone/ucan/receipt"
1615
"github.com/ipfs/go-cid"
1716
)
1817

@@ -144,7 +143,7 @@ func Encode(codec byte, container ucan.Container) ([]byte, error) {
144143
case Base64url, Base64urlGzip:
145144
out = []byte(base64.RawURLEncoding.EncodeToString(out))
146145
default:
147-
return nil, fmt.Errorf("unknown codec: %d", codec)
146+
return nil, fmt.Errorf("unknown codec: 0x%02x", codec)
148147
}
149148

150149
return append([]byte{codec}, out...), nil
@@ -172,7 +171,7 @@ func Decode(input []byte) (*Container, error) {
172171
}
173172
compressed = r
174173
default:
175-
return nil, fmt.Errorf("unknown codec: %d", codec)
174+
return nil, fmt.Errorf("unknown codec: 0x%02x", codec)
176175
}
177176

178177
var raw []byte
@@ -202,14 +201,15 @@ func Decode(input []byte) (*Container, error) {
202201
invs = append(invs, inv)
203202
continue
204203
}
205-
if rcpt, err := receipt.Decode(b); err != nil {
206-
rcpts = append(rcpts, rcpt)
207-
continue
208-
}
209-
if dlg, err := delegation.Decode(b); err != nil {
210-
dlgs = append(dlgs, dlg)
211-
continue
212-
}
204+
// TODO: reinstate when implemented
205+
// if rcpt, err := receipt.Decode(b); err != nil {
206+
// rcpts = append(rcpts, rcpt)
207+
// continue
208+
// }
209+
// if dlg, err := delegation.Decode(b); err != nil {
210+
// dlgs = append(dlgs, dlg)
211+
// continue
212+
// }
213213
}
214214

215215
return New(WithInvocations(invs...), WithDelegations(dlgs...), WithReceipts(rcpts...)), nil

0 commit comments

Comments
 (0)