-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from transmute-industries/feat/vp-exchange
Add VP Request Plugin
- Loading branch information
Showing
45 changed files
with
12,718 additions
and
163 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
12 changes: 12 additions & 0 deletions
12
packages/universal-wallet-vc-plugin/src/__fixtures__/walletFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
25
packages/universal-wallet-vc-plugin/src/types/Interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
declare module "isomorphic-webcrypto"; | ||
declare module "uuid"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.log | ||
.DS_Store | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
Oops, something went wrong.