Expected: the /presentations url should only accept credentials in authorized schemas such as "ECR". However, it seems to accept any well-formed credential. For example, you can submit the GLEIF root credential and get back a 202 (success). We expected it to fail since it's not in an authorized schema. Test case follows.
test('Provision GLEIF CESR Credential', async () => {
const credential_said = "EAjPt0ik6KgZ3YxcRwekYHnxUH7Zax-nMGkd0dViSJDg";
const vlei_verifier_url = new URL('http://127.0.0.1:7676');
const credCesr = readFileSync("/mnt/c/Users/Daniel/Downloads/Gleif Cesr Credential.txt");
const result = await provision_vlei_credential(credential_said, credCesr.toString(), vlei_verifier_url);
expect(result).toBe("Successfully provisioned credential on VLEI Verifier.");
// test case passes, even though the credential isn't in an authorized schema
}, 3600000);
async function provision_vlei_credential(credSaid: string, credCesr: string, vleiVerifierUrl: URL) {
const heads = new Headers({"Content-Type": "application/json+cesr"});
const preq = { headers: heads, method: "PUT", body: credCesr };
const presp = await fetch(vleiVerifierUrl + `presentations/${credSaid}`, preq);
return presp.status === 202 ? "Successfully provisioned credential on VLEI Verifier."
: "Failed to provision credential on VLEI Verifier.";
}
Gleif Cesr Credential.txt
Expected: the /presentations url should only accept credentials in authorized schemas such as "ECR". However, it seems to accept any well-formed credential. For example, you can submit the GLEIF root credential and get back a 202 (success). We expected it to fail since it's not in an authorized schema. Test case follows.
Gleif Cesr Credential.txt