invocation: round of cleanups/fixes

This commit is contained in:
Michael Muré
2024-11-05 17:39:39 +01:00
committed by Steve Moyer
parent d754c5837b
commit bcdaf0cca3
4 changed files with 4 additions and 26 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/ipld/go-ipld-prime/fluent/qp"
"github.com/ipld/go-ipld-prime/node/basicnode"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/ucan-wg/go-ucan/did"
"github.com/ucan-wg/go-ucan/pkg/command"
"github.com/ucan-wg/go-ucan/token/invocation"

View File

@@ -15,6 +15,7 @@ import (
"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime/datamodel"
"github.com/ucan-wg/go-ucan/did"
"github.com/ucan-wg/go-ucan/pkg/command"
"github.com/ucan-wg/go-ucan/pkg/meta"
@@ -229,29 +230,3 @@ func generateNonce() ([]byte, error) {
}
return res, nil
}
func parseOptionalCID(c *cid.Cid) (*cid.Cid, error) {
if c == nil {
return nil, nil
}
return c, nil
}
func parseOptionalDID(s *string) (did.DID, error) {
if s == nil {
return did.Undef, nil
}
return did.Parse(*s)
}
func parseOptionalTimestamp(sec *int64) (*time.Time, error) {
if sec == nil {
return nil, nil
}
t := time.Unix(*sec, 0)
return &t, nil
}

View File

@@ -5,6 +5,7 @@ import (
"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime/datamodel"
"github.com/ucan-wg/go-ucan/did"
)

View File

@@ -79,6 +79,7 @@ func TestSchemaRoundTrip(t *testing.T) {
assert.JSONEq(t, string(invocationJson), readJson.String())
})
}
func privKey(t require.TestingT, privKeyCfg string) crypto.PrivKey {
privKeyMar, err := crypto.ConfigDecodeKey(privKeyCfg)
require.NoError(t, err)