From d5a44580e2bf233a97a717ccf87da618a931d810 Mon Sep 17 00:00:00 2001 From: higherordertech Date: Fri, 6 Sep 2024 11:27:11 +1000 Subject: [PATCH] feat: P-1006 add new schema 27-linked-identities --- dist/schemas/27-linked-identities/1-0-0.json | 176 ++++++++++++++++++ packages/schemas/CHANGELOG.md | 6 + .../src/lib/27-linked-identities/1-0-0.ts | 34 ++++ 3 files changed, 216 insertions(+) create mode 100644 dist/schemas/27-linked-identities/1-0-0.json create mode 100644 packages/schemas/src/lib/27-linked-identities/1-0-0.ts diff --git a/dist/schemas/27-linked-identities/1-0-0.json b/dist/schemas/27-linked-identities/1-0-0.json new file mode 100644 index 0000000..ffd2bdc --- /dev/null +++ b/dist/schemas/27-linked-identities/1-0-0.json @@ -0,0 +1,176 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/27-linked-identities/1-0-0.json", + "title": "Linked web2/web3 identities", + "description": "All web2 and web3 identities you linked", + "type": "object", + "required": [ + "@context", + "issuer", + "issuanceDate", + "credentialSubject", + "proof" + ], + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + } + }, + "id": { + "type": "string" + }, + "type": { + "type": "array", + "items": { + "type": "string" + } + }, + "issuer": { + "type": "object", + "required": [ + "id", + "name", + "mrenclave" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "mrenclave": { + "type": "string" + }, + "runtimeVersion": { + "type": "object", + "required": [ + "parachain", + "sidechain" + ], + "properties": { + "sidechain": { + "type": "number" + }, + "parachain": { + "type": "number" + } + } + } + } + }, + "issuanceDate": { + "type": "string", + "format": "date-time" + }, + "proof": { + "type": "object", + "required": [ + "created", + "type", + "proofPurpose", + "proofValue", + "verificationMethod" + ], + "properties": { + "created": { + "type": "string", + "format": "date-time" + }, + "type": { + "type": "string" + }, + "proofPurpose": { + "type": "string" + }, + "proofValue": { + "type": "string" + }, + "verificationMethod": { + "type": "string" + } + } + }, + "credentialSubject": { + "title": "Credential Subject of Linked web2/web3 identities", + "type": "object", + "required": [ + "id", + "type", + "values", + "endpoint", + "assertions" + ], + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "description": { + "type": "string" + }, + "values": { + "type": "array", + "minItems": 1, + "items": { + "type": "boolean" + } + }, + "endpoint": { + "type": "string", + "format": "uri" + }, + "assertions": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": [ + "and" + ], + "properties": { + "and": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "additionalItems": false, + "items": [ + { + "type": "object", + "required": [ + "src", + "op", + "dst" + ], + "properties": { + "src": { + "type": "string", + "enum": [ + "$identities" + ] + }, + "op": { + "type": "string", + "enum": [ + "==" + ] + }, + "dst": { + "type": "string" + } + } + } + ] + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/schemas/CHANGELOG.md b/packages/schemas/CHANGELOG.md index 319074b..c936e7b 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-09-04 + +(ADDITION) [`27-linked-identities`](./src/lib/27-linked-identities/) bumped to 1-0-0 + +- Added new schema definition: 27-linked-identities. + ## 2024-08-02 (ADDITION) [`15-bnb-domain-holding-amount`](./src/lib/15-bnb-domain-holding-amount/) bumped to 1-1-1 diff --git a/packages/schemas/src/lib/27-linked-identities/1-0-0.ts b/packages/schemas/src/lib/27-linked-identities/1-0-0.ts new file mode 100644 index 0000000..0a0a878 --- /dev/null +++ b/packages/schemas/src/lib/27-linked-identities/1-0-0.ts @@ -0,0 +1,34 @@ +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'; + +// Reference: +// https://github.com/litentry/litentry-parachain/blob/dev/tee-worker/litentry/core/credentials-v2/src/linked_identities/mod.rs + +export const schema: JSONSchema7 = { + ...base, + + $id: resolveGitHubPath('27-linked-identities/1-0-0.json'), + + title: 'Linked web2/web3 identities', + description: 'All web2 and web3 identities you linked', + + properties: { + ...base.properties, + + credentialSubject: credentialSubject({ + title: 'Credential Subject of Linked web2/web3 identities', + assertions: assertion.and({ + items: [ + assertion.clause({ + src: ['$identities'], + op: ['=='], + dst: undefined, // identity array string. + }), + ], + }), + }), + }, +};