-
Notifications
You must be signed in to change notification settings - Fork 13
feat: [WACI-Issuance] Support to read credential manifest #574
Conversation
62f3bb0
to
b1ddf7d
Compare
Codecov Report
@@ Coverage Diff @@
## main #574 +/- ##
==========================================
- Coverage 87.64% 87.58% -0.07%
==========================================
Files 29 29
Lines 4201 4220 +19
==========================================
+ Hits 3682 3696 +14
- Misses 305 310 +5
Partials 214 214
Continue to review full report at Codecov.
|
b1ddf7d
to
e7b3984
Compare
@@ -872,6 +872,7 @@ func addIssuerHandlers(parameters *adapterRestParameters, framework *aries.Aries | |||
ExternalURL: parameters.externalURL, | |||
DidDomain: parameters.trustblocDomain, | |||
JSONLDDocumentLoader: ariesCtx.JSONLDDocumentLoader(), | |||
CmOutputDescriptor: cmOutputDescriptor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be CMOutputDescriptor
for consistency with the naming conventions
a98dfaf
to
9f1210e
Compare
9f1210e
to
f721c3b
Compare
cmd/adapter-rest/startcmd/start.go
Outdated
@@ -892,7 +892,7 @@ func addIssuerHandlers(parameters *adapterRestParameters, framework *aries.Aries | |||
if err != nil { | |||
return fmt.Errorf("failed to init trustbloc did creator: %w", err) | |||
} | |||
// TODO #572 Pass the output descriptors to issuer | |||
// TODO #575 Persist the manifest output descriptor in database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correction on TODO: it shouldn't be in database since you pass it everytime you start adapter, it should be in some kind of local file. based or in-memory cache.
add that new issue into current epic you are working on.
I don't see any issues in adapter numbered #575
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated and fixed the issue # as well
cmd/adapter-rest/startcmd/start.go
Outdated
// TODO #572 Pass the output descriptors to issuer | ||
_, err = readCMOutputDescriptorFile(parameters.cmOutputDescriptorsFilePath) | ||
|
||
CMOutputDescriptor, err := readCMOutputDescriptorFile(parameters.cmOutputDescriptorsFilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this local var name start with lower case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/profile/issuer/profile.go
Outdated
@@ -45,7 +46,7 @@ type ProfileData struct { | |||
OIDCClientParams *OIDCClientParams `json:"oidcParams,omitempty"` | |||
CredentialScopes []string `json:"credScopes,omitempty"` | |||
LinkedWalletURL string `json:"linkedWallet,omitempty"` | |||
// Todo #issue Add credential manifest issuer object | |||
CredentialManifestIssuer cm.Issuer `json:"issuer,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use Name
from line 36 rather a new variable ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering same, profile name & issuer names are same? remember issuer.Name
name gets displayed in.wallet UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is - same is displayed in DIDComm CHAPI screens as well during sharing (passed as part of credential.issuer field).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@talwinder50 remove cm.Issuer
and use
- Name - already there
- IssuerID - put comment as it is going to be used as issuer ID in credential manifests being issued
- Style - style object from aries credential manifest package, add go comments to explain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@talwinder50 I don't see any updates
pkg/profile/issuer/profile.go
Outdated
@@ -45,7 +46,7 @@ type ProfileData struct { | |||
OIDCClientParams *OIDCClientParams `json:"oidcParams,omitempty"` | |||
CredentialScopes []string `json:"credScopes,omitempty"` | |||
LinkedWalletURL string `json:"linkedWallet,omitempty"` | |||
// Todo #issue Add credential manifest issuer object | |||
CredentialManifestIssuer cm.Issuer `json:"issuer,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you do schema validation when CredentialManifestIssuer
is supplied? Better to fail here rather than failing during transaction later during WACI.
Add some go doc comments about usage and expected format of this field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the spec, you'd need to make sure the ID is not empty:
The object MUST contain a id property, and its value MUST be a valid URI string that identifies who the issuer of the credential(s) will be.
My CredentialManifest validation code makes sure that the ID isn't empty, but only if you unmarshal a full CredentialManifest... (which will happen during the transaction, causing a failure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#581 Validation of the manifest will be done as part of this todo. Which i will address in the follow up pr.
@@ -104,6 +104,7 @@ const ( | |||
|
|||
// WACI interaction constants | |||
credentialManifestFormat = "dif/credential-manifest/manifest@v1.0" | |||
credentialManifestVersion = "1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -155,6 +156,7 @@ type Config struct { | |||
ExternalURL string | |||
DidDomain string | |||
JSONLDDocumentLoader ld.DocumentLoader | |||
CmOutputDescriptor map[string][]*cm.OutputDescriptor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this object will be heavy, I would suggest you put a helper struct here which has functions to find and return subset of output descriptors by credential scope. So that you can swap underlying memory store with cache in future with little effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#580 I will address this optimization in the follow up pr , if its okay with you @sudeshrshetty
// TODO issue#561 Add credential manifest presentation definition | ||
func (o *Operation) readCredentialManifest(profileData *issuer.ProfileData, | ||
txnCredScope string) *cm.CredentialManifest { | ||
for scope, cmDesciptor := range o.cmOutputDescriptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loop can be replaced by a single line o.cmOutputDescriptor[txnCredScope]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
da36692
to
2fb4094
Compare
I don't see resolution for this comment : #574 (comment) |
ID: uuid.NewString(), | ||
Version: credentialManifestVersion, | ||
Issuer: cm.Issuer{ | ||
ID: profileData.ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can not use profile ID here, this is not issuer ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sudeshrshetty In here when we are creating credential the issuer id we are using profile.url
cred.Issuer.ID = profile.URL |
Does this implies the issuer adapter is creating credential and thats why using profile URL ? Is this correct ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks wrong, don't use that. Profile ID is some UUID generated to co-relate data in adapter it has nothing to do with actual identity of issuer.
Refer this example for credential manifest: https://identity.foundation/credential-manifest/#credential-manifest---all-features-exercised
For let profile creation option accept issuer ID & Style as input arguments as I mentioned here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sudeshrshetty I have added issuerID and cmstyle in profile data as when New issuer onboards to adapter it need to provide issuer ID and manifest style for that specific profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where it is set?
Issuer: cm.Issuer{ | ||
ID: profileData.ID, | ||
Name: profileData.Name, | ||
Styles: cm.Styles{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style has to be provided by issuer
1b60db5
to
690b8e6
Compare
690b8e6
to
f5fa920
Compare
f5fa920
to
b46f080
Compare
ID: uuid.NewString(), | ||
Version: credentialManifestVersion, | ||
Issuer: cm.Issuer{ | ||
ID: profileData.IssuerID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anywhere these being set to profile data??
Where is profile creation step which accepts these 2 additional params - IssuerID & CMStyle
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IssuerID: data.IssuerID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@talwinder50 I meant how an issuer can pass it? I don't see these as part of profile creation request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sudeshrshetty It is mentioned here
IssuerID string `json:"issuerID,omitempty"` |
@@ -69,7 +69,7 @@ | |||
} | |||
} | |||
], | |||
"prc": [ | |||
"PermanentResidentCard": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it renamed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local change pushed by mistake
3cbdf9e
to
33e8e04
Compare
@@ -27,6 +28,8 @@ type ProfileDataRequest struct { | |||
OIDCClientParams *OIDCClientParams `json:"oidcParams,omitempty"` | |||
CredentialScopes []string `json:"scopes,omitempty"` | |||
LinkedWalletURL string `json:"linkedWallet,omitempty"` | |||
IssuerID string `json:"issuerID,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow up: please add comments explaining usage of these params so that it can show up in documentation.
(can be done in future PRs)
return &cm.CredentialManifest{ | ||
ID: uuid.NewString(), | ||
Issuer: cm.Issuer{ | ||
ID: profileData.ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you missed here? issuer ID instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
closes trustbloc#561 Signed-off-by: talwinder50 <talwinderkaur50@gmail.com>
33e8e04
to
9ff8c67
Compare
closes #582
Signed-off-by: talwinder50 talwinderkaur50@gmail.com