2019-11-20 13:23:36 +01:00
|
|
|
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>,
|
2019-11-21 14:43:12 +01:00
|
|
|
secureInbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>,
|
2019-11-20 13:23:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export type SecureOutbound = {
|
|
|
|
conn: Duplex,
|
|
|
|
remotePeer: PeerId,
|
|
|
|
}
|
2019-11-20 15:21:53 +01:00
|
|
|
|