diff --git a/app/__test-fixtures__/contextTestHelpers.tsx b/app/__test-fixtures__/contextTestHelpers.tsx index 36713a2262..997e98aa4b 100644 --- a/app/__test-fixtures__/contextTestHelpers.tsx +++ b/app/__test-fixtures__/contextTestHelpers.tsx @@ -67,6 +67,10 @@ export const makeTestCeramicContext = (initialState?: Partial { + )} diff --git a/app/components/ProviderCards/BrightidCard.tsx b/app/components/ProviderCards/BrightidCard.tsx index 6c7884f613..371ef33f0b 100644 --- a/app/components/ProviderCards/BrightidCard.tsx +++ b/app/components/ProviderCards/BrightidCard.tsx @@ -22,7 +22,13 @@ import { VerifyModal } from "../VerifyModal"; import { useDisclosure, useToast } from "@chakra-ui/react"; // ---- Types -import { PROVIDER_ID, Stamp } from "@gitcoin/passport-types"; +import { + ProofRecord, + PROVIDER_ID, + Stamp, + VerifiableCredential, + VerifiableCredentialRecord, +} from "@gitcoin/passport-types"; import { ProviderSpec } from "../../config/providers"; const iamUrl = process.env.NEXT_PUBLIC_PASSPORT_IAM_URL || ""; @@ -62,11 +68,11 @@ export default function BrightIdCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then((verified: { record: any; credential: any }): void => { - SetBrightIdVerification(verified.record); + .then((verified: VerifiableCredentialRecord): void => { + SetBrightIdVerification(verified?.record as BrightIdProviderRecord); SetCredentialResponse({ provider: "Brightid", - credential: verified.credential, + credential: verified.credential as VerifiableCredential, }); }) .catch((e: any): void => { diff --git a/app/components/ProviderCards/DiscordCard.tsx b/app/components/ProviderCards/DiscordCard.tsx index 4110f3e502..21c1ed66e8 100644 --- a/app/components/ProviderCards/DiscordCard.tsx +++ b/app/components/ProviderCards/DiscordCard.tsx @@ -8,7 +8,7 @@ import { debounce } from "ts-debounce"; import { BroadcastChannel } from "broadcast-channel"; // --- Identity tools -import { PROVIDER_ID } from "@gitcoin/passport-types"; +import { PROVIDER_ID, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials"; // --- Style Components @@ -96,10 +96,10 @@ export default function DiscordCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then(async (verified: { credential: any }): Promise => { + .then(async (verified: VerifiableCredentialRecord): Promise => { await handleAddStamp({ provider: providerId, - credential: verified.credential, + credential: verified.credential as VerifiableCredential, }); datadogLogs.logger.info("Successfully saved Stamp", { provider: providerId }); // Custom Success Toast diff --git a/app/components/ProviderCards/EnsCard.tsx b/app/components/ProviderCards/EnsCard.tsx index 48e514a5cc..13e66cf97e 100644 --- a/app/components/ProviderCards/EnsCard.tsx +++ b/app/components/ProviderCards/EnsCard.tsx @@ -18,7 +18,7 @@ import { VerifyModal } from "../VerifyModal"; import { DoneToastContent } from "../DoneToastContent"; import { useDisclosure, useToast } from "@chakra-ui/react"; -import { PROVIDER_ID, Stamp } from "@gitcoin/passport-types"; +import { PROVIDER_ID, Stamp, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { ProviderSpec } from "../../config/providers"; const iamUrl = process.env.NEXT_PUBLIC_PASSPORT_IAM_URL || ""; @@ -52,11 +52,11 @@ export default function EnsCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then((verified: { record: any; credential: any }): void => { + .then(async (verified: VerifiableCredentialRecord): Promise => { SetEns(verified.record?.ens); SetCredentialResponse({ - provider: "Ens", - credential: verified.credential, + provider: providerId, + credential: verified.credential as VerifiableCredential, }); }) .catch((e: any): void => { diff --git a/app/components/ProviderCards/FacebookCard.tsx b/app/components/ProviderCards/FacebookCard.tsx index 992a7f73e6..d83e55c513 100644 --- a/app/components/ProviderCards/FacebookCard.tsx +++ b/app/components/ProviderCards/FacebookCard.tsx @@ -17,7 +17,7 @@ import { Card } from "../Card"; import { useToast } from "@chakra-ui/react"; import { DoneToastContent } from "../DoneToastContent"; -import { PROVIDER_ID } from "@gitcoin/passport-types"; +import { PROVIDER_ID, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { ProviderSpec } from "../../config/providers"; export interface ReactFacebookLoginInfo { @@ -78,10 +78,10 @@ export default function FacebookCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then(async (verified): Promise => { + .then(async (verified: VerifiableCredentialRecord): Promise => { await handleAddStamp({ - provider: "Facebook", - credential: verified.credential, + provider: providerId, + credential: verified.credential as VerifiableCredential, }); datadogLogs.logger.info("Successfully saved Stamp", { provider: providerId }); // Custom Success Toast diff --git a/app/components/ProviderCards/GithubCard.tsx b/app/components/ProviderCards/GithubCard.tsx index c22187ae55..25be61da5e 100644 --- a/app/components/ProviderCards/GithubCard.tsx +++ b/app/components/ProviderCards/GithubCard.tsx @@ -4,7 +4,7 @@ import { debounce } from "ts-debounce"; import { BroadcastChannel } from "broadcast-channel"; // --- Identity tools -import { PROVIDER_ID } from "@gitcoin/passport-types"; +import { PROVIDER_ID, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials"; // --- Components @@ -97,12 +97,12 @@ export default function GithubCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then(async (verified: { credential: any }): Promise => { + .then(async (verified: VerifiableCredentialRecord): Promise => { await handleAddStamp({ provider: providerId, - credential: verified.credential, + credential: verified.credential as VerifiableCredential, }); - datadogLogs.logger.info("Successfully saved Stamp", { provider: "Github" }); + datadogLogs.logger.info("Successfully saved Stamp", { provider: providerId }); }) .catch((e) => { datadogLogs.logger.error("Verification Error", { error: e, provider: providerId }); diff --git a/app/components/ProviderCards/GoogleCard.tsx b/app/components/ProviderCards/GoogleCard.tsx index f54ef54086..f79ed355b3 100644 --- a/app/components/ProviderCards/GoogleCard.tsx +++ b/app/components/ProviderCards/GoogleCard.tsx @@ -20,7 +20,7 @@ import { Card } from "../Card"; import { DoneToastContent } from "../DoneToastContent"; import { useToast } from "@chakra-ui/react"; -import { PROVIDER_ID } from "@gitcoin/passport-types"; +import { PROVIDER_ID, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { ProviderSpec } from "../../config/providers"; // import from .env @@ -53,12 +53,12 @@ export default function GoogleCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then(async (verified): Promise => { + .then(async (verified: VerifiableCredentialRecord): Promise => { await handleAddStamp({ - provider: "Google", - credential: verified.credential, + provider: providerId, + credential: verified.credential as VerifiableCredential, }); - datadogLogs.logger.info("Successfully saved Stamp", { provider: "Google" }); + datadogLogs.logger.info("Successfully saved Stamp", { provider: providerId }); // Custom Success Toast toast({ duration: 5000, diff --git a/app/components/ProviderCards/LinkedinCard.tsx b/app/components/ProviderCards/LinkedinCard.tsx index d56c56a5e8..0254bd982b 100644 --- a/app/components/ProviderCards/LinkedinCard.tsx +++ b/app/components/ProviderCards/LinkedinCard.tsx @@ -9,7 +9,7 @@ import { debounce } from "ts-debounce"; import { BroadcastChannel } from "broadcast-channel"; // --- Identity tools -import { PROVIDER_ID } from "@gitcoin/passport-types"; +import { PROVIDER_ID, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials"; // --- Style Components @@ -108,10 +108,10 @@ export default function LinkedinCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then(async (verified: { credential: any }): Promise => { + .then(async (verified: VerifiableCredentialRecord): Promise => { await handleAddStamp({ provider: providerId, - credential: verified.credential, + credential: verified.credential as VerifiableCredential, }); datadogLogs.logger.info("Successfully saved Stamp", { provider: providerId }); // Custom Success Toast diff --git a/app/components/ProviderCards/PoapCard.tsx b/app/components/ProviderCards/PoapCard.tsx index 8e8f259d5a..58071bcb7a 100644 --- a/app/components/ProviderCards/PoapCard.tsx +++ b/app/components/ProviderCards/PoapCard.tsx @@ -19,7 +19,7 @@ import { Card } from "../Card"; import { VerifyModal } from "../VerifyModal"; import { DoneToastContent } from "../DoneToastContent"; -import { PROVIDER_ID, Stamp } from "@gitcoin/passport-types"; +import { PROVIDER_ID, Stamp, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; const iamUrl = process.env.NEXT_PUBLIC_PASSPORT_IAM_URL || ""; @@ -51,11 +51,11 @@ export default function PoapCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then((verified: { error?: string; record: any; credential: any }): void => { + .then((verified: VerifiableCredentialRecord): void => { SetPoapVerified(!verified.error); SetCredentialResponse({ - provider: "POAP", - credential: verified.credential, + provider: providerId, + credential: verified.credential as VerifiableCredential, }); }) .catch((e: any): void => { diff --git a/app/components/ProviderCards/PohCard.tsx b/app/components/ProviderCards/PohCard.tsx index bc479c45eb..1bfc293a1d 100644 --- a/app/components/ProviderCards/PohCard.tsx +++ b/app/components/ProviderCards/PohCard.tsx @@ -12,7 +12,7 @@ import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commo import { CeramicContext } from "../../context/ceramicContext"; import { UserContext } from "../../context/userContext"; -import { PROVIDER_ID, Stamp } from "@gitcoin/passport-types"; +import { PROVIDER_ID, Stamp, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; const iamUrl = process.env.NEXT_PUBLIC_PASSPORT_IAM_URL || ""; @@ -51,11 +51,11 @@ export default function PohCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then((verified: { error?: string; record: any; credential: any }): void => { + .then((verified: VerifiableCredentialRecord): void => { SetPohVerified(!verified.error); SetCredentialResponse({ provider: "Poh", - credential: verified.credential, + credential: verified.credential as VerifiableCredential, }); }) .catch((e: any): void => { diff --git a/app/components/ProviderCards/SecondSignerCard.tsx b/app/components/ProviderCards/SecondSignerCard.tsx new file mode 100644 index 0000000000..7ec569c280 --- /dev/null +++ b/app/components/ProviderCards/SecondSignerCard.tsx @@ -0,0 +1,156 @@ +// --- React Methods +import React, { useContext, useState } from "react"; + +// --- Datadog +import { datadogLogs } from "@datadog/browser-logs"; +import { datadogRum } from "@datadog/browser-rum"; + +// --- Identity tools +import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials"; + +// pull context +import { CeramicContext } from "../../context/ceramicContext"; +import { UserContext } from "../../context/userContext"; + +import { PROVIDER_ID, Stamp, VerifiableCredentialRecord } from "@gitcoin/passport-types"; + +const iamUrl = process.env.NEXT_PUBLIC_PASSPORT_IAM_URL || ""; + +// --- import components +import { Card } from "../Card"; + +const providerId: PROVIDER_ID = "SecondSigner"; + +export default function SecondSignerCard(): JSX.Element { + const { address, signer } = useContext(UserContext); + const { handleAddStamp, allProvidersState } = useContext(CeramicContext); + const [verificationInProgress, setVerificationInProgress] = useState(false); + + // Open Signer authUrl in centered window + function openSignerOAuthUrl(url: string): WindowProxy | null { + const width = 600; + const height = 800; + const left = screen.width / 2 - width / 2; + const top = screen.height / 2 - height / 2; + + // Pass data to the page via props + return window.open( + url, + "_blank", + "toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, copyhistory=no, width=" + + width + + ", height=" + + height + + ", top=" + + top + + ", left=" + + left + ); + } + + const handleFetchCredential = async (): Promise => { + datadogLogs.logger.info("Starting verification", { provider: providerId }); + + // this nonce should be provided by the server + const nonce = new Uint32Array(10); + self.crypto.getRandomValues(nonce); + + // generate a message to sign + const message = + "I commit that this wallet is under my control and that I wish to link it with my Passport.\n\nnonce: " + + nonce.toString(); + // open a popup (must be on a different domain/port so that we're not triggering a wallet change on the opener window) + const popup = openSignerOAuthUrl("http://localhost:8000") as WindowProxy; + // pass message to popup and await signature + const secondSignature: { addr: string; sig: string; msg: string } = await new Promise((resolve, reject) => { + window.addEventListener("message", (event) => { + if (event.data == "ready") { + popup.postMessage( + { + cmd: "sign_message", + msg: message, + }, + "*" + ); + } else if (event.data?.cmd == "sign_message") { + popup.close(); + resolve({ + ...event.data, + }); + } else if (event.data?.cmd == "sign_message_error") { + popup.close(); + reject("Failed to get a second signature"); + } + }); + }); + + // show the signatures... + console.log(secondSignature); + + // fetch the new credentials and save to the passport + await fetchVerifiableCredential( + iamUrl, + { + type: "SecondSigner", + types: ["Poh"], + version: "0.0.0", + address: address || "", + proofs: { + valid: address ? "true" : "false", + scndMessage: message, + scndAddress: secondSignature?.addr, + scndSignature: secondSignature?.sig, + }, + }, + signer as { signMessage: (message: string) => Promise } + ) + .then((verified: VerifiableCredentialRecord): void => { + verified.credentials?.forEach((cred) => { + if (cred.record?.type === "Poh") { + if (!cred.error) { + handleAddStamp({ + provider: "Poh", + credential: cred.credential, + }); + } + } + }); + }) + .catch((e: any): void => { + datadogLogs.logger.error("Verification Error", { error: e, provider: providerId }); + datadogRum.addError(e, { provider: providerId }); + }); + }; + + const issueCredentialWidget = ( + <> + + + ); + + return ( + + ); +} diff --git a/app/components/ProviderCards/TwitterCard.tsx b/app/components/ProviderCards/TwitterCard.tsx index 27f4aa908c..8c2d7d1ff9 100644 --- a/app/components/ProviderCards/TwitterCard.tsx +++ b/app/components/ProviderCards/TwitterCard.tsx @@ -8,7 +8,7 @@ import { debounce } from "ts-debounce"; import { BroadcastChannel } from "broadcast-channel"; // --- Identity tools -import { PROVIDER_ID } from "@gitcoin/passport-types"; +import { PROVIDER_ID, VerifiableCredential, VerifiableCredentialRecord } from "@gitcoin/passport-types"; import { fetchVerifiableCredential } from "@gitcoin/passport-identity/dist/commonjs/src/credentials"; // --- Style Components @@ -98,10 +98,10 @@ export default function TwitterCard(): JSX.Element { }, signer as { signMessage: (message: string) => Promise } ) - .then(async (verified: { credential: any }): Promise => { + .then(async (verified: VerifiableCredentialRecord): Promise => { await handleAddStamp({ provider: providerId, - credential: verified.credential, + credential: verified.credential as VerifiableCredential, }); datadogLogs.logger.info("Successfully saved Stamp", { provider: providerId }); // Custom Success Toast diff --git a/app/components/ProviderCards/index.tsx b/app/components/ProviderCards/index.tsx index b8af507a5a..9299c3a988 100644 --- a/app/components/ProviderCards/index.tsx +++ b/app/components/ProviderCards/index.tsx @@ -8,3 +8,4 @@ export { default as BrightidCard } from "./BrightidCard"; export { default as GithubCard } from "./GithubCard"; export { default as LinkedinCard } from "./LinkedinCard"; export { default as DiscordCard } from "./DiscordCard"; +export { default as SecondSignerCard } from "./SecondSignerCard"; diff --git a/app/config/providers.ts b/app/config/providers.ts index 006d3302e7..bb58636aa1 100644 --- a/app/config/providers.ts +++ b/app/config/providers.ts @@ -61,4 +61,9 @@ export const STAMP_PROVIDERS: Readonly = { name: "Discord", description: "Discord name", }, + SecondSigner: { + icon: "./assets/discordStampIcon.svg", + name: "Second Signer", + description: "Second Signer", + }, }; diff --git a/app/context/ceramicContext.tsx b/app/context/ceramicContext.tsx index 241b741044..18e39e08a9 100644 --- a/app/context/ceramicContext.tsx +++ b/app/context/ceramicContext.tsx @@ -74,6 +74,10 @@ const startingAllProvidersState: AllProvidersState = { providerSpec: STAMP_PROVIDERS.Discord, stamp: undefined, }, + SecondSigner: { + providerSpec: STAMP_PROVIDERS.SecondSigner, + stamp: undefined, + }, }; const startingState: CeramicContextState = { diff --git a/iam/src/providers/poh.ts b/iam/src/providers/poh.ts index c0034b4221..a6a7203140 100644 --- a/iam/src/providers/poh.ts +++ b/iam/src/providers/poh.ts @@ -3,7 +3,7 @@ import type { Provider, ProviderOptions } from "../types"; import type { RequestPayload, VerifiedPayload } from "@gitcoin/passport-types"; // ----- Ethers library -import { Contract } from "ethers"; +import { Contract, utils } from "ethers"; import { StaticJsonRpcProvider } from "@ethersproject/providers"; // Proof of humanity contract address @@ -39,7 +39,9 @@ export class PohProvider implements Provider { // verify that the proof object contains valid === "true" async verify(payload: RequestPayload): Promise { - const { address } = payload; + let valid = false; + let { address } = payload; + const { proofs } = payload; try { // define a provider using the rpc url const provider: StaticJsonRpcProvider = new StaticJsonRpcProvider(RPC_URL); @@ -47,9 +49,19 @@ export class PohProvider implements Provider { // load Proof of humanity contract const readContract = new Contract(POH_CONTRACT_ADDRESS, POH_ABI, provider); - // Checks to see if the address is registered with proof of humanity - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment - const valid: boolean = await readContract.isRegistered(address); + // check if we should using a second-sig wallet + try { + // if proof for second address is provided, use that instead... + if (proofs && proofs.scndAddress && proofs.scndMessage && proofs.scndSignature) { + // pull the address and checksum so that its stored in a predictable format + address = utils.getAddress(utils.verifyMessage(proofs.scndMessage, proofs.scndSignature)); + } + // Checks to see if the address is registered with proof of humanity + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment + valid = await readContract.isRegistered(address); + } catch (e) { + valid = false; + } return { valid, diff --git a/identity/src/credentials.ts b/identity/src/credentials.ts index 3a3ec7aba9..02ec379a3e 100644 --- a/identity/src/credentials.ts +++ b/identity/src/credentials.ts @@ -218,7 +218,7 @@ export const fetchVerifiableCredential = async ( payload.proofs = { ...payload.proofs, ...{ signature: signature } }; // fetch a credential from the API that fits the version, payload and passes the signature message challenge - const response: { data: CredentialResponseBody } = await axios.post( + const response: { data: CredentialResponseBody | CredentialResponseBody[] } = await axios.post( `${iamUrl.replace(/\/*?$/, "")}/v${payload.version}/verify`, { payload, @@ -230,7 +230,9 @@ export const fetchVerifiableCredential = async ( return { signature, challenge, - record: response.data.record, - credential: response.data.credential, + error: Array.isArray(response.data) ? null : response.data.error, + record: Array.isArray(response.data) ? null : response.data.record, + credential: Array.isArray(response.data) ? null : response.data.credential, + credentials: Array.isArray(response.data) ? response.data : null, } as VerifiableCredentialRecord; }; diff --git a/lerna.json b/lerna.json index 4bc80652ab..d2a4f5176e 100644 --- a/lerna.json +++ b/lerna.json @@ -5,7 +5,8 @@ "iam", "identity", "schemas", - "types" + "types", + "second-signer" ], "command": { "bootstrap": { diff --git a/package.json b/package.json index efbb037c7f..59ca84d41b 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "iam", "identity", "schemas", - "types" + "types", + "second-signer" ], "scripts": { "clean": "lerna run clean", @@ -28,6 +29,7 @@ "lint:identity": "yarn workspace @gitcoin/passport-identity lint", "test": "lerna run test", "test:iam": "yarn workspace @gitcoin/passport-iam test", + "test:app": "yarn workspace @gitcoin/passport-app test", "test:identity": "yarn workspace @gitcoin/passport-identity test", "prettier": "lerna run prettier", "build": "yarn build:identity && yarn build:database-client && yarn build:iam && yarn build:app", @@ -37,6 +39,7 @@ "build:app": "yarn workspace @gitcoin/passport-app build", "start": "concurrently --kill-others \"yarn start:iam\" \"yarn start:app\"", "start:iam": "yarn workspace @gitcoin/passport-iam start", + "start:signer": "yarn workspace @gitcoin/passport-second-signer start", "start:app": "yarn workspace @gitcoin/passport-app start", "start:ceramic": "yarn ceramic daemon", "prod:start:iam": "yarn workspace @gitcoin/passport-iam prod:start", diff --git a/second-signer/package.json b/second-signer/package.json new file mode 100644 index 0000000000..aa2be38144 --- /dev/null +++ b/second-signer/package.json @@ -0,0 +1,11 @@ +{ + "name": "@gitcoin/passport-second-signer", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "http-server": "^14.1.1" + }, + "scripts": { + "start": "npx http-server ./public -a localhost -p 8000" + } +} diff --git a/second-signer/public/index.html b/second-signer/public/index.html new file mode 100644 index 0000000000..69c9569c95 --- /dev/null +++ b/second-signer/public/index.html @@ -0,0 +1,71 @@ + + + + + Second signer + + + + + Waiting... + + + + + + \ No newline at end of file diff --git a/second-signer/readme.md b/second-signer/readme.md new file mode 100644 index 0000000000..baa022952e --- /dev/null +++ b/second-signer/readme.md @@ -0,0 +1,7 @@ +# @gitcoin/passport-second-signer + +This standalone dApp will allow Passport to verify the ownership of multiple wallet addresses + +```bash +yarn start +``` diff --git a/tsconfig.json b/tsconfig.json index ef218d77e9..c163f22f38 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ { "path": "app" }, { "path": "iam" }, { "path": "identity" }, - { "path": "types" } + { "path": "types" }, + { "path": "second-signer" } ], "exclude": ["node_modules"] } diff --git a/types/src/index.d.ts b/types/src/index.d.ts index f11d6d70cb..15ce2aa973 100644 --- a/types/src/index.d.ts +++ b/types/src/index.d.ts @@ -103,9 +103,11 @@ export type IssuedCredential = { // Issued Credential and support matterial returned when fetching the VerifiableCredential export type VerifiableCredentialRecord = { signature: string; - record: ProofRecord; challenge: VerifiableCredential; - credential: VerifiableCredential; + error?: string; + record?: ProofRecord; + credential?: VerifiableCredential; + credentials?: CredentialResponseBody[]; }; export type Stamp = { @@ -126,6 +128,7 @@ export type Passport = { export type DID = string; export type PROVIDER_ID = + | "SecondSigner" | "Google" | "Ens" | "Poh" diff --git a/yarn.lock b/yarn.lock index f307f3498f..a6b0d98d62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6099,6 +6099,13 @@ async-mutex@^0.2.6: dependencies: tslib "^2.0.0" +async@^2.6.4: + version "2.6.4" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== + dependencies: + lodash "^4.17.14" + async@^3.2.0: version "3.2.4" resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" @@ -6354,7 +6361,7 @@ base64-js@^1.0.2, base64-js@^1.3.0, base64-js@^1.3.1, base64-js@^1.5.1: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -basic-auth@~2.0.1: +basic-auth@^2.0.1, basic-auth@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a" integrity sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg== @@ -7060,7 +7067,7 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^4.0.0, chalk@^4.1.0: +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -7567,6 +7574,11 @@ cors@^2.8.5: object-assign "^4" vary "^1" +corser@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" + integrity sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ== + cosmiconfig-typescript-loader@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-2.0.1.tgz#5622bb1eb87d293570bcc3a57f406940e0960113" @@ -9060,7 +9072,7 @@ event-target-shim@^5.0.0: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -eventemitter3@^4.0.4, eventemitter3@^4.0.7: +eventemitter3@^4.0.0, eventemitter3@^4.0.4, eventemitter3@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== @@ -9396,7 +9408,7 @@ focus-lock@^0.9.1: dependencies: tslib "^2.0.3" -follow-redirects@^1.14.0, follow-redirects@^1.14.4, follow-redirects@^1.14.8, follow-redirects@^1.14.9: +follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.4, follow-redirects@^1.14.8, follow-redirects@^1.14.9: version "1.15.1" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA== @@ -10052,6 +10064,11 @@ hashlru@^2.3.0: resolved "https://registry.yarnpkg.com/hashlru/-/hashlru-2.3.0.tgz#5dc15928b3f6961a2056416bb3a4910216fdfb51" integrity sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A== +he@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + header-case@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/header-case/-/header-case-2.0.4.tgz#5a42e63b55177349cf405beb8d775acabb92c063" @@ -10112,6 +10129,13 @@ html-encoding-sniffer@^2.0.1: dependencies: whatwg-encoding "^1.0.5" +html-encoding-sniffer@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" + integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== + dependencies: + whatwg-encoding "^2.0.0" + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -10162,6 +10186,34 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" +http-proxy@^1.18.1: + version "1.18.1" + resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" + integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== + dependencies: + eventemitter3 "^4.0.0" + follow-redirects "^1.0.0" + requires-port "^1.0.0" + +http-server@^14.1.1: + version "14.1.1" + resolved "https://registry.yarnpkg.com/http-server/-/http-server-14.1.1.tgz#d60fbb37d7c2fdff0f0fbff0d0ee6670bd285e2e" + integrity sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A== + dependencies: + basic-auth "^2.0.1" + chalk "^4.1.2" + corser "^2.0.1" + he "^1.2.0" + html-encoding-sniffer "^3.0.0" + http-proxy "^1.18.1" + mime "^1.6.0" + minimist "^1.2.6" + opener "^1.5.1" + portfinder "^1.0.28" + secure-compare "3.0.1" + union "~0.5.0" + url-join "^4.0.1" + http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -10211,7 +10263,7 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -iconv-lite@^0.6.2: +iconv-lite@0.6.3, iconv-lite@^0.6.2: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== @@ -12875,7 +12927,7 @@ lodash.uniqby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" integrity sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww== -lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.7.0: +lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.7.0: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -13162,7 +13214,7 @@ mime-types@^2.1.12, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: dependencies: mime-db "1.52.0" -mime@1.6.0: +mime@1.6.0, mime@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== @@ -13317,7 +13369,7 @@ mkdirp-infer-owner@^2.0.0: infer-owner "^1.0.4" mkdirp "^1.0.3" -mkdirp@^0.5.1, mkdirp@^0.5.3: +mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== @@ -14033,6 +14085,11 @@ opencollective-postinstall@^2.0.0: resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259" integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q== +opener@^1.5.1: + version "1.5.2" + resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" + integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -14534,6 +14591,15 @@ popmotion@11.0.3: style-value-types "5.0.0" tslib "^2.1.0" +portfinder@^1.0.28: + version "1.0.29" + resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.29.tgz#d06ff886f4ff91274ed3e25c7e6b0c68d2a0735a" + integrity sha512-Z5+DarHWCKlufshB9Z1pN95oLtANoY5Wn9X3JGELGyQ6VhEcBfT2t+1fGUBq7MwUant6g/mqowH+4HifByPbiQ== + dependencies: + async "^2.6.4" + debug "^3.2.7" + mkdirp "^0.5.6" + postcss-import@^14.1.0: version "14.1.0" resolved "https://registry.yarnpkg.com/postcss-import/-/postcss-import-14.1.0.tgz#a7333ffe32f0b8795303ee9e40215dac922781f0" @@ -14850,6 +14916,13 @@ qs@^6.10.3, qs@^6.9.4: dependencies: side-channel "^1.0.4" +qs@^6.4.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" + integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== + dependencies: + side-channel "^1.0.4" + qs@~6.5.2: version "6.5.3" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" @@ -15309,6 +15382,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + resolve-alpn@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" @@ -15573,6 +15651,11 @@ secp256k1@^4.0.1, secp256k1@^4.0.3: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" +secure-compare@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3" + integrity sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw== + "semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" @@ -16840,6 +16923,13 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +union@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/union/-/union-0.5.0.tgz#b2c11be84f60538537b846edb9ba266ba0090075" + integrity sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA== + dependencies: + qs "^6.4.0" + unique-filename@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" @@ -16937,6 +17027,11 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +url-join@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + url@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/url/-/url-0.10.3.tgz#021e4d9c7705f21bbf37d03ceb58767402774c64" @@ -17160,6 +17255,13 @@ whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" +whatwg-encoding@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" + integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== + dependencies: + iconv-lite "0.6.3" + whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"