Skip to content

Commit

Permalink
add new platform user support: DarenMarket
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyWooo committed Jul 15, 2024
1 parent 1cc0969 commit 883155a
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 1 deletion.
181 changes: 181 additions & 0 deletions dist/schemas/24-platform-user/1-1-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/litentry/vc-jsonschema/main/dist/schemas/24-platform-user/1-1-2.json",
"title": "Platform user",
"description": "You are a user of a certain platform",
"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 Platform user",
"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": [
"$platform"
]
},
"op": {
"type": "string",
"enum": [
"=="
]
},
"dst": {
"type": "string",
"enum": [
"KaratDao",
"MagicCraft",
"DarenMarket",
]
}
}
}
]
}
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion dist/schemas/24-platform-user/latest.json
6 changes: 6 additions & 0 deletions packages/schemas/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-2

- Support `DarenMarket` platform.

## 2024-07-10

(ADDITION) [`26-nft-holder`](./src/lib/26-nft-holder/) bumped to 1-1-2
Expand Down
38 changes: 38 additions & 0 deletions packages/schemas/src/lib/24-platform-user/1-1-2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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',
"DarenMarket",
];

export const schema: JSONSchema7 = {
...base,

$id: resolveGitHubPath('24-platform-user/1-1-2.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,
}),
],
}),
}),
},
};

0 comments on commit 883155a

Please sign in to comment.