-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: F-Node-Karlsruhe <christian.fries@eecc.de>
- Loading branch information
1 parent
6b68af4
commit 21ca680
Showing
2 changed files
with
23 additions
and
23 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 |
---|---|---|
@@ -1,22 +1,20 @@ | ||
|
||
import { verifyDataIntegrityProof } from './dataintegrity.js'; | ||
import { verifySDJWT } from './sdjwt.js'; | ||
|
||
|
||
|
||
import { verifyDataIntegrityProof } from "./dataintegrity.js"; | ||
import { verifySDJWT } from "./sdjwt.js"; | ||
|
||
export class Verifier { | ||
|
||
static async verify(verifiable: Verifiable | string, challenge?: string, domain?: string): Promise<VerificationResult> { | ||
|
||
// vc-jwt or sd-jwt | ||
if (typeof verifiable == 'string' && verifiable.startsWith('ey')) return await verifySDJWT(verifiable, challenge, domain) | ||
|
||
// DataIntegrityProof | ||
if (typeof verifiable == 'object') return await verifyDataIntegrityProof(verifiable, challenge, domain); | ||
|
||
throw new Error('Unrecognized credential type!') | ||
|
||
} | ||
|
||
} | ||
static async verify( | ||
verifiable: Verifiable | string, | ||
challenge?: string, | ||
domain?: string | ||
): Promise<VerificationResult> { | ||
// vc-jwt or sd-jwt | ||
if (typeof verifiable == "string" && verifiable.startsWith("ey")) | ||
return await verifySDJWT(verifiable, challenge, domain, false); | ||
|
||
// DataIntegrityProof | ||
if (typeof verifiable == "object") | ||
return await verifyDataIntegrityProof(verifiable, challenge, domain); | ||
|
||
throw new Error("Unrecognized credential type!"); | ||
} | ||
} |
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