30 lines
603 B
TypeScript
Raw Normal View History

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 = {
2019-11-25 14:03:23 +01:00
id: bytes,
privKey: {
2019-11-28 17:32:46 +01:00
marshal(): bytes,
2019-11-25 14:03:23 +01:00
},
pubKey: {
2019-11-28 17:32:46 +01:00
marshal(): bytes,
2019-11-25 14:03:23 +01:00
},
2019-11-20 13:23:36 +01:00
};
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