Skip to content

Commit

Permalink
add new platform user support: DarenMarket (#42)
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Alvarez <[email protected]>
Co-authored-by: BillyWooo <[email protected]>
Co-authored-by: Jonathan Alvarez <[email protected]>
  • Loading branch information
3 people authored Jul 16, 2024
1 parent 1cc0969 commit c1796e6
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/check-json-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ jobs:
uses: actions/checkout@v2

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 7
run_install: true

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Generate latest json schemas
run: |
pnpm generate
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,25 @@ jobs:
main-branch-name: 'main'

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
id: pnpm-install
with:
version: 7
run_install: true

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run tests
run: |
pnpm test
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"
]
}
}
}
]
}
}
}
}
}
}
}
}
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-07-15

(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
42 changes: 42 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,42 @@
/**
* Adds `DarenMarket` platform.
*/

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 c1796e6

Please sign in to comment.