-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(credentials): add get format data method #877
feat(credentials): add get format data method #877
Conversation
Signed-off-by: Timo Glastra <[email protected]>
@Iskander508 I think this should resolve your issue as described in #868. Can you take a look? |
Signed-off-by: Timo Glastra <[email protected]>
packages/core/src/modules/credentials/formats/indy/IndyCredentialFormat.ts
Outdated
Show resolved
Hide resolved
? JsonTransformer.toJSON(this.rfc0592ProposalFromV1ProposeMessage(proposalMessage)) | ||
: undefined | ||
|
||
const indyOffer = offerMessage?.indyCredentialOffer ?? undefined |
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.
Doesnt offerMessage?.indyCredentialOffer
short-circuit to undefined when it is undefined?
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.
No it resolves to null
(as in nothing went wrong but we don't have a value). We aren't very consistent however in using null vs undefined and there's probably a lot of places where we should be using null
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.
Yeah null vs undefined is very annoying. Might be worth in the future to check how we can clean this up.
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.
lgtm
Signed-off-by: Timo Glastra <[email protected]>
Thank you @TimoGlastra. Yes, this should work. Meanwhile we have also found a temporary workaround to use the internal credential service to expose the necessary values. |
Codecov Report
@@ Coverage Diff @@
## main #877 +/- ##
==========================================
+ Coverage 87.58% 87.64% +0.05%
==========================================
Files 468 468
Lines 11095 11141 +46
Branches 1746 1773 +27
==========================================
+ Hits 9718 9764 +46
+ Misses 1377 1373 -4
- Partials 0 4 +4
Continue to review full report at Codecov.
|
Adds a
getFormatData
method to the credentials module to make it easier to retrieve the credential format data for a credential record.You use it like this:
it will return an object with the
proposal
,offer
,request
,credential
keys each containing format keys with their payloads. The return type is fully typed because we define the payloads of the format attachments in theCredentialFormat
interface (seeIndyCredentialFormat
). It returns the JSON encoded variant of the payloads (like it is send over the wire), not the class instance. This is mainly done because we don't have classes defined for each of the payloads and this also makes it harder to use it over in e.g. the AFJ rest server.An example of the returned value: