update go-ucan, with the now spec defined container
https://github.com/ucan-wg/go-ucan/blob/main/pkg/container/SPEC.md
This commit is contained in:
committed by
Michael Muré
parent
f18ae547ab
commit
09c8815755
@@ -36,10 +36,10 @@ func ExampleNewClient() {
|
|||||||
handleError(err)
|
handleError(err)
|
||||||
|
|
||||||
// this container holds the invocation and all the delegation proofs
|
// this container holds the invocation and all the delegation proofs
|
||||||
b64, err := cont.ToCborBase64()
|
b64, err := cont.ToBase64StdPadding()
|
||||||
handleError(err)
|
handleError(err)
|
||||||
|
|
||||||
fmt.Println(string(b64))
|
fmt.Println(b64)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleError(err error) {
|
func handleError(err error) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ func ExampleContext() {
|
|||||||
cont := container.NewWriter()
|
cont := container.NewWriter()
|
||||||
cont.AddSealed(dlgCid, dlgBytes)
|
cont.AddSealed(dlgCid, dlgBytes)
|
||||||
cont.AddSealed(invCid, invBytes)
|
cont.AddSealed(invCid, invBytes)
|
||||||
contBytes, _ := cont.ToCborBase64()
|
contBytes, _ := cont.ToBase64StdPadding()
|
||||||
|
|
||||||
// MAKING A REQUEST: we pass the container in the Bearer HTTP header
|
// MAKING A REQUEST: we pass the container in the Bearer HTTP header
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ func ExampleContext() {
|
|||||||
// 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 := strings.TrimPrefix(r.Header.Get("Authorization"), "Bearer ")
|
data := strings.TrimPrefix(r.Header.Get("Authorization"), "Bearer ")
|
||||||
cont, _ := container.FromCborBase64(data)
|
cont, _ := container.FromString(data)
|
||||||
ucanCtx, _ := exectx.FromContainer(cont)
|
ucanCtx, _ := exectx.FromContainer(cont)
|
||||||
|
|
||||||
// insert into the go context
|
// insert into the go context
|
||||||
|
|||||||
Reference in New Issue
Block a user