From b52af6f9f72bb11ad5f91680b6b99b3d76ccd367 Mon Sep 17 00:00:00 2001 From: Roland Groen Date: Tue, 15 Oct 2024 00:59:48 +0200 Subject: [PATCH] Add `subject_did` field and update `test-cert` case Introduce a new `subject_did` field in the `TestCert` struct with a default value. Update the `test-cert` command case to handle this new parameter and adjust the VC issuance logic. --- main.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 1d8f54b..fde4757 100644 --- a/main.go +++ b/main.go @@ -16,9 +16,10 @@ type VC struct { } type TestCert struct { - Uzi string `arg:"" name:"uzi" help:"The UZI number for the test certificate."` - Ura string `arg:"" name:"ura" help:"The URA number for the test certificate."` - Agb string `arg:"" name:"agb" help:"The AGB code for the test certificate."` + Uzi string `arg:"" name:"uzi" help:"The UZI number for the test certificate."` + Ura string `arg:"" name:"ura" help:"The URA number for the test certificate."` + Agb string `arg:"" name:"agb" help:"The AGB code for the test certificate."` + SubjectDID string `arg:"" default:"did:web:example.com:test" name:"subject_did" help:"The subject DID of the VC." type:"key"` } var CLI struct { @@ -47,7 +48,7 @@ func main() { os.Exit(-1) } println(jwt) - case "test-cert ": + case "test-cert ", "test-cert ": // Format is 2.16.528.1.1007.99.2110-1-900030787-S-90000380-00.000-11223344 // ------ // 2.16.528.1.1007.99.2110-1--S--00.000- @@ -80,7 +81,18 @@ func main() { fmt.Println(err) os.Exit(-1) } - + vc := VC{ + CertificateFile: "chain.pem", + SigningKey: "signing_key.pem", + SubjectDID: cli.TestCert.SubjectDID, + Test: false, + } + jwt, err := issueVc(vc) + if err != nil { + fmt.Println(err) + os.Exit(-1) + } + println(jwt) default: fmt.Println("Unknown command") os.Exit(-1)