Open LuisOsta opened 2 years ago
As part of this test we should test for deserialization. We can use this JSON string:
{\"@context\":[\"https://www.w3.org/2018/credentials/v1\",\"https://www.w3.org/2018/credentials/examples/v1\"],\"id\":\"http://credential_mock:8000/api/credential/z6MkoBjc4GfEWrdAXAchrDrjc7LBuTVNXySswadG3apCKy9P\",\"type\":[\"VerifiableCredential\",\"PermanentResidentCard\"],\"issuer\":\"did:knox:z6Mkv9L4S8FQ3qcu8UqG8NFHt5LKcfzPeLvPJB7uW5vrp3WF\",\"issuanceDate\":\"2022-10-28T19:35:20Z\",\"credentialSubject\":{\"birthCountry\":\"Bahamas\",\"birthDate\":\"1981-04-01\",\"commuterClassification\":\"C1\",\"familyName\":\"Kim\",\"gender\":\"Male\",\"givenName\":\"Francis\",\"id\":\"did:knox:z6MkoBjc4GfEWrdAXAchrDrjc7LBuTVNXySswadG3apCKy9P\",\"image\":\"data:image/png;base64,iVBORw0KGgo...kJggg==\",\"lprCategory\":\"C09\",\"lprNumber\":\"000-000-204\",\"residentSince\":\"2015-01-01\",\"type\":[\"PermanentResident\",\"Person\"]},\"proof\":{\"type\":\"Ed25519Signature2020\",\"created\":\"2022-10-28T19:35:20Z\",\"verificationMethod\":\"did:knox:z6Mkv9L4S8FQ3qcu8UqG8NFHt5LKcfzPeLvPJB7uW5vrp3WF#z6Mkv9L4S8FQ3qcu8UqG8NFHt5LKcfzPeLvPJB7uW5vrp3WF\",\"proofPurpose\":\"assertionMethod\",\"proofValue\":\"z4xTXcWHhZY8oXCXTKSw3N9qmRKjQAUUVbNnQz1FqKCAYiGieYohBRcSKGK9YcBuKqyqzjbaohmtMZBAenC9huBJ\"}}
Due to the current nested structure:
The deserialization doesn't work as expected. While the serialization does work because of
flatten
that does not help in converting JSON toVerifiableCredential