Giter VIP home page Giter VIP logo

Comments (8)

lemoustachiste avatar lemoustachiste commented on August 16, 2024

HI @ssho0508,

I'm not sure I can exactly replicate the issue as it seems related to your data. This is where the hash is computed for the verifier: https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/inspectors/computeLocalHash.ts

You may want to see what's actually normalized by jsonld on the issuer and on the verifier side, as this will likely give you more insights as to what the potential issue can be.

from cert-verifier-js.

lemoustachiste avatar lemoustachiste commented on August 16, 2024

Also at this moment this package is made to work with node 16. I'm in the process of upgrading a few things and make sure it works with node 18 but I'm not 100% it works as expected at this time.

from cert-verifier-js.

 avatar commented on August 16, 2024

Thanks for the reply!
I will try to use the node 16 to debug and I think maybe I make something wrong when I used the cert-tool to make a unsigned-credential. I found that the computeLocalHash is using the @context to hash. and I'm not sure whether I make wrong with adding custom fields. Forgive my stupid.

    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        {
            "test": {
                "@id": "schema:description"
            },
            "alumniOf": {
                "@id": "schema:description"
            },
            "evidence": {
                "@id": "schema:description"
            },
            "nonce": {
                "@id": "schema:description"
            }
        },
        "https://w3id.org/blockcerts/v3"
    ],
    "type": [
        "VerifiableCredential",
        "BlockcertsCredential"
    ],
    "issuer": "http://localhost:7000/profile",
    "issuanceDate": "2023-07-03T01:53:06Z",
    "id": "urn:uuid:0e2c5a42-a400-4042-864f-08cd064760d4",
    "credentialSubject": {
        "id": "ecdsa-koblitz-pubkey:mkwntSiQmc14H65YxwckLenxY3DsEpvFbe",
        "alumniOf": {
            "id": "http://localhost:7000/profile"
        },
        "evidence": "test M"
    },
    "nonce": "kim custom subtitle",
    "test": "mg"
}

from cert-verifier-js.

lemoustachiste avatar lemoustachiste commented on August 16, 2024

I don't think you are stupid, jsonld is not too straightforward.

If you are going to redefine some terms, I suggest you try with the JSONLD playground: https://fhircat.org/jsonld/playground/, that way you can try and adjust your definitions so that they are correclty picked up.

However both the issuer and the verifier should normalize the document the same way before hashing so I'm not entirely sure the problem is laying around your context definition.

from cert-verifier-js.

lemoustachiste avatar lemoustachiste commented on August 16, 2024

You'll want to print this: https://github.com/blockchain-certificates/cert-verifier-js/blob/master/src/inspectors/computeLocalHash.ts#L52

And this: https://github.com/blockchain-certificates/cert-issuer/blob/master/cert_issuer/normalization_handler.py#L12

from cert-verifier-js.

 avatar commented on August 16, 2024

That's exactly what I need!
I found that it's because the "evidence": "test M" can not be hashed by cert-issuer and it can be hashed by cert-verifier-js.
Anyway, I make it by moving the "evidence": "test M" outside or just drop it.
Thank you for you help!

from cert-verifier-js.

lemoustachiste avatar lemoustachiste commented on August 16, 2024

Ok I think I need to investigate why there is a difference in normalization in cert-issuer

from cert-verifier-js.

 avatar commented on August 16, 2024

Sorry to bother you again.
I found the "evidence" has been defined in "https://www.w3.org/2018/credentials/v1" and that's what make the difference.
I change it to other names like testCredential and the hashes of both sides are the same.
So the normalization is different, but there is a way to avoid it.
Thank you!

from cert-verifier-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.