Meeco / hedera-did-sdk-js

Javascript SDK for managing DID Documents & Verifiable Credentials
Apache License 2.0
1 stars 3 forks source link

Fix some issues resolving IPFS DIDs #37

Closed zbarbuto closed 1 year ago

zbarbuto commented 1 year ago

There were only two fromJsonTree methods that had JSON in uppercase - I have made them consistent. This also fixes an issue parsing the events as the parser was expecting a lowercase method to be called.

Further, there was a missing return when fetching the IPFS DID document JSON - this has been added.

I have verified with the following:

    it("resolves an IPFS-based did document", async () => {
        const resolver = new Resolver({
            ...new HederaDidResolver().build(),
        });

        let result: any;

        await delayUntil(async () => {
            result = await resolver.resolve(
                "did:hedera:testnet:7ZPRxrKEdJLvVs7EnVPZ75ZEjFUviUFG8daHKLR9FgxF_0.0.499750"
            );
            return result?.didDocument?.assertionMethod?.length >= 1;
        }, WAIT_BEFORE_RESOLVE_DID_FOR);
        console.log(result);
    });