Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sphereon/pe-models

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sphereon/pe-models

DIF Presentation Exchange OpenAPI models by Sphereon

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source


Sphereon
Decentralized Identity Foundation
Presentation Exchange
OpenAPI

Table of Contents

Security

As with most security- and cryptography-related tools, the overall security of your system will largely depend on your design decisions (which key types you will use, where you'll store the private keys, what you put into your credentials, and so on.)

Background

This is an interpretation of the Presentation Exchange v1.0.0 specification as models.

It allows you to generate objects consistently while remaining compliant and consistent with the DIF specification.

Usage

Step 1 : Create Project

The models generated can be used in your project. This is an example where you create a new NPM project to use typescript language, import and use JwtObject. Similarly, you can import and use other objects.

cd '<workspace>'
mkdir my-pe-models-consumer-prj
cd my-pe-models-consumer-prj
npm init

npm init asks few questions. The default answer to those questions can be selected.

Step 2 : Add script & Import models

To use the models generated as a result of above in step 1

npm install
npm install --save @sphereon/pe-models
npm install --save ts-node

Create a folder named scripts

mkdir scripts

Create a file in 'scripts' named consumer-script.ts with following contents

import {JwtObject} from '@sphereon/pe-models'

var jwtObject : JwtObject = {
    alg : ['someAlgorithm']
};

console.log(jwtObject);

In package.json add a script "my-pe-models-consumer-script": "ts-node scripts/consumer-script.ts" in scripts section. Resulting Package.json may look like following.

{
  "name": "my-pe-models-consumer-prj",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
	"my-pe-models-consumer-script": "ts-node scripts/consumer-script.ts"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@sphereon/pe-models": "0.0.5",
    "ts-node": "^9.1.1"
  }
}

Step 3 : Check how it went

In terminal run following command from the <workspace>/my-pe-models-consumer-prj

cd '<workspace>/my-pe-models-consumer-prj'
npm run my-pe-models-consumer-script

You should expect this to be printed on console.

{ alg: [ 'someAlgorithm' ] }

Keywords

FAQs

Package last updated on 25 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc