mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-29 04:42:19 +00:00
25 lines
542 B
TypeScript
25 lines
542 B
TypeScript
|
import { bytes, bytes32 } from "./basic";
|
||
|
import { Duplex } from "it-pair";
|
||
|
|
||
|
export interface KeyPair {
|
||
|
publicKey: bytes32,
|
||
|
privateKey: bytes32,
|
||
|
}
|
||
|
|
||
|
export type PeerId = {
|
||
|
id: string,
|
||
|
privKey: string,
|
||
|
pubKey: string,
|
||
|
};
|
||
|
|
||
|
export interface NoiseConnection {
|
||
|
remoteEarlyData?(): bytes,
|
||
|
secureOutbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>,
|
||
|
secureInbound(remotePeer: PeerId, insecure: any): Promise<SecureOutbound>,
|
||
|
}
|
||
|
|
||
|
export type SecureOutbound = {
|
||
|
conn: Duplex,
|
||
|
remotePeer: PeerId,
|
||
|
}
|