diff --git a/packages/strings/src/index.ts b/packages/strings/src/index.ts index fe13d27ce..1342f159e 100644 --- a/packages/strings/src/index.ts +++ b/packages/strings/src/index.ts @@ -40,7 +40,6 @@ export interface StringsComponents { export interface AddOptions extends AbortOptions, ProgressOptions { hasher: MultihashHasher - codec: BlockCodec } export interface GetOptions extends AbortOptions, ProgressOptions { @@ -105,8 +104,7 @@ class DefaultStrings implements Strings { async add (string: string, options: Partial = {}): Promise { const buf = uint8ArrayFromString(string) const hash = await (options.hasher ?? sha256).digest(buf) - const codec = options.codec ?? raw - const cid = CID.createV1(codec.code, hash) + const cid = CID.createV1(raw.code, hash) await this.components.blockstore.put(cid, buf, options) diff --git a/packages/strings/test/get.spec.ts b/packages/strings/test/get.spec.ts index 5b69301d0..d7e4d2af9 100644 --- a/packages/strings/test/get.spec.ts +++ b/packages/strings/test/get.spec.ts @@ -2,7 +2,6 @@ import { expect } from 'aegir/chai' import { MemoryBlockstore } from 'blockstore-core' -import * as json from 'multiformats/codecs/json' import { identity } from 'multiformats/hashes/identity' import { strings, type Strings } from '../src/index.js' import type { Blockstore } from 'interface-blockstore' @@ -34,13 +33,4 @@ describe('get', () => { await expect(str.get(cid)).to.eventually.equal(input) }) - - it('gets a string with a non-default block codec', async () => { - const input = 'hello world' - const cid = await str.add(input, { - codec: json - }) - - await expect(str.get(cid)).to.eventually.equal(input) - }) })