mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-03-16 18:20:50 +00:00
Added libp2p peer-id
This commit is contained in:
parent
77c1fda97f
commit
e18b84e220
38
peer-id/index.d.ts
vendored
Normal file
38
peer-id/index.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Type definitions for peer-id 0.10.7
|
||||
// Project: https://github.com/libp2p/js-peer-id
|
||||
// Definitions by: Jaco Greeff <https://github.com/jacogr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
type CreateCb = (error: Error | null, peerId?: PeerId) => any;
|
||||
|
||||
type CreateOptions = {
|
||||
bits: number
|
||||
};
|
||||
|
||||
type JSON = {
|
||||
id: string,
|
||||
pubKey: string,
|
||||
privKey: string
|
||||
};
|
||||
|
||||
declare class PeerId {
|
||||
constructor (id: Buffer, privKey?: any, pubKey?: any);
|
||||
|
||||
static create (optsOrCb: CreateOptions | CreateCb, cb?: CreateCb): PeerId;
|
||||
static createFromB58String (str: string): PeerId;
|
||||
static createFromBytes (buf: Buffer): PeerId;
|
||||
static createFromHexString (str: string): PeerId;
|
||||
static createFromJSON (json: JSON): PeerId;
|
||||
static createFromPubKey (key: Buffer): PeerId;
|
||||
static createFromPrivKey (key: Buffer): PeerId;
|
||||
|
||||
isEqual (other: PeerId | Buffer): boolean;
|
||||
toB58String (): string;
|
||||
toBytes (): Buffer;
|
||||
toHexString (): string;
|
||||
toJSON (): JSON;
|
||||
}
|
||||
|
||||
export = PeerId;
|
0
peer-id/peer-id-tests.ts
Normal file
0
peer-id/peer-id-tests.ts
Normal file
16
peer-id/tsconfig.json
Normal file
16
peer-id/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "bn.js-tests.ts"]
|
||||
}
|
1
peer-id/tslint.json
Normal file
1
peer-id/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
Loading…
x
Reference in New Issue
Block a user