This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 105
Kotlin validate submission pex #1234
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6d8a415
added validate submission and vp
blackgirlbytes c13e1bf
more clarity on why a vp is created
blackgirlbytes 884937d
clarity on language
blackgirlbytes 0040ac3
Merge branch 'main' into kotlin-validate-submission-pex
blackgirlbytes 1f8df19
unnecessary import
blackgirlbytes c0d3101
Merge branch 'main' into kotlin-validate-submission-pex
blackgirlbytes a93a2de
Update site/docs/web5/build/verifiable-credentials/presentation-excha…
blackgirlbytes 8953f31
Merge branch 'main' into kotlin-validate-submission-pex
blackgirlbytes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ import getLoanAppPresentationDefinitionKt from '!!raw-loader!@site/snippets/test | |
import satisfiesPresentationDefinitionForPexKt from '!!raw-loader!@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/verifiablecredentials/satisfiesPresentationDefinitionForPexKt.snippet.kt' | ||
import selectCredentialsForPexKt from '!!raw-loader!@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/verifiablecredentials/selectCredentialsForPexKt.snippet.kt' | ||
import createPresentationFromCredentialsForPexKt from '!!raw-loader!@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/verifiablecredentials/createPresentationFromCredentialsForPexKt.snippet.kt' | ||
import validVerifiablePresentationForPexKt from '!!raw-loader!@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/verifiablecredentials/validVerifiablePresentationForPexKt.snippet.kt' | ||
import validatePresentationSubmissionForPexKt from '!!raw-loader!@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/verifiablecredentials/validatePresentationSubmissionForPexKt.snippet.kt' | ||
import signVpForPexKt from '!!raw-loader!@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/verifiablecredentials/signVpForPexKt.snippet.kt' | ||
|
||
<LanguageSwitcher languages="JavaScript, Kotlin" /> | ||
|
||
|
@@ -71,6 +72,7 @@ import { PresentationExchange } from '@web5/credentials'; | |
code: ` | ||
import web5.sdk.credentials.PresentationExchange | ||
import web5.sdk.credentials.VerifiablePresentation | ||
import web5.sdk.credentials.model.PresentationSubmission | ||
import web5.sdk.credentials.model.* | ||
`, | ||
language: 'Kotlin', | ||
|
@@ -110,8 +112,13 @@ Once you've confirmed that the VCs successfully satisfy the Presentation Definit | |
|
||
<Shnip | ||
snippets={[ | ||
{ snippetContent: createPresentationFromCredentialsForPex, language: 'JavaScript'}, | ||
{ snippetContent: createPresentationFromCredentialsForPexKt, language: 'Kotlin'}, | ||
{ | ||
snippetContent: createPresentationFromCredentialsForPex, | ||
language: 'JavaScript' | ||
}, | ||
{ | ||
snippetContent: createPresentationFromCredentialsForPexKt, | ||
language: 'Kotlin'}, | ||
]} | ||
/> | ||
|
||
|
@@ -215,35 +222,53 @@ Before submitting the presentation to a lender, you can validate the Presentatio | |
<Shnip | ||
snippets={[ | ||
{ snippetContent: validPresentationSubmissionForPex, language: 'JavaScript'}, | ||
{ snippetContent: validatePresentationSubmissionForPexKt, language: 'Kotlin'} | ||
]} | ||
inlineSnippets={[ | ||
/> | ||
|
||
:::note | ||
The information regarding `Checked` objects is only applicable to the JavaScript SDK. | ||
::: | ||
|
||
|
||
<Shnip | ||
inlineSnippets={[ | ||
{ | ||
content: 'This functionality is soon to be implemented in the Kotlin SDK.' , | ||
content: 'This method checks the presentation submission for any errors, returns an array of `Checked` objects representing the validation checks performed on the presentation submission:', | ||
code: ` | ||
[ Checked { tag: 'root', status: 'info', message: 'ok' } ] | ||
`, | ||
language: 'JavaScript', | ||
}, | ||
{ | ||
content: "If unsuccessful, an error will be thrown. Here is an example:", | ||
code:` | ||
PresentationSubmission id must not be empty | ||
`, | ||
language: 'Kotlin', | ||
} | ||
]} | ||
/> | ||
|
||
This method checks the presentation submission for any errors, returns an array of `Checked` objects representing the validation checks performed on the presentation submission: | ||
|
||
```js | ||
[ Checked { tag: 'root', status: 'info', message: 'ok' } ] | ||
``` | ||
|
||
Each `Checked` object contains: | ||
|
||
- **tag**: the path, `root` of the submission that was checked | ||
- **status**: the result of the check, which is `info` for successful checks or `error` for failed checks | ||
- **message**: shows `ok` if successful, and if unsuccessful this is where you'll find error messages | ||
|
||
## Verifiable Presentation | ||
|
||
|
||
## Verifiable Presentation | ||
|
||
<Shnip | ||
snippets={[ | ||
{ content: 'Once the [Presentation](/docs/glossary#verifiable-presentation) is error-free and has passed the validation checks, you can submit the Verifiable Presentation by providing the lender with the `presentation` JSON object:', snippetContent: validVerifiablePresentationForPex, language: 'JavaScript'}, | ||
{ content: 'After successfully creating the [Presentation](/docs/glossary#verifiable-presentation) using `VerifiablePresentation.create()`, and ensuring it is error-free and has passed all validation checks, you can submit the Verifiable Presentation by providing the lender with the `mappedPresentationSubmission` object:', snippetContent: validVerifiablePresentationForPexKt, language: 'Kotlin'}, | ||
{ | ||
content: 'Once the [Presentation](/docs/glossary#verifiable-presentation) is error-free and has passed the validation checks, you can submit the Verifiable Presentation by providing the lender with the `presentation` JSON object:', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For JS, why aren't we signing and returning the JWT like we're doing in Kotlin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's not available yet. I'm still waiting for that to be merged then released decentralized-identity/web5-js#382 |
||
snippetContent: | ||
validVerifiablePresentationForPex, language: 'JavaScript'}, | ||
{ | ||
content: 'Once the [Presentation](/docs/glossary#verifiable-presentation) is error-free and has passed the validation checks, you can submit the Verifiable Presentation as a signed and encoded JWT to the lender for [verification](/docs/web5/build/verifiable-credentials/verify-vc#verify-verifiable-presentations).', | ||
snippetContent: signVpForPexKt, | ||
language: 'Kotlin'}, | ||
]} | ||
/> | ||
|
||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 know I already included import web5.sdk.credentials.model.*, but for some strange reason that doesn't import PresentationSubmission, so that needs to be imported separately.
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.
@nitro-neal any thoughts or advice on why I have to import web5.sdk.credentials.model.PresentationSubmission if I'm doing import web5.sdk.credentials.model.*
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.
That is pretty strange, could be ide or linter problem.
Does PresentationDefinition work with *?
Its probably better to import them individually instead of using * to be more explicit and not import unnecessary things, but yea is strange. I'll see if it happens on my end