From f6f1215c6c44ad3fe1f58a0d29e6de10c98c953a Mon Sep 17 00:00:00 2001 From: Kendall Weihe Date: Thu, 28 Mar 2024 14:36:55 -0400 Subject: [PATCH 1/2] Remove redundant CLI argument for vc create --sign --- cmd/web5/cmd_vc_create.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cmd/web5/cmd_vc_create.go b/cmd/web5/cmd_vc_create.go index caf2525..4edf891 100644 --- a/cmd/web5/cmd_vc_create.go +++ b/cmd/web5/cmd_vc_create.go @@ -2,7 +2,6 @@ package main import ( "encoding/json" - "errors" "fmt" "time" @@ -18,8 +17,7 @@ type vcCreateCMD struct { ID string `help:"Override the default ID of format urn:vc:uuid:."` IssuanceDate time.Time `help:"Override the default issuanceDate of time.Now()."` ExpirationDate time.Time `help:"Override the default expirationDate of nil."` - Sign bool `help:"Sign the VC with the provided --portable-did." default:"false"` - PortableDID string `help:"Portable DID used with --sign. Value is a JSON string."` + Sign string `help:"Portable DID used with --sign. Value is a JSON string."` NoIndent bool `help:"Print the VC without indentation." default:"false"` } @@ -51,13 +49,9 @@ func (c *vcCreateCMD) Run() error { credential := vc.Create(claims, opts...) - if c.Sign { - if c.PortableDID == "" { - return errors.New("--portable-did must be provided with --sign") - } - + if c.Sign != "" { var portableDID did.PortableDID - err = json.Unmarshal([]byte(c.PortableDID), &portableDID) + err = json.Unmarshal([]byte(c.Sign), &portableDID) if err != nil { return fmt.Errorf("%s: %w", "invalid portable DID", err) } From 0b6924686e851398e14f37755ea731b864ae5fe7 Mon Sep 17 00:00:00 2001 From: Kendall Weihe Date: Thu, 28 Mar 2024 14:39:16 -0400 Subject: [PATCH 2/2] Improve clarity of -h for --sign --- cmd/web5/cmd_vc_create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/web5/cmd_vc_create.go b/cmd/web5/cmd_vc_create.go index 4edf891..bbeff1c 100644 --- a/cmd/web5/cmd_vc_create.go +++ b/cmd/web5/cmd_vc_create.go @@ -17,7 +17,7 @@ type vcCreateCMD struct { ID string `help:"Override the default ID of format urn:vc:uuid:."` IssuanceDate time.Time `help:"Override the default issuanceDate of time.Now()."` ExpirationDate time.Time `help:"Override the default expirationDate of nil."` - Sign string `help:"Portable DID used with --sign. Value is a JSON string."` + Sign string `help:"Portable DID used to sign the VC-JWT. Value is a JSON string."` NoIndent bool `help:"Print the VC without indentation." default:"false"` }