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

update vc sign #332

Merged
merged 6 commits into from
Dec 7, 2023
Merged

update vc sign #332

merged 6 commits into from
Dec 7, 2023

Conversation

nitro-neal
Copy link
Contributor

Fixes - #328

Updating, vc.sign to look like this:

const did = await DidDhtMethod.create({ publish: true })

const vc = await VerifiableCredential.create({
  type    : 'TBDeveloperCredential',
  subject : did.did,
  issuer  : did.did,
  data    : {
    username: 'nitro'
  }
})

const vcJwt = await vc.sign({ did })

Copy link

codesandbox bot commented Dec 5, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Dec 5, 2023

TBDocs Report

✅ No errors or warnings

@web5/api

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

TBDocs Report Updated at 2023-12-06T17:01:20Z 337b9a1

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #332 (f42eba6) into main (8fe94d0) will increase coverage by 0.01%.
The diff coverage is 96.03%.

❗ Current head f42eba6 differs from pull request most recent head 337b9a1. Consider uploading reports for the commit 337b9a1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
+ Coverage   92.69%   92.71%   +0.01%     
==========================================
  Files          75       75              
  Lines       16786    16837      +51     
  Branches     1575     1577       +2     
==========================================
+ Hits        15560    15610      +50     
- Misses       1200     1201       +1     
  Partials       26       26              
Components Coverage Δ
api 96.94% <ø> (+0.21%) ⬆️
common 97.78% <ø> (ø)
credentials 94.14% <96.03%> (-0.18%) ⬇️
crypto 100.00% <ø> (ø)
dids 91.80% <ø> (ø)
agent 88.08% <ø> (ø)
identity-agent 56.81% <ø> (ø)
proxy-agent 58.43% <ø> (ø)
user-agent 55.22% <ø> (ø)

@@ -85,6 +122,14 @@ const tbdResolver = new TbdResolver();
export class VerifiableCredential {
constructor(public vcDataModel: VcDataModel) {}

/** supported cryptographic algorithms. keys are `${alg}:${crv}`. */
static algorithms: { [alg: string]: Signer<Web5Crypto.EcdsaOptions | Web5Crypto.EdDsaOptions> } = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

one day this will live somewhere else in a common place I'm sure

}

const secp256k1Signer: Signer<Web5Crypto.EcdsaOptions> = {
signer : new EcdsaAlgorithm(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes its right my did-ion test confirms it 👍

@nitro-neal nitro-neal merged commit 2a38d1c into main Dec 7, 2023
9 checks passed
@nitro-neal nitro-neal deleted the update-vc-sign branch December 7, 2023 00:14
finn-block pushed a commit that referenced this pull request Mar 19, 2024
* update vc sign

* fix spec

* support signing with secp256k1 and ed25519 keys

* remove unused import

* add did ion test

---------

Co-authored-by: Moe Jangda <moe@tbd.email>
finn-block pushed a commit that referenced this pull request Mar 19, 2024
* update vc sign

* fix spec

* support signing with secp256k1 and ed25519 keys

* remove unused import

* add did ion test

---------

Co-authored-by: Moe Jangda <moe@tbd.email>
finn-block pushed a commit that referenced this pull request Mar 19, 2024
* update vc sign

* fix spec

* support signing with secp256k1 and ed25519 keys

* remove unused import

* add did ion test

---------

Co-authored-by: Moe Jangda <moe@tbd.email>
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.

3 participants