2019-11-20 13:23:36 +01:00
|
|
|
import { bytes, bytes32 } from "./basic";
|
|
|
|
import { Duplex } from "it-pair";
|
|
|
|
|
2020-01-11 20:27:26 +01:00
|
|
|
export type KeyPair = {
|
2019-11-28 17:53:27 +01:00
|
|
|
publicKey: bytes32;
|
|
|
|
privateKey: bytes32;
|
2019-11-20 13:23:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export type PeerId = {
|
2019-11-28 17:53:27 +01:00
|
|
|
id: bytes;
|
2019-11-25 14:03:23 +01:00
|
|
|
privKey: {
|
2019-11-28 17:53:27 +01:00
|
|
|
marshal(): bytes;
|
|
|
|
};
|
2019-11-25 14:03:23 +01:00
|
|
|
pubKey: {
|
2019-11-28 17:53:27 +01:00
|
|
|
marshal(): bytes;
|
|
|
|
};
|
2019-12-03 13:39:33 +01:00
|
|
|
marshalPubKey(): bytes;
|
|
|
|
marshalPrivKey(): bytes;
|
2019-11-20 13:23:36 +01:00
|
|
|
};
|
|
|
|
|
2020-01-11 20:27:26 +01:00
|
|
|
export interface INoiseConnection {
|
2019-11-28 17:53:27 +01:00
|
|
|
remoteEarlyData?(): bytes;
|
|
|
|
secureOutbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>;
|
|
|
|
secureInbound(localPeer: PeerId, insecure: any, remotePeer: PeerId): Promise<SecureOutbound>;
|
2019-11-20 13:23:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export type SecureOutbound = {
|
2019-11-28 17:53:27 +01:00
|
|
|
conn: Duplex;
|
|
|
|
remotePeer: PeerId;
|
2019-11-20 13:23:36 +01:00
|
|
|
}
|
2019-11-20 15:21:53 +01:00
|
|
|
|