cli: update following go-ucan changes

This commit is contained in:
Michael Muré
2024-12-12 16:41:02 +01:00
committed by Michael Muré
parent 11b4352063
commit 9c8e9f17fa

View File

@@ -6,6 +6,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http" "net/http"
"strings"
"testing" "testing"
"time" "time"
@@ -82,7 +83,7 @@ func ExampleContext() {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Note: we obviously want something more robust, this is an example // Note: we obviously want something more robust, this is an example
// Note: if an error occur, we'll want to return an HTTP 401 Unauthorized // Note: if an error occur, we'll want to return an HTTP 401 Unauthorized
data := bytes.TrimPrefix([]byte(r.Header.Get("Authorization")), []byte("Bearer ")) data := strings.TrimPrefix(r.Header.Get("Authorization"), "Bearer ")
cont, _ := container.FromCborBase64(data) cont, _ := container.FromCborBase64(data)
ucanCtx, _ := exectx.FromContainer(cont) ucanCtx, _ := exectx.FromContainer(cont)