-
Notifications
You must be signed in to change notification settings - Fork 16
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 #8 from blockchain-lab-um/dev
SSI Snap v1.1.4
- Loading branch information
Showing
15 changed files
with
165 additions
and
70 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -22,3 +22,6 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.vscode/settings.json | ||
|
||
tsconfig.tsbuildinfo |
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
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
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
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
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,11 +1,11 @@ | ||
import { create_vp } from "../utils/veramo_utils"; | ||
import { VerifiablePresentation } from "@veramo/core"; | ||
|
||
export async function getVP(vc_id: string, domain: string, challenge: string) { | ||
if (vc_id) { | ||
const vp = await create_vp(vc_id, challenge, domain); | ||
return { data: vp }; | ||
} else { | ||
console.log("Missing parameters: vc_id"); | ||
return { error: "Missing parameter: vc_id" }; | ||
} | ||
export async function getVP( | ||
vc_id: string, | ||
domain?: string, | ||
challenge?: string | ||
): Promise<VerifiablePresentation | null> { | ||
const vp = await create_vp(vc_id, challenge, domain); | ||
return vp; | ||
} |
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,42 @@ | ||
import { VCQuerry } from "@blockchain-lab-um/ssi-snap-types"; | ||
import { VerifiableCredential } from "@veramo/core"; | ||
|
||
export function isValidGetVCsRequest( | ||
params: unknown | ||
): asserts params is { querry?: VCQuerry } { | ||
if (!(params != null && typeof params == "object" && "querry" in params)) { | ||
throw new Error("Invalid GetVCs request"); | ||
} | ||
} | ||
|
||
export function isValidSaveVCRequest( | ||
params: unknown | ||
): asserts params is { verifiableCredential: VerifiableCredential } { | ||
if ( | ||
!( | ||
params != null && | ||
typeof params == "object" && | ||
"verifiableCredential" in params | ||
) | ||
) { | ||
throw new Error("Invalid SaveVC request"); | ||
} | ||
} | ||
|
||
export function isValidGetVPRequest( | ||
params: unknown | ||
): asserts params is { vc_id: string; domain?: string; challenge?: string } { | ||
if (!(params != null && typeof params == "object" && "vc_id" in params)) { | ||
throw new Error("Invalid GetVP request"); | ||
} | ||
} | ||
|
||
export function isValidChangeInfuraTokenRequest( | ||
params: unknown | ||
): asserts params is { infuraToken: string } { | ||
if ( | ||
!(params != null && typeof params == "object" && "infuraToken" in params) | ||
) { | ||
throw new Error("Invalid ChangeInfuraToken request"); | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.