-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 340: Content hash is out of spec in announcements #343
Conversation
services/content-publishing/libs/common/src/utils/ipfs.client.ts
Outdated
Show resolved
Hide resolved
services/content-publishing/apps/worker/src/request_processor/dsnp.announcement.processor.ts
Show resolved
Hide resolved
const mb = await service.ipfsHashBuffer(Buffer.from("abc")); | ||
expect(mb).toMatch("z2DrjgbH33g3bTa7dPaMq1XbVmKH11m2SwxAF6aNzSd5F3j63p4"); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
picked up an old test https://github.com/LibertyDSNP/activity-content/blob/main/src/test/hash.test.ts
services/content-publishing/libs/common/src/utils/ipfs.client.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Joe Caputo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
const hash = create(hasher.code, hashed.bytes); | ||
return base58btc.encode(hash.bytes); | ||
const hash = await sha256.digest(fileBuffer); | ||
return base32.encode(hash.bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to dsnp spec (to be updated) base32(multihash)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for working through all that.
Problem
Content watcher bug #340 in calculating
contentHash
,Details
Closes: #340
Solution
What I/we did to solve this problem
Fixed by following DSNP spec and hashing the bytes of content in line with DSNP