Running the following JavaScript file using node
...
const issueUrl = `https://issuer.waltid.findy.fi/openid4vc/sdjwt/issue`
const requestBody = {
"issuanceKey": {
"type": "local",
"jwk": "{\"kty\":\"OKP\",\"d\":\"mDhpwaH6JYSrD2Bq7Cs-pzmsjlLj4EOhxyI-9DM1mFI\",\"crv\":\"Ed25519\",\"kid\":\"Vzx7l5fh56F3Pf9aR3DECU5BwfrY6ZJe05aiWYWzan8\",\"x\":\"T3T4-u1Xz3vAV2JwPNxWfs4pik_JLiArz_WTCvrCFUM\"}"
},
"issuerDid": "did:key:z6MkjoRhq1jSNJdLiruSXrFFxagqrztZaXHqHGUTKJbcNywp",
"vc": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
],
"id": "urn:uuid:THIS WILL BE REPLACED WITH DYNAMIC DATA FUNCTION (see below)",
"type": [
"VerifiableCredential",
"OpenBadgeCredential"
],
"name": "JFF x vc-edu PlugFest 3 Interoperability",
"issuer": {
"type": [
"Profile"
],
"id": "did:key:THIS WILL BE REPLACED WITH DYNAMIC DATA FUNCTION FROM CONTEXT (see below)",
"name": "Jobs for the Future (JFF)",
"url": "https://www.jff.org/",
"image": "https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png"
},
"issuanceDate": "2023-07-20T07:05:44Z (THIS WILL BE REPLACED BY DYNAMIC DATA FUNCTION (see below))",
"expirationDate": "WILL BE MAPPED BY DYNAMIC DATA FUNCTION (see below)",
"credentialSubject": {
"id": "did:key:123 (THIS WILL BE REPLACED BY DYNAMIC DATA FUNCTION (see below))",
"type": [
"AchievementSubject"
],
"achievement": {
"id": "urn:uuid:ac254bd5-8fad-4bb1-9d29-efd938536926",
"type": [
"Achievement"
],
"name": "JFF x vc-edu PlugFest 3 Interoperability",
"description": "This wallet supports the use of W3C Verifiable Credentials and has demonstrated interoperability during the presentation request workflow during JFF x VC-EDU PlugFest 3.",
"criteria": {
"type": "Criteria",
"narrative": "Wallet solutions providers earned this badge by demonstrating interoperability during the presentation request workflow. This includes successfully receiving a presentation request, allowing the holder to select at least two types of verifiable credentials to create a verifiable presentation, returning the presentation to the requestor, and passing verification of the presentation and the included credentials."
},
"image": {
"id": "https://w3c-ccg.github.io/vc-ed/plugfest-3-2023/images/JFF-VC-EDU-PLUGFEST3-badge-image.png",
"type": "Image"
}
}
}
}
}
const credParams = {
method: 'POST',
headers: {
"Accept": "text/plain",
"Content-Type": "application/json",
},
body: JSON.stringify(requestBody, null, 1)
}
const resp = await fetch(issueUrl, credParams)
const credentialOffer = await resp.text()
console.log(resp.status, credentialOffer)
... I get the following response:
node:internal/deps/undici/undici:11442
fetchParams.controller.controller.error(new TypeError("terminated", {
^
TypeError: terminated
at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
at Fetch.emit (node:events:514:28)
at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
at fetchParams.controller.resume (node:internal/deps/undici/undici:11421:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: Error: incorrect header check
at Zlib.zlibOnError [as onerror] (node:zlib:189:17) {
errno: -3,
code: 'Z_DATA_ERROR'
}
}
Node.js v20.5.0
If I add the following header to the fetch()
request, I get a successful response:
"Accept-Encoding": "gzip, br, identity",
Having deflate
as an acceptable encoding results to Z_DATA_ERROR
with fetch
"Accept-Encoding": "gzip, br, identity, deflate",
It seems that the deflate
encoding used by waltid-identity is not compatible with fetch
's implementation.
The API also works if the requestBody
is smaller - yielding a smaller response.
Since deflate seems to have issues in general, it would probably be best to avoid deflate altogether.
Looking at
it seems that
gzip
is preferred only when content-length is below 1024 bytes. Is there a real reason for preferring
deflate
on bigger payloads?