1.3.2 • Published 3 years ago

@kravc/portal v1.3.2

Weekly downloads
10
License
ISC
Repository
github
Last release
3 years ago

@kravc/portal

Client for managing Portal issuers and verifiable credential types.

Quick Start

Install npm package as development dependency:

npm i --save-dev @kravc/portal
npm i --save-dev @kravc/dos-ssi

Register Issuer

Create ./issuer.json file containing issuer metadata, icon and credential types, e.g:

{
  "iconPath": "icon.png",
  "metadata": {
    "url":      "https://portal.kra.vc/minesweeper/",
    "title":    "Minesweeper",
    "subtitle": "Classic board puzzle",
    "category": "Games"
  },
  "credentialTypes": [
    {
      "name": "Score",
      "version": 1,
      "schemas": [
        {
          "name": "Player",
          "fields": [
            { "name": "id",                "$type": "string" },
            { "name": "hasVideoGameScore", "$type": "ref", "$ref": "VideoGameScore" }
          ]
        },
        {
          "name": "VideoGameScore",
          "fields": [
            { "name": "videoGame",      "$type": "ref", "$ref": "VideoGame" },
            { "name": "wins",           "$type": "integer" },
            { "name": "rounds",         "$type": "integer" },
            { "name": "winRate",        "$type": "integer" },
            { "name": "topScore",       "$type": "integer" },
            { "name": "topScoreJson",   "$type": "string" },
            { "name": "bestStreak",     "$type": "integer" },
            { "name": "bestStreakJson", "$type": "string" },
            { "name": "enduranceMs",    "$type": "integer" },
            { "name": "bestRoundMs",    "$type": "integer" },
            { "name": "bestRoundJson",  "$type": "string" },
            { "name": "averageRoundMs", "$type": "integer" },
            { "name": "dateStarted",    "$type": "dateTime" }
          ]
        },
        {
          "url":  "https://schema.org/",
          "name": "VideoGame",
          "fields": [
            { "name": "url",     "$type": "string" },
            { "name": "name",    "$type": "string" },
            { "name": "version", "$type": "string" }
          ]
        }
      ]
    }
  ]
}

Registers a new issuer on the Portal:

npx portal

If the script runs for the first time it generates key pair (DID) for the administrator and stores it in the local keychain. This behavior could be overriden by using .portal.json file. To preconfigure administrators identity generate private key seed using command (requires @kravc/dos-ssi to be installed as development dependency):

npx seed

Create .portal.json file replacing DEFAULT_SEED with the value generated via seed command:

{
  "default": "DEFAULT_SEED"
}

Make sure file is added to the .gitignore and is not committed. Check out full set of files at example/ folder.

1.2.0

3 years ago

1.1.0

3 years ago

1.3.2

3 years ago

1.3.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago