File tree Expand file tree Collapse file tree 3 files changed +4
-13
lines changed
Expand file tree Collapse file tree 3 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 6969 "@helia/mfs" : " ^3.0.8" ,
7070 "@helia/routers" : " ^1.1.1" ,
7171 "@helia/strings" : " ^3.0.6" ,
72- "@helia/utils" : " ^0.3.3" ,
7372 "@helia/unixfs" : " ^3.0.7" ,
7473 "@ipld/car" : " ^5.3.0" ,
7574 "@ipld/dag-cbor" : " ^9.2.0" ,
Original file line number Diff line number Diff line change 44import { gossipsub } from '@chainsafe/libp2p-gossipsub'
55import { ipns } from '@helia/ipns'
66import { pubsub } from '@helia/ipns/routing'
7- import { hasCode } from '@helia/utils'
87import { generateKeyPair } from '@libp2p/crypto/keys'
98import { peerIdFromCID } from '@libp2p/peer-id'
109import { expect } from 'aegir/chai'
1110import last from 'it-last'
1211import { base36 } from 'multiformats/bases/base36'
1312import { CID } from 'multiformats/cid'
1413import * as raw from 'multiformats/codecs/raw'
14+ import { hasCode } from 'multiformats/hashes/digest'
15+ import { identity } from 'multiformats/hashes/identity'
1516import { sha256 } from 'multiformats/hashes/sha2'
1617import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
1718import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
@@ -129,7 +130,7 @@ keyTypes.filter(keyType => keyType !== 'RSA').forEach(keyType => {
129130 const peerCid = CID . parse ( result . id , base36 )
130131 const peerId = peerIdFromCID ( peerCid )
131132
132- if ( ! hasCode ( peerCid . multihash , 0 ) ) {
133+ if ( ! hasCode ( peerCid . multihash , identity . code ) ) {
133134 throw new Error ( 'Incorrect hash type' )
134135 }
135136
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ import type { Blockstore } from 'interface-blockstore'
3838import type { Datastore } from 'interface-datastore'
3939import type { BlockCodec } from 'multiformats'
4040import type { CID } from 'multiformats/cid'
41- import type { MultihashDigest , MultihashHasher } from 'multiformats/hashes/interface'
41+ import type { MultihashHasher } from 'multiformats/hashes/interface'
4242
4343export { AbstractSession , type AbstractCreateSessionOptions } from './abstract-session.js'
4444export { BloomFilter } from './bloom-filter.js'
@@ -280,12 +280,3 @@ export class Helia implements HeliaInterface {
280280 this . log ( 'gc finished' )
281281 }
282282}
283-
284- /**
285- * Used to check that the passed multihash has the passed code
286- *
287- * Remove after https://github.com/multiformats/js-multiformats/pull/308
288- */
289- export function hasCode < T extends number > ( digest : MultihashDigest , code : T ) : digest is MultihashDigest < T > {
290- return digest . code === code
291- }
You can’t perform that action at this time.
0 commit comments