Skip to content

Commit

Permalink
Merge pull request #30 from transmute-industries/feat/vp-exchange
Browse files Browse the repository at this point in the history
Add VP Request Plugin
  • Loading branch information
OR13 authored Apr 7, 2021
2 parents 15abd50 + 9f5828e commit 0b34b99
Show file tree
Hide file tree
Showing 45 changed files with 12,718 additions and 163 deletions.
224 changes: 133 additions & 91 deletions packages/universal-wallet-vc-plugin/package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion packages/universal-wallet-vc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@mattrglobal/jsonld-signatures-bbs": "^0.8.0",
"@transmute/did-key-ed25519": "^0.2.1-unstable.35",
"@transmute/ed25519-signature-2018": "^0.6.1-unstable.10",
"@transmute/universal-wallet": "^0.6.1-unstable.10",
"@transmute/universal-wallet-test-vectors": "^0.6.1-unstable.10",
"ts-jest": "^26.5.4",
"tsdx": "^0.14.1",
Expand All @@ -42,7 +43,8 @@
"dependencies": {
"@transmute/vc-status-rl-2020": "^0.6.1-unstable.10",
"@transmute/vc.js": "^0.2.1-unstable.10",
"factory.ts": "^0.5.1"
"factory.ts": "^0.5.1",
"uuid": "^8.3.2"
},
"gitHead": "37f52c102233963d1369862e104df87dd4c5d063"
}
28 changes: 28 additions & 0 deletions packages/universal-wallet-vc-plugin/src/Plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as Factory from "factory.ts";

import { VcPlugin } from "./types";

import { issue } from "./issue";
import { verifyCredential } from "./verifyCredential";
import { createVerifiablePresentation } from "./createVerifiablePresentation";
import { deriveCredential } from "./deriveCredential";
import { verifyPresentation } from "./verifyPresentation";

const factoryDefaults = {
// issuer
issue,

// verifier
verifyCredential,
verifyPresentation,

// holder
createVerifiablePresentation,
deriveCredential,
};

const pluginFactory = Factory.Sync.makeFactory<VcPlugin>(factoryDefaults);

const plugin = pluginFactory.build();

export { VcPlugin, pluginFactory, factoryDefaults, plugin };
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Factory from "factory.ts";
import * as Wallet from "@transmute/universal-wallet";
import * as Vc from "../index";

export interface WalletFactory extends Wallet.Wallet, Vc.VcPlugin {}

export const walletFactory = Factory.Sync.makeFactory<WalletFactory>({
...Wallet.walletDefaults,
...Vc.factoryDefaults,
})
.combine(Wallet.walletFactory)
.combine(Vc.pluginFactory);
47 changes: 1 addition & 46 deletions packages/universal-wallet-vc-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1 @@
import * as Factory from "factory.ts";

import {
IssueCredential,
VerifyCredential,
PresentCredentials,
VerifyPresentation,
DeriveCredential
} from "./types";

import { issue } from "./issue";
import { verifyCredential } from "./verifyCredential";
import { createVerifiablePresentation } from "./createVerifiablePresentation";
import { deriveCredential } from "./deriveCredential";

import { verifyPresentation } from "./verifyPresentation";

interface VcPlugin {
// issuer
issue: (config: IssueCredential) => Promise<any>;
// holder
createVerifiablePresentation: (config: PresentCredentials) => Promise<any>;
deriveCredential: (config: DeriveCredential) => Promise<any>;
// verifier
verifyCredential: (config: VerifyCredential) => Promise<any>;
verifyPresentation: (config: VerifyPresentation) => Promise<any>;
}

const factoryDefaults = {
// issuer
issue,

// holder
createVerifiablePresentation,
deriveCredential,

// verifier
verifyCredential,
verifyPresentation
};

const pluginFactory = Factory.Sync.makeFactory<VcPlugin>(factoryDefaults);

const plugin = pluginFactory.build();

export { VcPlugin, pluginFactory, factoryDefaults, plugin };
export * from "./Plugin";
25 changes: 25 additions & 0 deletions packages/universal-wallet-vc-plugin/src/types/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export interface IssueCredential {
credential: any;
options: any;
}

export interface VerifyCredential {
credential: any;
options: any;
}

export interface PresentCredentials {
verifiableCredential: any;
options: any;
}

export interface VerifyPresentation {
presentation: any;
options: any;
}

export interface DeriveCredential {
verifiableCredential: any;
frame: any;
options: any;
}
20 changes: 20 additions & 0 deletions packages/universal-wallet-vc-plugin/src/types/Plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {
IssueCredential,
VerifyCredential,
VerifyPresentation,
PresentCredentials,
DeriveCredential,
} from "./Interfaces";

export interface VcPlugin {
// issuer
issue: (config: IssueCredential) => Promise<any>;

// verifier
verifyCredential: (config: VerifyCredential) => Promise<any>;
verifyPresentation: (config: VerifyPresentation) => Promise<any>;

// holder
createVerifiablePresentation: (config: PresentCredentials) => Promise<any>;
deriveCredential: (config: DeriveCredential) => Promise<any>;
}
3 changes: 3 additions & 0 deletions packages/universal-wallet-vc-plugin/src/types/Wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Wallet } from "@transmute/universal-wallet";
import { VcPlugin } from "./Plugin";
export interface VcWalletFactory extends Wallet, VcPlugin {}
28 changes: 3 additions & 25 deletions packages/universal-wallet-vc-plugin/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
export interface IssueCredential {
credential: any;
options: any;
}

export interface VerifyCredential {
credential: any;
options: any;
}

export interface PresentCredentials {
verifiableCredential: any;
options: any;
}

export interface VerifyPresentation {
presentation: any;
options: any;
}

export interface DeriveCredential {
verifiableCredential: any;
frame: any;
options: any;
}
export * from "./Interfaces";
export * from "./Plugin";
export * from "./Wallet";
1 change: 1 addition & 0 deletions packages/universal-wallet-vc-plugin/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare module "isomorphic-webcrypto";
declare module "uuid";
4 changes: 4 additions & 0 deletions packages/universal-wallet-vp-exchange-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.log
.DS_Store
node_modules
dist
16 changes: 16 additions & 0 deletions packages/universal-wallet-vp-exchange-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @transmute/universal-wallet-vp-exchange-plugin

```
npm i @transmute/universal-wallet-vp-exchange-plugin --save
```

## Getting Started

```
git clone git@github.com:transmute-industries/verifiable-data.git
npm packages/universal-wallet-vp-exchange-plugin; // note that this is a mono repo
npm i
npm run lint
npm run test
npm run build
```
Loading

0 comments on commit 0b34b99

Please sign in to comment.