-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
139bf7c
commit 6996f08
Showing
9 changed files
with
1,639 additions
and
76 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { IWallet } from '@docknetwork/wallet-sdk-core/lib/types'; | ||
import { createVerificationController } from '@docknetwork/wallet-sdk-core/src/verification-controller'; | ||
import { CheqdCredentialNonZKP } from './data/credentials/cheqd-credentials'; | ||
import { closeWallet, createNewWallet, getCredentialProvider, getWallet } from './helpers'; | ||
import { ProofTemplateIds, createProofRequest } from './helpers/certs-helpers'; | ||
|
||
describe('Cheq integration tests', () => { | ||
beforeAll(async () => { | ||
await createNewWallet(); | ||
}); | ||
|
||
it('should verify a non ZKP cheqd credential', async () => { | ||
|
||
|
||
const wallet: IWallet = await getWallet(); | ||
|
||
getCredentialProvider().addCredential(CheqdCredentialNonZKP); | ||
|
||
const proofRequest = await createProofRequest( | ||
ProofTemplateIds.ANY_CREDENTIAL, | ||
); | ||
|
||
const result: any = await getCredentialProvider().isValid(CheqdCredentialNonZKP); | ||
|
||
expect(result).toBeTruthy(); | ||
|
||
const controller = await createVerificationController({ | ||
wallet, | ||
}); | ||
|
||
await controller.start({ | ||
template: proofRequest, | ||
}); | ||
|
||
controller.selectedCredentials.set(CheqdCredentialNonZKP.id, { | ||
credential: CheqdCredentialNonZKP, | ||
}); | ||
|
||
const presentation = await controller.createPresentation(); | ||
console.log('Presentation generated'); | ||
console.log(JSON.stringify(presentation, null, 2)); | ||
console.log('Sending presentation to Certs API'); | ||
|
||
let certsResponse; | ||
try { | ||
certsResponse = await controller.submitPresentation(presentation); | ||
console.log('CERTS response'); | ||
console.log(JSON.stringify(certsResponse, null, 2)); | ||
} catch (err) { | ||
certsResponse = err.response.data; | ||
console.log('Certs API returned an error'); | ||
console.log(JSON.stringify(certsResponse, null, 2)); | ||
} | ||
|
||
expect(certsResponse.verified).toBe(true); | ||
}); | ||
|
||
afterAll(() => closeWallet()); | ||
}); |
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
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
Oops, something went wrong.