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

Adding web vc create #269

Closed
wants to merge 5 commits into from
Closed

Adding web vc create #269

wants to merge 5 commits into from

Conversation

nitro-neal
Copy link
Contributor

@nitro-neal nitro-neal commented Nov 9, 2023

This PR adds the web5.vc.create api. This currently uses the agents connected did's key to generate a VC to the subject specified, and returns a signed vcJwt. In the future this will write as a DWN record.

Parameters

  /**
   * Issues a VC to the subject did
   *
   * @param issuer The issuer URI of the credential, as a [String].
   * @param subject The subject URI of the credential, as a [String].
   * @param dataType The type of the credential, as a [String].
   * @param data The credential data, as a generic type [T].
   * @param expirationDate The expiration date.
   * @return A VerifiableCredential JWT.
   */

Usage

  vc = new VcApi({ agent: testAgent.agent, connectedDid: identityDid });
  const vcJwt = await vc.create(identityDid, identityDid, 'ExampleDataType', {example: 'goodStuff'});

In future PRs I want to have a write to dwn flag, when this is set to true the VcResponse object will be extended with a dwn records object and the vcJwt.

Copy link

codesandbox bot commented Nov 9, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Nov 9, 2023

TBDocs Report

🛑 Errors: 0
⚠️ Warnings: 6

@web5/api

  • Project entry file: packages/api/src/index.ts
📄 File: packages/api/src/vc-api.ts
⚠️ docs:tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen #L20
⚠️ docs:tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen #L21
⚠️ docs:tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen #L22
⚠️ docs:tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen #L23
⚠️ docs:tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen #L24
⚠️ docs:tsdoc-undefined-tag: The TSDoc tag "@return" is not defined in this configuration #L25

Updated @ 2023-11-14T18:01:42.335Z - Commit: 9e2bc35

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #269 (c20d3bb) into main (2421b28) will decrease coverage by 0.45%.
The diff coverage is 51.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
- Coverage   90.34%   89.90%   -0.45%     
==========================================
  Files          74       75       +1     
  Lines       14028    14184     +156     
  Branches     1382     1383       +1     
==========================================
+ Hits        12674    12752      +78     
- Misses       1328     1406      +78     
  Partials       26       26              
Components Coverage Δ
api 95.10% <100.00%> (+0.05%) ⬆️
common 95.00% <ø> (ø)
credentials 94.50% <100.00%> (+<0.01%) ⬆️
crypto 100.00% <ø> (ø)
dids 88.75% <ø> (ø)
agent 86.23% <45.21%> (-0.99%) ⬇️
identity-agent 56.15% <40.00%> (-0.66%) ⬇️
proxy-agent 58.43% <ø> (ø)
user-agent 54.44% <37.50%> (-0.78%) ⬇️

@thehenrytsai
Copy link
Contributor

Super outdated, closing. Feel free to refresh and reopen.

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.

2 participants