Why is hash of credentials calculated twice?
I was guided by gaia-x-101 to create valid Gaia-X Credentials and I struggled with the creation of proof. You are using JWS as proof mechanism. After canonicalizing credential document, you calculate credential's hash in line #33 and use it as payload for JWS to sign the document. The library you are using to create JWS (jwcrypto) already calculates hash for payload as part of signing function in line #L152 and line #133. It seems, your source code calculates hash twice. What is the benefit of hashing twice?
BTW, W3C Verifiable Credential Data Integrity 1.0 dictates only one hash. If there is a good reason for hashing twice and to break with W3C Spec, we should mention this as feature of Gaia-X Credentials in Architecture document, explicitly. Otherwise, verification of signature fails, especially, if payload is not part of signature, as you are doing in line #9.