Skip to content

Commit

Permalink
fix: use cid v0 (#177)
Browse files Browse the repository at this point in the history
* fix: use cid v0

* fix: remove comment
  • Loading branch information
sakulstra authored Nov 11, 2024
1 parent 601bb8d commit cb27903
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Binary file modified bun.lockb
Binary file not shown.
8 changes: 3 additions & 5 deletions src/ipfs/onlyHash.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import {describe, expect, it} from 'vitest';
import {Hash} from './onlyHash';

describe('validateAIP', () => {
it('should succeed when all keys are present', async () => {
describe('validateHash', () => {
it('should generate same hash', async () => {
const header = `---
title: TestTitle
discussions: TestDiscussion
author: TestAuthor
---`;
expect(await Hash.of(header)).toBe(
'bafkreidu7hxuf3jj6dmtvgtomaipokksxvy7uastfbkdu2zq3c4wrn7mb4',
);
expect(await Hash.of(header)).toBe('QmYMiDJUYXGsUng5rAgwgLvZzLEMjbhaWALFbQJjC6saPv');
});
});
5 changes: 4 additions & 1 deletion src/ipfs/onlyHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export const Hash = {
}

let lastCid;
for await (const {cid} of importer([{content}], new MemoryBlockstore(), options)) {
for await (const {cid} of importer([{content}], new MemoryBlockstore(), {
cidVersion: 0,
rawLeaves: false,
})) {
lastCid = cid;
}

Expand Down

0 comments on commit cb27903

Please sign in to comment.