mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-03-16 18:20:50 +00:00
tuned to make it work for my use case
This commit is contained in:
parent
0bd14a8898
commit
54775022f6
16
types/libp2p-crypto/index.d.ts
vendored
16
types/libp2p-crypto/index.d.ts
vendored
@ -31,13 +31,23 @@ declare namespace LibP2pCrypto {
|
||||
};
|
||||
}
|
||||
|
||||
interface Cipher {
|
||||
encrypt(data: Buffer, cb: (err?: Error, data?: Buffer) => void): void;
|
||||
decrypt(data: Buffer, cb: (err?: Error, data?: Buffer) => void): void;
|
||||
}
|
||||
|
||||
interface AES {
|
||||
create(key: Buffer, iv: Buffer, cb: (err?: Error, cipher?: Cipher) => void): void;
|
||||
}
|
||||
|
||||
interface Crypto {
|
||||
readonly keys: Keys
|
||||
readonly keys: Keys,
|
||||
readonly aes: AES
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'libp2p-crypto' {
|
||||
const crypto: LibP2pCrypto.Crypto;
|
||||
const crypto: LibP2pCrypto.Crypto;
|
||||
|
||||
export default crypto;
|
||||
export default crypto;
|
||||
}
|
||||
|
3
types/libp2p-webrtc-star/index.d.ts
vendored
3
types/libp2p-webrtc-star/index.d.ts
vendored
@ -6,8 +6,9 @@
|
||||
/// <reference types="interface-transport"/>
|
||||
|
||||
declare class LibP2pWebRtcStar implements LibP2pTransport {
|
||||
constructor(config?: any);
|
||||
}
|
||||
|
||||
declare module 'libp2p-webrtc-star' {
|
||||
export default LibP2pWebRtcStar;
|
||||
export default LibP2pWebRtcStar;
|
||||
}
|
||||
|
2
types/libp2p/index.d.ts
vendored
2
types/libp2p/index.d.ts
vendored
@ -70,7 +70,7 @@ declare class LibP2p {
|
||||
readonly peerInfo: PeerInfo;
|
||||
|
||||
dial(peerInfo: PeerInfo, cb: (error: Error | null) => any): void;
|
||||
dialProtocol(peerInfo: PeerInfo, protocol: string, cb: (error: Error | null, conn?: LibP2pConnection) => any): void;
|
||||
dialProtocol(peerInfo: PeerInfo | Multiaddr.Multiaddr, protocol: string, cb: (error: Error | null, conn?: LibP2pConnection) => any): void;
|
||||
handle(protocol: string, handler: (protocol: string, conn: LibP2pConnection) => any, matcher?: (protocol: string, requestedProtocol: string, cb: (error: Error | null, accept: boolean) => void) => any): void;
|
||||
isStarted(): boolean;
|
||||
on(event: LibP2p.Events, cb: (event: any) => any): void;
|
||||
|
28
types/peer-id/index.d.ts
vendored
28
types/peer-id/index.d.ts
vendored
@ -21,23 +21,23 @@ declare namespace PeerId {
|
||||
}
|
||||
|
||||
declare class PeerId {
|
||||
constructor (id: Buffer, privKey?: LibP2pCrypto.PrivateKey, pubKey?: LibP2pCrypto.PublicKey);
|
||||
constructor(id: Buffer, privKey?: LibP2pCrypto.PrivateKey, pubKey?: LibP2pCrypto.PublicKey);
|
||||
|
||||
static create (optsOrCb: PeerId.CreateOptions | PeerId.CreateCb, cb?: PeerId.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;
|
||||
static create(optsOrCb: PeerId.CreateOptions | PeerId.CreateCb, cb?: PeerId.CreateCb): void;
|
||||
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, cb: PeerId.CreateCb): void;
|
||||
|
||||
isEqual (other: PeerId | Buffer): boolean;
|
||||
toB58String (): string;
|
||||
toBytes (): Buffer;
|
||||
toHexString (): string;
|
||||
toJSON (): PeerId.JSON;
|
||||
isEqual(other: PeerId | Buffer): boolean;
|
||||
toB58String(): string;
|
||||
toBytes(): Buffer;
|
||||
toHexString(): string;
|
||||
toJSON(): PeerId.JSON;
|
||||
}
|
||||
|
||||
declare module 'peer-id' {
|
||||
export default PeerId;
|
||||
export default PeerId;
|
||||
}
|
||||
|
24
types/pull-stream/index.d.ts
vendored
24
types/pull-stream/index.d.ts
vendored
@ -6,16 +6,22 @@
|
||||
/// <reference types="node"/>
|
||||
|
||||
declare module 'pull-stream' {
|
||||
export type PullStream = {
|
||||
// FIXME this should be actual streams, not 'any'
|
||||
(...streams: Array<any>): void;
|
||||
export type PullStream = {
|
||||
// FIXME this should be actual streams, not 'any'
|
||||
(...streams: Array<any>): void;
|
||||
|
||||
collect: (cb: (error: Error | null, values: Array<Buffer>) => any) => void,
|
||||
drain: (handler: (message: Buffer) => void, errorHandler?: (error: Error) => boolean) => void;
|
||||
values: (values: Array<string | Buffer>) => void;
|
||||
};
|
||||
collect: (cb: (error: Error | null, values: Array<Buffer>) => any) => void,
|
||||
drain: (handler: (message: Buffer) => void, errorHandler?: (error: Error) => boolean) => void;
|
||||
values: (values: Array<string | Buffer>) => void;
|
||||
map: (mapper: (x: any) => any) => any;
|
||||
asyncMap: (mapper: (x: any, cb: (err?: Error, data?: any) => void) => void) => void;
|
||||
};
|
||||
|
||||
const pull: PullStream;
|
||||
const pull: PullStream;
|
||||
|
||||
export default pull;
|
||||
export default pull;
|
||||
}
|
||||
|
||||
declare module 'pull-catch' {
|
||||
export default function Catch(handler: (error: Error) => void): any;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user