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

feat: idvc on v4 #6

Merged
merged 13 commits into from
Nov 10, 2023
Merged

feat: idvc on v4 #6

merged 13 commits into from
Nov 10, 2023

Conversation

cavacado
Copy link

@cavacado cavacado commented Nov 1, 2023

Summary

What is the background of this pull request?
This PR introduces a new tradetrust document type that differs from the current oa-v4-alpha document.
look at: Open-Attestation/schemata#81 for the differences in schema and contexts.
As a new document type is introduced, the relevant type guards/salt/sign/wrap functionalities are all duplicated.

On top of that, it renames all current v4 references to prefix it with OA since there is a request for backwards compatibility for this particular fork.

For certain guards, additional code has been added to ensure that a verifier would not mistake a raw v4 oa document with a raw v4 tt document.

For this fork, we would not generate existing v2 and v3 schemas as we would be reusing the hosted ones.

For context preloading, we are resolving the w3c based ones to the locally saved copy, why? for the past few weeks, the w3c contexts have been giving intermittent responses or giving throttled responses, so this is a stop gap measure to ensure that the functionality works. (I am open to change it at a later time).

quicktype: 15.0.260 -> 23.076
For the generation of types via quicktype, have discovered that the version of quicktype we are currently on does not respect JSON schema's additionalProperties glideapps/quicktype#1615

Do tell me if its too gigantic, and I would try to split the PR into something like that:

  1. renaming the alpha v4 OA docs 1PR
  2. the rest.

Issues

What are the related issues or stories?
story card: https://www.pivotaltracker.com/story/show/186245911

Other stuff to do:

1. Currently most of the Tradetrust documents fixtures are utilising localhost:8080 which points to a dev server where I am serving the contexts, once Open-Attestation/schemata#81 gets merged, I would need to replace those fixtures.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

eslint

test/fixtures/v4/tt/did-idvc-wrapped-signed-wrong-binding.json|131 col 2| Insert
test/fixtures/v4/tt/did-idvc-wrapped-signed.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-idvc-wrapped-signed.json|28 col 20| Replace ⏎············"VerifiableCredential"⏎·········· with "VerifiableCredential"
test/fixtures/v4/tt/did-idvc-wrapped-signed.json|35 col 22| Replace ⏎··············"CorporateBasicDetails"⏎············ with "CorporateBasicDetails"
test/fixtures/v4/tt/did-idvc-wrapped-signed.json|131 col 2| Insert
test/fixtures/v4/tt/did-idvc-wrapped-tampered-signature.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-idvc-wrapped-tampered-signature.json|28 col 20| Replace ⏎············"VerifiableCredential"⏎·········· with "VerifiableCredential"
test/fixtures/v4/tt/did-idvc-wrapped-tampered-signature.json|35 col 22| Replace ⏎··············"CorporateBasicDetails"⏎············ with "CorporateBasicDetails"
test/fixtures/v4/tt/did-idvc-wrapped-tampered-signature.json|129 col 2| Insert
test/fixtures/v4/tt/did-idvc-wrapped-wrong-binding.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-idvc-wrapped-wrong-binding.json|28 col 20| Replace ⏎············"VerifiableCredential"⏎·········· with "VerifiableCredential"
test/fixtures/v4/tt/did-idvc-wrapped-wrong-binding.json|35 col 22| Replace ⏎··············"CorporateBasicDetails"⏎············ with "CorporateBasicDetails"
test/fixtures/v4/tt/did-idvc-wrapped-wrong-binding.json|129 col 2| Insert
test/fixtures/v4/tt/did-idvc-wrapped.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-idvc-wrapped.json|28 col 20| Replace ⏎············"VerifiableCredential"⏎·········· with "VerifiableCredential"
test/fixtures/v4/tt/did-idvc-wrapped.json|35 col 22| Replace ⏎··············"CorporateBasicDetails"⏎············ with "CorporateBasicDetails"
test/fixtures/v4/tt/did-idvc-wrapped.json|129 col 2| Insert
test/fixtures/v4/tt/did-wrapped-obfuscated.json|2 col 16| Replace "https://www.w3.org/2018/credentials/v1",·"https://schemata.openattestation.com/io/tradetrust/4.0/alpha-context.json" with ⏎····"https://www.w3.org/2018/credentials/v1",⏎····"https://schemata.openattestation.com/io/tradetrust/4.0/alpha-context.json"⏎··
test/fixtures/v4/tt/did-wrapped-signed.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-wrapped-signed.json|92 col 2| Insert
test/fixtures/v4/tt/did-wrapped-signed2.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-wrapped-signed2.json|92 col 2| Insert
test/fixtures/v4/tt/did-wrapped.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-wrapped.json|90 col 2| Insert
test/fixtures/v4/tt/did-wrapped2.json|6 col 12| Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"
test/fixtures/v4/tt/did-wrapped2.json|90 col 2| Insert

keys?: [string, string];
}
const run = async ({ location, keys }: IRun) => {
let resolved = path.resolve(location);
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prefer-const> reported by reviewdog 🐶
'resolved' is never reassigned. Use 'const' instead.

Suggested change
let resolved = path.resolve(location);
const resolved = path.resolve(location);

}
const run = async ({ location, keys }: IRun) => {
let resolved = path.resolve(location);
let name = path.basename(resolved);
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prefer-const> reported by reviewdog 🐶
'name' is never reassigned. Use 'const' instead.

Suggested change
let name = path.basename(resolved);
const name = path.basename(resolved);

const run = async ({ location, keys }: IRun) => {
let resolved = path.resolve(location);
let name = path.basename(resolved);
let dirName = path.dirname(resolved);
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prefer-const> reported by reviewdog 🐶
'dirName' is never reassigned. Use 'const' instead.

Suggested change
let dirName = path.dirname(resolved);
const dirName = path.dirname(resolved);

let resolved = path.resolve(location);
let name = path.basename(resolved);
let dirName = path.dirname(resolved);
let document = readFile(resolved);
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prefer-const> reported by reviewdog 🐶
'document' is never reassigned. Use 'const' instead.

Suggested change
let document = readFile(resolved);
const document = readFile(resolved);

let dirName = path.dirname(resolved);
let document = readFile(resolved);
if (utils.isRawOAV4Document(document)) {
let wrapName = name.replace("raw", "wrapped");
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prefer-const> reported by reviewdog 🐶
'wrapName' is never reassigned. Use 'const' instead.

Suggested change
let wrapName = name.replace("raw", "wrapped");
const wrapName = name.replace("raw", "wrapped");

Comment on lines 35 to 37
"type": [
"CorporateBasicDetails"
],
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎··············"CorporateBasicDetails"⏎············ with "CorporateBasicDetails"

Suggested change
"type": [
"CorporateBasicDetails"
],
"type": ["CorporateBasicDetails"],

"key": "did:ethr:0xE94E4f16ad40ADc90C29Dc85b42F1213E034947C#controller",
"signature": "0x725dc1af3ec48a3b1a279c6b09e96a69d92c9f20f1570c3a00984bce20240d591782ab1b36de4fb57f445811c3e41805f1663bcbddfa842e00b85370127f9b1d1b"
}
}
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert

Suggested change
}
}

Comment on lines 6 to 9
"type": [
"VerifiableCredential",
"TradeTrustCredential"
],
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"

Suggested change
"type": [
"VerifiableCredential",
"TradeTrustCredential"
],
"type": ["VerifiableCredential", "TradeTrustCredential"],

Comment on lines 28 to 30
"type": [
"VerifiableCredential"
],
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎············"VerifiableCredential"⏎·········· with "VerifiableCredential"

Suggested change
"type": [
"VerifiableCredential"
],
"type": ["VerifiableCredential"],

Comment on lines 35 to 37
"type": [
"CorporateBasicDetails"
],
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎··············"CorporateBasicDetails"⏎············ with "CorporateBasicDetails"

Suggested change
"type": [
"CorporateBasicDetails"
],
"type": ["CorporateBasicDetails"],

@cavacado cavacado changed the title Feat/idvc on v4 feat: idvc on v4 Nov 1, 2023
@cavacado cavacado marked this pull request as ready for review November 6, 2023 01:30
Comment on lines 6 to 9
"type": [
"VerifiableCredential",
"TradeTrustCredential"
],
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"

Suggested change
"type": [
"VerifiableCredential",
"TradeTrustCredential"
],
"type": ["VerifiableCredential", "TradeTrustCredential"],

"obfuscated": []
}
}
}
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert

Suggested change
}
}

Comment on lines 6 to 9
"type": [
"VerifiableCredential",
"TradeTrustCredential"
],
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Replace ⏎····"VerifiableCredential",⏎····"TradeTrustCredential"⏎·· with "VerifiableCredential",·"TradeTrustCredential"

Suggested change
"type": [
"VerifiableCredential",
"TradeTrustCredential"
],
"type": ["VerifiableCredential", "TradeTrustCredential"],

"key": "did:ethr:0xE94E4f16ad40ADc90C29Dc85b42F1213E034947C#controller",
"signature": "0x3d75668bff0071088858d7aee535bf2df0c2536ada0690823b941dfa3c64ca6001c495aa53b1cedd870f5712e075fa558e22c42b0aa61b3141ab9ec3a327c6821c"
}
}
Copy link

Choose a reason for hiding this comment

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

🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Insert

Suggested change
}
}

@cavacado cavacado merged commit bde00cf into alpha Nov 10, 2023
5 checks passed
Copy link

🎉 This PR is included in version 1.0.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 6.8.0-alpha.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

cavacado added a commit that referenced this pull request Nov 10, 2023
* chore: ds store

* feat: init release

* chore: commit lock

* feat: idvc feature

* feat: idvc feature

* chore: fix lint errors

* feat: regenerate test fixtures for ttv4

* fix: lint errors

* chore: update readme

* chore: fix lint errors

* feat: add additional fixtures for invalid idvc case

* feat: add fixtures for error case when idvc is missing

* fix: lint errors
cavacado added a commit that referenced this pull request Nov 10, 2023
* feat: init release (#4)

* feat: trigger tagged build (#8)

* feat: oa v4 (alpha) (Open-Attestation#254)

* ci: prepare alpha release

* feat: oa v4 alpha

* fix: lint errors

* test: update fixtures

* chore: update id description

* test: update fixtures

* chore: improve readability

* fix: pr review suggestions

* fix: stricter checks for isStringArray

* fix: getDocumentData for v4

* chore: update getTemplateURL error message

* feat: idvc on v4 (#6)

* chore: ds store

* feat: init release

* chore: commit lock

* feat: idvc feature

* feat: idvc feature

* chore: fix lint errors

* feat: regenerate test fixtures for ttv4

* fix: lint errors

* chore: update readme

* chore: fix lint errors

* feat: add additional fixtures for invalid idvc case

* feat: add fixtures for error case when idvc is missing

* fix: lint errors

* feat: tagged release, update badge for github actions

* feat: trigger release after rebase of alpha

---------

Co-authored-by: Kyle Huang Junyuan <kyle@hjunyuan.com>
@isaackps isaackps deleted the feat/idvc-on-v4 branch December 28, 2023 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant