Skip to content

Commit

Permalink
feat: v4 beta release (#297)
Browse files Browse the repository at this point in the history
* feat: oa v4 (alpha) (#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

chore: remove required fields (#271)

feat: align against W3C VC 2.0 test suite and complete unit tests (#272)

* chore: npm install jsonld & joi

- upgrade @types/jsonld and ts-node

* chore: add vc 2.0 context url and store as cache

- instead of keeping a local copy, may consider to use node-cache in the future

* fix: align validation with vc 2.0 test suite

- fix: utilise "expand" from jsonld to ensure provided @context are interpretable
- fix: improve readability and allow flexibility in oa v4 schema (wrap vs unwrapped, etc.)

* fix: set additionalProperties to false due to AJV false positive

* fix: allow additional properties in credentialStatus

* fix: include error details instead of console log

* test: update v4 alpha test fixtures

* lint: ignore unused argument options

* chore: upgrade jest and ts-jest

* fix: segmentation fault when using default nodeDocumentLoader()

* fix: use scoped context types

avoid using sub types (e.g. renderMethodType = EMBEDDED_RENDERER) and just utilise a scoped context (e.g. type = OpenAttestationEmbeddedRenderer)

* test: no more auto-correct for @context based on vc 2.0 test suite

expected behaviour is to throw error

* fix: digest should handle falsy values correctly

* fix: rename to renderMethod.templateName

* fix: make renderMethod an array

* fix: remove json schema validation in v4.0 wrap

* test: update v4.0 fixtures

* fix: digest test

* fix: make renderMethod.templateName required in v4.0 json schema

* fix: migrate to zod for input vc data model validation

* wip: oa v4 types

* refactor: prefer string union

* refactor: reference constant tuple instead

* refactor: finalTypes follows pattern of finalContexts

* refactor: document -> raw document for clarity

* fix: rawDocument should not be used directly for digest and salting

* fix: remove asserting to string to let the literal infer properly

* fix: typings

* refactor: move assertion earlier

* refactor: assert oa vc than try vc

* fix: refer to new oa vc type in digest and verify

* fix: refer to new oa vc typings

* fix: refer to new oa vc typings

* fix: refer to new oa vc typings

* refactor: improve naming consistency

* fix: typing, should be looser

* fix: a union b does not override a props with b props

* fix: added assertion type to prevent accident extension to base type

* refactor: wording

* refactor: better readability for wrapped types

* refactor: move things within file and some renaming

* refactor: improve naming of variables

* fix: use new typings

* fix: passthroughs needed to allow extension, added name and render method so they dont get stripped

* test: added a guard test which is currently failing

* refactor: merged data model with types and renamed VC type

* refactor: improve helper fn naming

* fix: use extend instead of and since it results in dup errors, remove hex validation since these props are generated by us, allow passthrough for wrap proof so that a signed wrap can pass a wrap only validation test

* test: update snapshot

* fix: was using the wrong document for the check

* test: added tests for wrapped only document

* fix: diagnose to use new guards

* fix: path

* chore: remove vscode

* chore: ignore vscode settings

* chore: remove experimental version guard

* fix: add back the missing wrapDocuments that was accidentally removed

* fix: replace back original implementation of getMerkleRoot

* fix: make our own real types stricter

* fix: diagnose did not handle raw v4

* refactor: remove useless renaming

* fix: object object in test case

* refactor: improve type safety of wrap document v4

* chore: remove to make way for auto generated fixtures

* chore: auto generate v4 fixtures

* fix: could not generated nested dir

* test: add wrap unit tests

* test: extra assertion for proof

* fix: salt test

* fix: allow resigning and validate proof before using

* fix: v4 sign tests

* chore: add batch wrapped document fixture. freeze all documents before exporting

* fix: obfuscate typing was loses the initial input typing

* fix: should not allow obfuscate to produce non compliant v4 wrapped document

* fix: partially fix obfuscate test

* fix: it is more accurate that credentials subject after obfuscastion shd be deeply partial

* fix: clean up digest test

* feat: support attachments

* fix: digestMultibase shd be optional, added descriptions to fields

* refactor: remove renderMethod from w3c model and force it to be exported in passthrough mode

* chore: improve guard test to use direct output of our fns as test case

* fix: allow attachment item to be empty so that obfuscation of a single attachment item is possible

* refactor: improve typing

* fix: partial fix of obfuscate test

* wip: draft of changes to address issues raised

* fix: wrongly returned object for boolean

* fix: shd not allow new empty objects after obfuscation or removing array items

* chore: update fixtures

* fix: digest should not include proof

* fix: skip finding leaf nodes to hash if document without proof is empty

* refactor: improve naming

* fix: broken tests

* fix: revert target bump

* fix: all obfuscate tests

* fix: verify should treat salt not found error as invalid

* fix: partial fix of verify tests, added bunch of todos

* chore: add batched signed documents

* fix: complete verify tests

* refactor: typo remove redundant top describe

* fix: fixtures and test it will break on update

* refactor: improve error message to provide more guidance

* fix: array items cannot be undefined

* chore: commit generated fixtures and allow ci tests to catch any drifts

* chore: added remedy action if fixture test fails

* chore: remove lint for all generated files

* fix: v4 e2e

* refactor: improve error types and exporting

---------

Co-authored-by: Phan Shi Yu <[email protected]>
Co-authored-by: Phan Shi Yu <[email protected]>

* Chore: tidy v4 exports (#278)

* refactor: shift context constants into 4.0

* refactor: bring context down to root of 4.0

* refactor: add custom error class, change algorithm to non enum

* refactor: only leave the bare essentials of v4 in root index, fix tests

* refactor: free up 4.0 from the mess of dependencies caused by importing of utils

* fix: circular dependency caused by getData

* feat: v4 utility guards

* feat: export v4

* chore: generate v4 json schemas based with zod (#279)

* chore: generate v4 json schemas based with zod

* fix: small typo

* chore: sign document should be clear on what errors it could throw, export of v4 verify shd be more explicit (#280)

* chore: sign document should be clear on what errors it could throw

* fix: verify export naming shd be more explicit

* fix: bump target platform, and remove baseUrl as it is not supported (#282)

* fix: bump target platform, and remove baseUrl as it is not supported

* refactor: lint

* Feat:document builder (#283)

* feat: document builder poc

* test: happy flow tests

* refactor: improve comments

* chore: export builder

* test: more tests

* fix: added logic to prevent re-setting of values

* fix: guard constructor and added more test cases to test guards

* fix: revocation support (#285)

* fix: added revocation methods, refactor: revamp state management in instance

* fix: tests

* feat: added revocation store revocation method

* feat: implemented revocation store revocation builder method

* test: update to check credentialStatus

* fix: improve ethereum address validation

* tests: added tests for revocation store revocation method

* chore: update json schemas

* chore: update descriptions

* chore: setup husky and lintstaged

* fix: clean up hashing utils from utils and fix brokenreferences

* feat: remove the need to polyfill manually in browser envs

* fix: test

* fix: remove use of crypto completely

* fix: import buffer based on docs

* fix: rendering methods (#287)

* fix: missing svg renderer props and no renderer method

* fix: only add render method if its defined

* chore: improve handle bar template description

* fix: improved descriptions on documentLoader's interface

* fix: improving naming and description

* feat: computeDigestMultibase (#288)

* fix: only generate json fixtures when fixtures.ts changes (#289)

* fix: move attachments into credentialSubject (#290)

* fix: renamed document (#291)

* fix: obfuscate typing and guard exports (#292)

* fix: obfuscate typing refused to accept document that could be multiple version

* fix: improve consistency of utils guard

* fix: simplify obfuscateVerifiableCredential typing

* fix: obfuscation return type should still have a compliant attachment… (#293)

* fix: obfuscation return type should still have a compliant attachment array

* fix: improve typing more

* fix: mark v3 functions as deprecated (#298)

---------

Co-authored-by: Phan Shi Yu <[email protected]>
Co-authored-by: Phan Shi Yu <[email protected]>
  • Loading branch information
3 people committed Jul 25, 2024
1 parent 239bdba commit 26c7aaf
Show file tree
Hide file tree
Showing 74 changed files with 9,076 additions and 1,528 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
coverage
dist
src/__generated__
__generated__
vc-test-suite
*.d.ts
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"func-names": ["error", "as-needed"],
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ on:
push:
branches:
- master
- alpha
- beta
- +([0-9])?(.{+([0-9]),x}).x

Expand Down Expand Up @@ -30,12 +31,8 @@ jobs:
node-version: 18.x
- run: npm ci && npm run postinstall
- run: npm run build
- uses: codfish/semantic-release-action@v2
id: semantic
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Output new release version
if: steps.semantic.outputs.new-release-published == 'true'
run: |
echo "🎉 New Release Published: ${{ steps.semantic.outputs.release-version }}"
run: npx semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ yarn.lock
*.iml
/public
/vc-test-suite
/.vscode
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"src/4.0/types.ts": ["npm run generate-v4-json-schemas", "git add src/4.0/jsonSchemas/__generated__"],
"src/4.0/fixtures.ts": ["npm run generate-v4-fixtures", "git add test/fixtures/v4/__generated__"],
"*.{js,ts}": "eslint --fix"
}
13 changes: 13 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"branches": [
"master",
{
"name": "alpha",
"prerelease": true
},
{
"name": "beta",
"prerelease": true
}
]
}
Loading

0 comments on commit 26c7aaf

Please sign in to comment.