diff --git a/README.md b/README.md index 0faf936..8d97cfb 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,11 @@ It contains: - `example` directory: exemplary VC for each assertion type - `packages/schema` directory: JSONSchema for each assertion type - `packages/validator` directory: Utility to validate schemas from a VC string. + +## Contributing + +1. Locate the schema you want to update on `packages/schema`. You can tell it from the VC's `credentialSchema.id` value. +1. Follow the versioning described in `packages/schema`'s README to name the new version. +1. The README describes how to generate the schemas from its model too. +1. Update the CHANGELOG. +1. Publish the pull request. diff --git a/dist/schemas/24-platform-user/1-1-1.json b/dist/schemas/24-platform-user/1-1-1.json index 02f3fbf..a3e15c8 100644 --- a/dist/schemas/24-platform-user/1-1-1.json +++ b/dist/schemas/24-platform-user/1-1-1.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/24-platform-user/1-1-0.json", + "$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/24-platform-user/1-1-1.json", "title": "Platform user", "description": "You are a user of a certain platform", "type": "object", diff --git a/dist/schemas/24-platform-user/latest.json b/dist/schemas/24-platform-user/latest.json index 854654e..2e051d7 120000 --- a/dist/schemas/24-platform-user/latest.json +++ b/dist/schemas/24-platform-user/latest.json @@ -1 +1 @@ -1-1-1.json \ No newline at end of file +1-1-0.json \ No newline at end of file diff --git a/packages/schemas/CHANGELOG.md b/packages/schemas/CHANGELOG.md index 2e3d27f..a01c5fa 100644 --- a/packages/schemas/CHANGELOG.md +++ b/packages/schemas/CHANGELOG.md @@ -9,6 +9,12 @@ and this project follows [Schema Versioning](https://docs.snowplow.io/docs/pipel - +## 2024-05-10 + +(ADDITION) [`24-platform-user`](./src/lib/24-platform-user/) bumped to 1-1-s1 + +- Support `MagicCraft` platform. + ## 2024-04-30 (REVISION) [`25-token-holding-amount`](./src/lib/25-token-holding-amount/) bumped to 1-1-0 @@ -23,6 +29,12 @@ and this project follows [Schema Versioning](https://docs.snowplow.io/docs/pipel (MODEL) [`25-token-holding-amount`](./src/lib/25-token-holding-amount/) initial to 1-0-0 +## 2024-04-25 + +(ADDITION) [`21-evm-holding-amount`](./src/lib/21-evm-holding-amount/) bumped to 1-1-1 + +- Support `MCRT` token. + ## 2024-04-02 (ADDITION) Schema [`21-evm-holding-amount`](./src//lib/21-evm-holding-amount/) bumped to 1-1-1 diff --git a/packages/schemas/src/lib/24-platform-user/1-1-1.ts b/packages/schemas/src/lib/24-platform-user/1-1-1.ts new file mode 100644 index 0000000..61b9f74 --- /dev/null +++ b/packages/schemas/src/lib/24-platform-user/1-1-1.ts @@ -0,0 +1,37 @@ +import { JSONSchema7 } from 'json-schema'; + +import { schema as base } from '../0-base/1-1-0'; +import { resolveGitHubPath } from '../helpers'; +import { credentialSubject, assertion } from '../schema-helpers'; + +const supportedPlatforms = [ + // https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials-v2/src/platform_user/mod.rs + 'KaratDao', + 'MagicCraft', +]; + +export const schema: JSONSchema7 = { + ...base, + + $id: resolveGitHubPath('24-platform-user/1-1-1.json'), + + title: 'Platform user', + description: 'You are a user of a certain platform', + + properties: { + ...base.properties, + + credentialSubject: credentialSubject({ + title: 'Credential Subject of Platform user', + assertions: assertion.and({ + items: [ + assertion.clause({ + src: ['$platform'], + op: ['=='], + dst: supportedPlatforms, + }), + ], + }), + }), + }, +};