Skip to content

Instantly share code, notes, and snippets.

@alanshaw
Created November 12, 2025 18:54
Show Gist options
  • Select an option

  • Save alanshaw/cb7164e11cdbda8ec909332ab6a09ef8 to your computer and use it in GitHub Desktop.

Select an option

Save alanshaw/cb7164e11cdbda8ec909332ab6a09ef8 to your computer and use it in GitHub Desktop.
Decode X-Agent-Message header
package main
import (
"fmt"
"testing"
"github.com/storacha/go-ucanto/testing/helpers/printer"
"github.com/storacha/go-ucanto/transport/headercar/message"
)
func TestDecode(t *testing.T) {
xAgentMessage := "mH4sIAAAAAAAA..."
m, err := message.DecodeHeader(xAgentMessage)
if err != nil {
panic(err)
}
fmt.Println("invocations", len(m.Invocations()))
fmt.Println("receipts", len(m.Receipts()))
inv, _, err := m.Invocation(m.Invocations()[0])
if err != nil {
panic(err)
}
printer.PrintDelegation(t, inv, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment