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