2060-io / credo-ts-didweb-anoncreds

AnonCreds did:web method registry for credo-ts
MIT License
4 stars 2 forks source link

Fails to get schema #9

Open skullquake opened 2 months ago

skullquake commented 2 months ago

For credo-ts-didweb-anoncreds 0.0.1-alpha.14 with credo-ts 0.5.10, we get the following error message when calling agent.credential.acceptOffer

h: Schema not found for id did:web:foo.bar.id:01234567-0123-0123-0123-0123456789ab?service=anoncreds&relativeRef=/credDef/0123456789abcdef0123456789abcdef0123456789ab: Wrong resource Id

Related, agent.modules.anoncreds.getSchema returns null.

Everything works well for credo-ts 0.5.6 and below, but not versions above

genaris commented 1 month ago

@jorgefl0 in latest Credo contributors call you mentioned you are facing this issue as well. However, I could not reproduce it in my projects (in both nodejs and React Native). Maybe it's because I'm forcing the credo-ts version to use in package.json's resolutions key?

If you could give me more details about the error (I remember it was on a crypto library for hashing but not exactly sure which one), it would be great so we can fix this. Thanks!

jorgefl0 commented 1 month ago

@genaris Thanks for looking into this. There appears to be a change to the Hasher.ts file introduced with v0.5.7

https://github.com/openwallet-foundation/credo-ts/blob/v0.5.7/packages/core/src/crypto/hashes/Hasher.ts

import { Sha256 } from './Sha256'

https://github.com/openwallet-foundation/credo-ts/blob/v0.5.6/packages/core/src/utils/Hasher.ts

import { hash as sha256 } from '@stablelib/sha256'

We observe the base58 encoded strings differ between the two versions.