mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-07-04 17:41:40 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
3598a433dc | |||
5ec88281e2 | |||
a80c481146 | |||
efc96106a4 | |||
16e1c74e9a | |||
c305c36b26 | |||
7e985b127f | |||
40d68cb512 | |||
1d86506c64 | |||
9dc7ce5f5e | |||
f775e3509b | |||
00819ba4eb | |||
6870c8c4d7 | |||
71d3a100c9 | |||
f44645ef7e | |||
a68855a5d2 | |||
d8c307a44f | |||
a5070aea6e | |||
fc9698476f | |||
ffe04c12a0 | |||
65e0b746a5 | |||
74cdb24544 |
55
CHANGELOG.md
55
CHANGELOG.md
@ -1,3 +1,58 @@
|
|||||||
|
<a name="0.13.11"></a>
|
||||||
|
## [0.13.11](https://github.com/libp2p/js-peer-id/compare/v0.13.10...v0.13.11) (2020-03-26)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.13.10"></a>
|
||||||
|
## [0.13.10](https://github.com/libp2p/js-peer-id/compare/v0.13.9...v0.13.10) (2020-03-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add buffer ([#120](https://github.com/libp2p/js-peer-id/issues/120)) ([c305c36](https://github.com/libp2p/js-peer-id/commit/c305c36))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.13.9"></a>
|
||||||
|
## [0.13.9](https://github.com/libp2p/js-peer-id/compare/v0.13.8...v0.13.9) (2020-02-19)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.13.8"></a>
|
||||||
|
## [0.13.8](https://github.com/libp2p/js-peer-id/compare/v0.13.6...v0.13.8) (2020-02-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove use of assert module ([#117](https://github.com/libp2p/js-peer-id/issues/117)) ([f44645e](https://github.com/libp2p/js-peer-id/commit/f44645e))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* adds typescript types + type tests ([#110](https://github.com/libp2p/js-peer-id/issues/110)) ([a5070ae](https://github.com/libp2p/js-peer-id/commit/a5070ae))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.13.7"></a>
|
||||||
|
## [0.13.7](https://github.com/libp2p/js-peer-id/compare/v0.13.6...v0.13.7) (2020-01-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* adds typescript types + type tests ([#110](https://github.com/libp2p/js-peer-id/issues/110)) ([a5070ae](https://github.com/libp2p/js-peer-id/commit/a5070ae))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="0.13.6"></a>
|
||||||
|
## [0.13.6](https://github.com/libp2p/js-peer-id/compare/v0.13.5...v0.13.6) (2019-12-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* catch errors thrown by multihash decode ([#109](https://github.com/libp2p/js-peer-id/issues/109)) ([65e0b74](https://github.com/libp2p/js-peer-id/commit/65e0b74))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.13.5"></a>
|
<a name="0.13.5"></a>
|
||||||
## [0.13.5](https://github.com/libp2p/js-peer-id/compare/v0.13.4...v0.13.5) (2019-11-12)
|
## [0.13.5](https://github.com/libp2p/js-peer-id/compare/v0.13.4...v0.13.5) (2019-11-12)
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ const PeerId = require('peer-id')
|
|||||||
|
|
||||||
### `new PeerId(id[, privKey, pubKey])`
|
### `new PeerId(id[, privKey, pubKey])`
|
||||||
|
|
||||||
- `id: Buffer` - The multihash of the publick key as `Buffer`
|
- `id: Buffer` - The multihash of the public key as `Buffer`
|
||||||
- `privKey: RsaPrivateKey` - The private key
|
- `privKey: RsaPrivateKey` - The private key
|
||||||
- `pubKey: RsaPublicKey` - The public key
|
- `pubKey: RsaPublicKey` - The public key
|
||||||
|
|
||||||
|
44
package.json
44
package.json
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "peer-id",
|
"name": "peer-id",
|
||||||
"version": "0.13.5",
|
"version": "0.13.11",
|
||||||
"description": "IPFS Peer Id implementation in Node.js",
|
"description": "IPFS Peer Id implementation in Node.js",
|
||||||
"leadMaintainer": "Vasco Santos <santos.vasco10@gmail.com>",
|
"leadMaintainer": "Vasco Santos <santos.vasco10@gmail.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
|
"types": "src/index.d.ts",
|
||||||
"bin": "src/bin.js",
|
"bin": "src/bin.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "aegir lint",
|
"lint": "aegir lint",
|
||||||
@ -11,6 +12,7 @@
|
|||||||
"test": "aegir test",
|
"test": "aegir test",
|
||||||
"test:node": "aegir test -t node",
|
"test:node": "aegir test -t node",
|
||||||
"test:browser": "aegir test -t browser -t webworker",
|
"test:browser": "aegir test -t browser -t webworker",
|
||||||
|
"test:types": "npx tsc",
|
||||||
"release": "aegir release",
|
"release": "aegir release",
|
||||||
"release-minor": "aegir release --type minor",
|
"release-minor": "aegir release --type minor",
|
||||||
"release-major": "aegir release --type major",
|
"release-major": "aegir release --type major",
|
||||||
@ -34,46 +36,50 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/libp2p/js-peer-id",
|
"homepage": "https://github.com/libp2p/js-peer-id",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aegir": "^20.0.0",
|
"@types/chai": "^4.2.7",
|
||||||
|
"@types/dirty-chai": "^2.0.2",
|
||||||
|
"@types/mocha": "^7.0.2",
|
||||||
|
"aegir": "^21.2.0",
|
||||||
"bundlesize": "~0.18.0",
|
"bundlesize": "~0.18.0",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"dirty-chai": "^2.0.1"
|
"dirty-chai": "^2.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cids": "~0.7.1",
|
"buffer": "^5.5.0",
|
||||||
|
"cids": "^0.8.0",
|
||||||
"class-is": "^1.1.0",
|
"class-is": "^1.1.0",
|
||||||
"libp2p-crypto": "~0.17.0",
|
"libp2p-crypto": "~0.17.3",
|
||||||
"multihashes": "~0.4.15",
|
"multihashes": "~0.4.15",
|
||||||
"protons": "^1.0.1"
|
"protons": "^1.0.2"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/libp2p/js-peer-id.git"
|
"url": "https://github.com/libp2p/js-peer-id.git"
|
||||||
},
|
},
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Arve Knudsen <arve.knudsen@gmail.com>",
|
|
||||||
"David Dias <daviddias.p@gmail.com>",
|
"David Dias <daviddias.p@gmail.com>",
|
||||||
"David Dias <mail@daviddias.me>",
|
"Vasco Santos <vasco.santos@moxy.studio>",
|
||||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
"nginnever <ginneversource@gmail.com>",
|
||||||
"Henrique Dias <hacdias@gmail.com>",
|
"dignifiedquire <dignifiedquire@gmail.com>",
|
||||||
"Hugo Dias <hugomrdias@gmail.com>",
|
|
||||||
"Jacob Heun <jacobheun@gmail.com>",
|
"Jacob Heun <jacobheun@gmail.com>",
|
||||||
|
"Pedro Teixeira <i@pgte.me>",
|
||||||
|
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
||||||
"Maciej Krüger <mkg20001@gmail.com>",
|
"Maciej Krüger <mkg20001@gmail.com>",
|
||||||
|
"Hugo Dias <hugomrdias@gmail.com>",
|
||||||
|
"Nate Foss <npfoss@gmail.com>",
|
||||||
|
"Robert Kiel <robert.kiel@validitylabs.org>",
|
||||||
|
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>",
|
||||||
|
"Arve Knudsen <arve.knudsen@gmail.com>",
|
||||||
|
"Carson Farmer <carson.farmer@gmail.com>",
|
||||||
|
"Christian Paul <info@jaller.de>",
|
||||||
|
"Henrique Dias <hacdias@gmail.com>",
|
||||||
"Marcin Rataj <lidel@lidel.org>",
|
"Marcin Rataj <lidel@lidel.org>",
|
||||||
"Michael Garvin <gar+gh@danger.computer>",
|
"Michael Garvin <gar+gh@danger.computer>",
|
||||||
"Nate Foss <npfoss@gmail.com>",
|
|
||||||
"Pedro Teixeira <i@pgte.me>",
|
|
||||||
"Prashanth Chandra <coolshanth94@gmail.com>",
|
"Prashanth Chandra <coolshanth94@gmail.com>",
|
||||||
"Richard Littauer <richard.littauer@gmail.com>",
|
"Richard Littauer <richard.littauer@gmail.com>",
|
||||||
"Richard Schneider <makaretu@gmail.com>",
|
"Richard Schneider <makaretu@gmail.com>",
|
||||||
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
|
||||||
"Topper Bowers <topper@quorumcontrol.com>",
|
"Topper Bowers <topper@quorumcontrol.com>",
|
||||||
"Vasco Santos <vasco.santos@moxy.studio>",
|
|
||||||
"Vasco Santos <vasco.santos@ua.pt>",
|
|
||||||
"Yahya <ya7yaz@gmail.com>",
|
"Yahya <ya7yaz@gmail.com>",
|
||||||
"greenkeeperio-bot <support@greenkeeper.io>",
|
"Alex Potsides <alex@achingbrain.net>"
|
||||||
"nginnever <ginneversource@gmail.com>",
|
|
||||||
"npmcdn-to-unpkg-bot <npmcdn-to-unpkg-bot@users.noreply.github.com>",
|
|
||||||
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
188
src/index.d.ts
vendored
Normal file
188
src/index.d.ts
vendored
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
import crypto, { PrivateKey, PublicKey, KeyType } from "libp2p-crypto";
|
||||||
|
import CID from 'cids'
|
||||||
|
|
||||||
|
declare namespace PeerId {
|
||||||
|
/**
|
||||||
|
* Options for PeerId creation.
|
||||||
|
*/
|
||||||
|
type CreateOptions = {
|
||||||
|
/**
|
||||||
|
* The number of bits to use.
|
||||||
|
*/
|
||||||
|
bits?: number;
|
||||||
|
/**
|
||||||
|
* The type of key to use.
|
||||||
|
*/
|
||||||
|
keyType?: KeyType;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PeerId JSON format.
|
||||||
|
*/
|
||||||
|
type JSONPeerId = {
|
||||||
|
/**
|
||||||
|
* String representation of PeerId.
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Public key.
|
||||||
|
*/
|
||||||
|
pubKey?: string;
|
||||||
|
/**
|
||||||
|
* Private key.
|
||||||
|
*/
|
||||||
|
privKey: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a value is an instance of PeerId.
|
||||||
|
* @param id The value to check.
|
||||||
|
*/
|
||||||
|
function isPeerId(id: any): id is PeerId
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PeerId.
|
||||||
|
* @param opts Options.
|
||||||
|
*/
|
||||||
|
function create(opts?: PeerId.CreateOptions): Promise<PeerId>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from hex string.
|
||||||
|
* @param str The input hex string.
|
||||||
|
*/
|
||||||
|
function createFromHexString(str: string): PeerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from raw bytes.
|
||||||
|
* @param buf The raw bytes.
|
||||||
|
*/
|
||||||
|
function createFromBytes(buf: Buffer): PeerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from base58-encoded string.
|
||||||
|
* @param str The base58-encoded string.
|
||||||
|
*/
|
||||||
|
function createFromB58String(str: string): PeerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from CID.
|
||||||
|
* @param cid The CID.
|
||||||
|
*/
|
||||||
|
function createFromCID(cid: CID | Buffer | string | object): PeerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from public key.
|
||||||
|
* @param key Public key, as Buffer or base64-encoded string.
|
||||||
|
*/
|
||||||
|
function createFromPubKey(key: Buffer | string): Promise<PeerId>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from private key.
|
||||||
|
* @param key Private key, as Buffer or base64-encoded string.
|
||||||
|
*/
|
||||||
|
function createFromPrivKey(key: Buffer | string): Promise<PeerId>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from PeerId JSON formatted object.
|
||||||
|
* @see {@link PeerId#toJSON}
|
||||||
|
* @param json PeerId in JSON format.
|
||||||
|
*/
|
||||||
|
function createFromJSON(json: JSONPeerId): Promise<PeerId>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create PeerId from Protobuf bytes.
|
||||||
|
* @param buf Protobuf bytes, as Buffer or hex-encoded string.
|
||||||
|
*/
|
||||||
|
function createFromProtobuf(buf: Buffer | string): Promise<PeerId>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PeerId is an object representation of a peer identifier.
|
||||||
|
*/
|
||||||
|
declare class PeerId {
|
||||||
|
constructor(id: Buffer | string, privKey?: PrivateKey, pubKey?: PublicKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raw id.
|
||||||
|
*/
|
||||||
|
readonly id: Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private key.
|
||||||
|
*/
|
||||||
|
privKey: PrivateKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public key.
|
||||||
|
*/
|
||||||
|
pubKey: PublicKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the protobuf version of the public key, matching go ipfs formatting.
|
||||||
|
*/
|
||||||
|
marshalPubKey(): Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the protobuf version of the private key, matching go ipfs formatting.
|
||||||
|
*/
|
||||||
|
marshalPrivKey(): Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the protobuf version of the peer-id.
|
||||||
|
* @param excludePriv Whether to exclude the private key information from the output.
|
||||||
|
*/
|
||||||
|
marshal(excludePriv?: boolean): Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String representation.
|
||||||
|
*/
|
||||||
|
toPrint(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the jsonified version of the key.
|
||||||
|
* Matches the formatting of go-ipfs for its config file.
|
||||||
|
* @see {@link PeerId.createFromJSON}
|
||||||
|
*/
|
||||||
|
toJSON(): PeerId.JSONPeerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode to hex.
|
||||||
|
*/
|
||||||
|
toHexString(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return raw id bytes.
|
||||||
|
*/
|
||||||
|
toBytes(): Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encode to base58 string.
|
||||||
|
*/
|
||||||
|
toB58String(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return self-describing string representation.
|
||||||
|
* Uses default format from RFC 0001: https://github.com/libp2p/specs/pull/209
|
||||||
|
*/
|
||||||
|
toString(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the equality of `this` peer against a given PeerId.
|
||||||
|
* @param id The other PeerId.
|
||||||
|
*/
|
||||||
|
equals(id: PeerId | Buffer): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the equality of `this` peer against a given PeerId.
|
||||||
|
* @deprecated Use {.equals}
|
||||||
|
* @param id The other PeerId.
|
||||||
|
*/
|
||||||
|
isEqual(id: PeerId | Buffer): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this PeerId instance is valid (privKey -> pubKey -> Id)
|
||||||
|
*/
|
||||||
|
isValid(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export = PeerId;
|
17
src/index.js
17
src/index.js
@ -4,19 +4,21 @@
|
|||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const { Buffer } = require('buffer')
|
||||||
const mh = require('multihashes')
|
const mh = require('multihashes')
|
||||||
const CID = require('cids')
|
const CID = require('cids')
|
||||||
const cryptoKeys = require('libp2p-crypto/src/keys')
|
const cryptoKeys = require('libp2p-crypto/src/keys')
|
||||||
const assert = require('assert')
|
|
||||||
const withIs = require('class-is')
|
const withIs = require('class-is')
|
||||||
const { PeerIdProto } = require('./proto')
|
const { PeerIdProto } = require('./proto')
|
||||||
|
|
||||||
class PeerId {
|
class PeerId {
|
||||||
constructor (id, privKey, pubKey) {
|
constructor (id, privKey, pubKey) {
|
||||||
assert(Buffer.isBuffer(id), 'invalid id provided')
|
if (!Buffer.isBuffer(id)) {
|
||||||
|
throw new Error('invalid id provided')
|
||||||
|
}
|
||||||
|
|
||||||
if (privKey && pubKey) {
|
if (privKey && pubKey && !privKey.public.bytes.equals(pubKey.bytes)) {
|
||||||
assert(privKey.public.bytes.equals(pubKey.bytes), 'inconsistent arguments')
|
throw new Error('inconsistent arguments')
|
||||||
}
|
}
|
||||||
|
|
||||||
this._id = id
|
this._id = id
|
||||||
@ -50,12 +52,17 @@ class PeerId {
|
|||||||
return this._privKey.public
|
return this._privKey.public
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const decoded = mh.decode(this.id)
|
const decoded = mh.decode(this.id)
|
||||||
|
|
||||||
if (decoded.name === 'identity') {
|
if (decoded.name === 'identity') {
|
||||||
this._pubKey = cryptoKeys.unmarshalPublicKey(decoded.digest)
|
this._pubKey = cryptoKeys.unmarshalPublicKey(decoded.digest)
|
||||||
return this._pubKey
|
|
||||||
}
|
}
|
||||||
|
} catch (_) {
|
||||||
|
// Ignore, there is no valid public key
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._pubKey
|
||||||
}
|
}
|
||||||
|
|
||||||
set pubKey (pubKey) {
|
set pubKey (pubKey) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
/* eslint-env mocha */
|
/* eslint-env mocha */
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const { Buffer } = require('buffer')
|
||||||
const chai = require('chai')
|
const chai = require('chai')
|
||||||
const dirtyChai = require('dirty-chai')
|
const dirtyChai = require('dirty-chai')
|
||||||
chai.use(dirtyChai)
|
chai.use(dirtyChai)
|
||||||
@ -271,24 +272,28 @@ describe('PeerId', () => {
|
|||||||
|
|
||||||
it('set privKey (valid)', async () => {
|
it('set privKey (valid)', async () => {
|
||||||
const peerId = await PeerId.create(testOpts)
|
const peerId = await PeerId.create(testOpts)
|
||||||
|
// @ts-ignore
|
||||||
peerId.privKey = peerId._privKey
|
peerId.privKey = peerId._privKey
|
||||||
expect(peerId.isValid()).to.equal(true)
|
expect(peerId.isValid()).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('set pubKey (valid)', async () => {
|
it('set pubKey (valid)', async () => {
|
||||||
const peerId = await PeerId.create(testOpts)
|
const peerId = await PeerId.create(testOpts)
|
||||||
|
// @ts-ignore
|
||||||
peerId.pubKey = peerId._pubKey
|
peerId.pubKey = peerId._pubKey
|
||||||
expect(peerId.isValid()).to.equal(true)
|
expect(peerId.isValid()).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('set privKey (invalid)', async () => {
|
it('set privKey (invalid)', async () => {
|
||||||
const peerId = await PeerId.create(testOpts)
|
const peerId = await PeerId.create(testOpts)
|
||||||
|
// @ts-ignore
|
||||||
peerId.privKey = Buffer.from('bufff')
|
peerId.privKey = Buffer.from('bufff')
|
||||||
expect(peerId.isValid()).to.equal(false)
|
expect(peerId.isValid()).to.equal(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('set pubKey (invalid)', async () => {
|
it('set pubKey (invalid)', async () => {
|
||||||
const peerId = await PeerId.create(testOpts)
|
const peerId = await PeerId.create(testOpts)
|
||||||
|
// @ts-ignore
|
||||||
peerId.pubKey = Buffer.from('bufff')
|
peerId.pubKey = Buffer.from('bufff')
|
||||||
expect(peerId.isValid()).to.equal(false)
|
expect(peerId.isValid()).to.equal(false)
|
||||||
})
|
})
|
||||||
|
37
tsconfig.json
Normal file
37
tsconfig.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"lib": [
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
|
"target": "ES5",
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"strictFunctionTypes": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"peer-id": [
|
||||||
|
"./src",
|
||||||
|
"../src",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"mocha",
|
||||||
|
"chai"
|
||||||
|
],
|
||||||
|
"noEmit": true,
|
||||||
|
"forceConsistentCasingInFileNames": true
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"./src/index.d.ts",
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"./test/**/*.spec.js"
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user