diff --git a/cmd-merge-cars.go b/cmd-merge-cars.go index 9abbf181..6cf3b2fc 100644 --- a/cmd-merge-cars.go +++ b/cmd-merge-cars.go @@ -10,7 +10,26 @@ import ( "github.com/urfave/cli/v2" ) -const varintSize = 10 +const ( + varintSize = 10 + nulRootCarHeader = "\x19" + // 25 bytes of CBOR (encoded as varint :cryingbear: ) + // map with 2 keys + "\xA2" + + // text-key with length 5 + "\x65" + "roots" + + // 1 element array + "\x81" + + // tag 42 + "\xD8\x2A" + + // bytes with length 5 + "\x45" + + // nul-identity-cid prefixed with \x00 as required in DAG-CBOR: https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-cbor.md#links + "\x00\x01\x55\x00\x00" + + // text-key with length 7 + "\x67" + "version" + + // 1, we call this v0 due to the nul-identity CID being an open question: https://github.com/ipld/go-car/issues/26#issuecomment-604299576 + "\x01" +) func newCmd_MergeCars() *cli.Command { var outputFile string