Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make ctype schema id ipns uri #70

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code-examples/core_features/claiming/1_claiming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CType } from '@kiltprotocol/core'

export async function main(): Promise<CType> {
const ctype = CType.fromSchema({
$schema: 'http://kilt-protocol.org/draft-01/ctype#',
$schema: 'ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json',
title: 'Drivers License',
properties: {
name: {
Expand Down
2 changes: 1 addition & 1 deletion code-examples/core_features/did/9_did.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function getRandomCType(): CType {
// Random factor ensures that each created CType is unique and does not already exist on chain.
const randomFactor = UUID.generate()
return CType.fromSchema({
$schema: 'http://kilt-protocol.org/draft-01/ctype#',
$schema: 'ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json',
title: `CType ${randomFactor}`,
properties: {
name: {
Expand Down
2 changes: 1 addition & 1 deletion code-examples/workshop/attester/ctypeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Kilt from '@kiltprotocol/sdk-js'
// returns CTYPE from a schema
export function getCtypeSchema(): Kilt.CType {
return Kilt.CType.fromSchema({
$schema: 'http://kilt-protocol.org/draft-01/ctype#',
$schema: 'ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json',
title: 'Drivers License',
properties: {
name: {
Expand Down
6 changes: 3 additions & 3 deletions docs/sdk/0-core-feature/2_ctypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: CTypes
KILT uses [JSON-Schema](https://json-schema.org/) (currently draft-07) to validate and annotate data in a strict format. This data format for [CType models](https://github.com/KILTprotocol/sdk-js/blob/develop/packages/core/src/ctype/CTypeSchema.ts) forms a CType with the definition of its characteristics. The following are all required properties of the schema, with no additional properties allowed:

- Identifier: `$id` in the format `kilt:ctype:0x{cTypeHash}`
- KILT specific JSON-Schema: '[http://kilt-protocol.org/draft-01/ctype-input#](http://kilt-protocol.org/draft-01/ctype-input#)'
- KILT specific JSON-Schema: [`ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json`](https://ipfs.io/ipns/k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json)
- Title: defines a user-friendly name for the CType that makes it easier for users to contextualise
- Properties: Each property is the attribute the claimer wishes to have attested by the attester.

Expand All @@ -29,7 +29,7 @@ When making a claim for a CType, all the following properties are required:
```js
{
$id: 'kilt:ctype:0xda3861a45e0197f3ca145c2c209f9126e5053fas503e459af4255cf8011d51010',
$schema: 'http://kilt-protocol.org/draft-01/ctype#',
$schema: 'ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json',
title: 'CtypeModel 2',
properties: {
name: { type: 'string' },
Expand All @@ -50,7 +50,7 @@ A claim from a nested CType requires the given CType, a list of comprised schema
```js
nested = {
$id: 'kilt:ctype:0xda3861a45e0197f3ca145c2c20f9f126e5053fas503e459af4255cf8011d51010',
$schema: 'http://kilt-protocol.org/draft-01/ctype#',
$schema: 'ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json',
title: 'KYC and Passport',
type: 'object',
properties: {
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/1-workshop/03-attester/03-ctype.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For example, a very basic CType for a driver's license could look like this:
{
"schema": {
"$id": "kilt:ctype:0xd8ad043d91d8fdbc382ee0ce33dc96af4ee62ab2d20f7980c49d3e577d80e5f5",
"$schema": "http://kilt-protocol.org/draft-01/ctype#",
"$schema": "ipns://k51qzi5uqu5dkglos1mtdukd4axyhwav7e98bga8g2nptrkgcbj9506ruoadiz/v1/ctype.json",
"title": "Drivers License",
"properties": {
"name": {
Expand Down