Skip to content
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

Verifiable Presentation Implementation #382

Merged
merged 5 commits into from
Feb 15, 2024
Merged

Conversation

nitro-neal
Copy link
Contributor

#351

This vp impl provides functionalities to sign, verify, and create presentations, offering a concise API to work with JWT representations of verifiable presentations and ensuring that the signatures and claims within those JWTs can be validated.

```ts
const vp = await VerifiablePresentation.create({
    type: 'PresentationSubmission',
    holder: 'did:ex:holder',
    vcJwts: vcJwts,
    additionalData: { 'presentation_submission': presentationSubmission }
  })
  
  const vpJwt = verifiablePresentation.sign({ did: myDid });
 
```

Example of a signed vp with a sample presentation_submission.


```

eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa21ZYWlMRXBMNGJQRkNBZXJpTTV4MTNnQUZpRUNRd2VNeWlWeDE1YlVydHYyI3o2TWttWWFpTEVwTDRiUEZDQWVyaU01eDEzZ0FGaUVDUXdlTXlpVngxNWJVcnR2MiJ9.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJQcmVzZW50YXRpb25TdWJtaXNzaW9uIl0sImlkIjoidXJuOnV1aWQ6OWNmMmQzODUtZDdiYi00ZWU4LTgyOGEtYTViOTE3YzZhNmNiIiwiaG9sZGVyIjoiZGlkOmtleTp6Nk1rbVlhaUxFcEw0YlBGQ0FlcmlNNXgxM2dBRmlFQ1F3ZU15aVZ4MTViVXJ0djIiLCJ2ZXJpZmlhYmxlQ3JlZGVudGlhbCI6WyJleUpyYVdRaU9pSmthV1E2YTJWNU9ucFJNM05vWjBOcVZtWnVjbGR4T1V3M2NqRlJjM294Y21sUlVsZHZiM3BpZDJkS1lrcHRUR2R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TJGc1VtVnpjR1ZqZENJNkltaHBaMmdpTENKc1pXZHBkQ0k2ZEhKMVpYMTlmUS5CeDBKclFFUldSTHBZZWczVG5mck9JbzR6ZXhvM3ExZXhQWi1FajZqMFQwWU9CVlphWjktUnFwaUFNLWZIS3JkR1V6VnlYcjc3cE9sN3lHZ3dJTzkwZyJdLCJwcmVzZW50YXRpb25fc3VibWlzc2lvbiI6eyJpZCI6InByZXNlbnRhdGlvblN1Ym1pc3Npb25JZCIsImRlZmluaXRpb25faWQiOiJkZWZpbml0aW9uSWQiLCJkZXNjcmlwdG9yX21hcCI6W3siaWQiOiJkZXNjcmlwdG9ySWQiLCJmb3JtYXQiOiJmb3JtYXQiLCJwYXRoIjoicGF0aCJ9XX19LCJpc3MiOiJkaWQ6a2V5Ono2TWttWWFpTEVwTDRiUEZDQWVyaU01eDEzZ0FGaUVDUXdlTXlpVngxNWJVcnR2MiIsInN1YiI6ImRpZDprZXk6ejZNa21ZYWlMRXBMNGJQRkNBZXJpTTV4MTNnQUZpRUNRd2VNeWlWeDE1YlVydHYyIn0.bEeGwEDTFSD3zaIWoStMOBv2RcWY7t1efTHkhb_xLE5d2px7JJOlY9wJmq4KxJF2HupDEUbQI0XuRIhzH0eZCA
```

Copy link

codesandbox bot commented Jan 19, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Jan 19, 2024

TBDocs Report

🛑 Errors: 0
⚠️ Warnings: 90

@web5/api

  • Project entry file: packages/api/src/index.ts
