diff --git a/package.json b/package.json index 0cbfa4bd4a..bfad34aa74 100644 --- a/package.json +++ b/package.json @@ -149,11 +149,11 @@ "@libp2p/crypto": "^1.0.11", "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/interface-record": "^2.0.1", + "@libp2p/interfaces": "^3.2.0", "@libp2p/logger": "^2.0.5", "@libp2p/peer-id": "^2.0.0", "@libp2p/utils": "^3.0.0", "@multiformats/multiaddr": "^11.0.0", - "err-code": "^3.0.1", "interface-datastore": "^7.0.0", "it-all": "^2.0.0", "it-filter": "^2.0.0", diff --git a/src/envelope/index.ts b/src/envelope/index.ts index ffa6051b1a..630f86b314 100644 --- a/src/envelope/index.ts +++ b/src/envelope/index.ts @@ -1,4 +1,4 @@ -import errCode from 'err-code' +import { CodeError } from '@libp2p/interfaces/errors' import { fromString as uint8arraysFromString } from 'uint8arrays/from-string' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { unmarshalPrivateKey, unmarshalPublicKey } from '@libp2p/crypto/keys' @@ -66,7 +66,7 @@ export class RecordEnvelope implements Envelope { const valid = await envelope.validate(domain) if (!valid) { - throw errCode(new Error('envelope signature is not valid for the given domain'), codes.ERR_SIGNATURE_NOT_VALID) + throw new CodeError('envelope signature is not valid for the given domain', codes.ERR_SIGNATURE_NOT_VALID) } return envelope