feat(invocation): produce example output similar to spec

This commit is contained in:
Steve Moyer
2024-10-24 12:59:38 -04:00
parent 31d16ac468
commit a98653b769
3 changed files with 235 additions and 0 deletions

View File

@@ -69,12 +69,14 @@ func New(iss, sub did.DID, cmd command.Command, prf []cid.Cid, opts ...Option) (
}
iat := time.Now()
metadata := meta.NewMeta()
tkn := Token{
issuer: iss,
subject: sub,
command: cmd,
proof: prf,
meta: metadata,
nonce: nonce,
invokedAt: &iat,
}
@@ -85,6 +87,10 @@ func New(iss, sub did.DID, cmd command.Command, prf []cid.Cid, opts ...Option) (
}
}
if len(tkn.meta.Keys) == 0 {
tkn.meta = nil
}
return &tkn, nil
}