📄 File: ./packages/api/src/protocol.ts
⚠️ extractor:typedoc:missing-reference: ProtocolMetadata is referenced by Protocol._metadata but not included in the documentation.
⚠️ extractor:typedoc:missing-docs: Protocol._agent (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Protocol._metadata (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Protocol._protocolsConfigureMessage (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Protocol.send.__type.status (Property) does not have any documentation.
📄 File: ./packages/api/src/send-cache.ts
⚠️ extractor:typedoc:missing-reference: SendCache is referenced by Record._sendCache but not included in the documentation.
📄 File: ./packages/api/src/web5.ts
⚠️ extractor:typedoc:missing-reference: Web5Options is referenced by Web5.constructor.new Web5.options but not included in the documentation.
⚠️ extractor:typedoc:missing-docs: TechPreviewOptions.__type.dwnEndpoints (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Web5ConnectOptions.__type.connectedDid (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Web5.connect.__type.web5 (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Web5.connect.__type.did (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Web5.connectedDid (Property) does not have any documentation.
📄 File: ./packages/api/src/utils.ts
⚠️ extractor:typedoc:missing-docs: utils.dataToBlob.__type.dataBlob (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: utils.dataToBlob.__type.dataFormat (Property) does not have any documentation.
📄 File: ./packages/api/src/did-api.ts
⚠️ extractor:typedoc:missing-docs: DidApi.agent (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: DidApi.connectedDid (Property) does not have any documentation.
📄 File: ./packages/api/src/dwn-api.ts
⚠️ extractor:typedoc:missing-docs: ResponseStatus.__type.status (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ResponseStatus.__type.status.__type.code (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ResponseStatus.__type.status.__type.detail (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ProtocolsConfigureRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ProtocolsConfigureResponse.__type.protocol (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ProtocolsQueryReplyEntry.__type.descriptor (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ProtocolsQueryRequest.__type.from (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ProtocolsQueryRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: ProtocolsQueryResponse.__type.protocols (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsCreateFromRequest.__type.author (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsCreateFromRequest.__type.data (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsCreateFromRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsCreateFromRequest.__type.record (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsDeleteRequest.__type.from (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsDeleteRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsQueryRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsQueryResponse.__type.records (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsReadRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsReadResponse.__type.record (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsWriteRequest.__type.data (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsWriteRequest.__type.message (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsWriteRequest.__type.store (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordsWriteResponse.__type.record (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: DwnApi.agent (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: DwnApi.connectedDid (Property) does not have any documentation.
📄 File: ./packages/api/src/record.ts
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.author (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.connectedDid (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.encodedData (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.data (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.initialWrite (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.protocolRole (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordOptions.__type.remoteOrigin (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordModel.__type.author (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordModel.__type.protocolRole (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordModel.__type.recordId (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.data (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.dataCid (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.dataSize (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.dateModified (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.datePublished (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.published (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: RecordUpdateOptions.__type.protocolRole (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._sendCache (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._agent (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._connectedDid (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._encodedData (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._readableStream (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._remoteOrigin (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._author (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._attestation (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._authorization (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._contextId (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._descriptor (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._encryption (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._initialWrite (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._initialWriteStored (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._initialWriteSigned (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._recordId (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record._protocolRole (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record.data.__type.then (CallSignature) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record.data.__type.catch (CallSignature) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: Record.processRecord (CallSignature) does not have any documentation.
📄 File: ./packages/api/src/vc-api.ts
⚠️ extractor:typedoc:missing-docs: VcApi.agent (Property) does not have any documentation.
⚠️ extractor:typedoc:missing-docs: VcApi.connectedDid (Property) does not have any documentation.
🔀 Misc.
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/agent#Web5Agent" in comment for Web5ConnectOptions.__type.agent. You may have wanted "@web5/agent!Web5Agent"
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/user-agent#Web5UserAgent" in comment for Web5ConnectOptions.__type.agent. You may have wanted "@web5/user-agent!Web5UserAgent"
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/agent#AppDataStore" in comment for Web5ConnectOptions.__type.appData. You may have wanted "@web5/agent!AppDataStore"
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/agent#AppDataStore" in comment for Web5ConnectOptions.__type.appData. You may have wanted "@web5/agent!AppDataStore"
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/agent#Web5Agent" in comment for Web5.connect. You may have wanted "@web5/agent!Web5Agent"
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/user-agent#Web5UserAgent" in comment for Web5.connect. You may have wanted "@web5/user-agent!Web5UserAgent"

@web5/crypto

  • Project entry file: packages/crypto/src/index.ts

@web5/crypto-aws-kms

  • Project entry file: packages/crypto-aws-kms/src/index.ts
📄 File: ./packages/crypto-aws-kms/src/ecdsa.ts
⚠️ extractor:typedoc:missing-docs: EcdsaAlgorithm (Class) does not have any documentation.
📄 File: ./packages/crypto-aws-kms/src/key-manager.ts
⚠️ extractor:typedoc:missing-docs: AwsKeyManager (Class) does not have any documentation.
📄 File: ./packages/crypto-aws-kms/src/utils.ts
⚠️ extractor:typedoc:missing-docs: getKeySpec (CallSignature) does not have any documentation.
🔀 Misc.
⚠️ extractor:typedoc:invalid-link: Failed to resolve link to "@web5/crypto#Secp256k1.adjustSignatureToLowS | here" in comment for EcdsaAlgorithm.sign. You may have wanted "@web5/crypto!Secp256k1.adjustSignatureToLowS | here"

@web5/dids

  • Project entry file: packages/dids/src/index.ts

TBDocs Report Updated at 2024-02-14T18:38:37Z c803ac3

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Merging #382 (c803ac3) into main (69e5380) will decrease coverage by 0.01%.
The diff coverage is 94.26%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #382      +/-   ##
==========================================
- Coverage   93.33%   93.32%   -0.01%     
==========================================
  Files          78       79       +1     
  Lines       23528    23772     +244     
  Branches     1863     1886      +23     
==========================================
+ Hits        21959    22186     +227     
- Misses       1529     1546      +17     
  Partials       40       40              
Components Coverage Δ
agent 88.72% <ø> (ø)
api 97.11% <ø> (-0.19%) ⬇️
common 98.67% <ø> (ø)
credentials 94.77% <94.26%> (-0.17%) ⬇️
crypto 93.76% <ø> (ø)
dids 97.53% <ø> (ø)
identity-agent 56.81% <ø> (ø)
crypto-aws-kms 100.00% <ø> (ø)
proxy-agent 58.43% <ø> (ø)
user-agent 55.22% <ø> (ø)

Copy link
Contributor

@angiejones angiejones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this, Neal! Makes dev experience so much better

@nitro-neal nitro-neal merged commit 7a975f7 into main Feb 15, 2024
33 of 34 checks passed
@nitro-neal nitro-neal deleted the verifiable-presentation-impl branch February 15, 2024 01:13
finn-block pushed a commit that referenced this pull request Mar 19, 2024
* vp impl

* update

* merge updates and string check

* bump version
finn-block pushed a commit that referenced this pull request Mar 19, 2024
* vp impl

* update

* merge updates and string check

* bump version
finn-block pushed a commit that referenced this pull request Mar 19, 2024
* vp impl

* update

* merge updates and string check

* bump version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants