This commit is contained in:
morrigan
2019-11-26 15:24:10 +01:00
parent 2af4c744df
commit fa33cdcd44
4 changed files with 46 additions and 34 deletions

View File

@ -23,7 +23,9 @@ export function encryptStream(handshake: Handshake, session: NoiseSession) : IRe
export function decryptStream(handshake: Handshake, session: NoiseSession) : IReturnEncryptionWrapper {
return async function * (source) {
for await (const chunk of source) {
console.log("Going to decrypt chunk: ", chunk)
const decrypted = await handshake.decrypt(chunk, session);
console.log("Decrypted: ", decrypted)
yield decrypted
}
}

View File

@ -89,6 +89,8 @@ export class Handshake {
const receivedMessageBuffer = (await this.connection.readLP()).slice();
const plaintext = await this.xx.recvMessage(session, decodeMessageBuffer(receivedMessageBuffer));
}
console.log("FINISHED HANDSHAKE, is initiator: ", this.isInitiator);
}
encrypt(plaintext: bytes, session: NoiseSession): bytes {

View File

@ -91,8 +91,6 @@ export class Noise implements NoiseConnection {
const [secure, user] = DuplexPair();
const network = connection.unwrap();
console.log("Unwrapped network: ", network)
pipe(
secure, // write to wrapper
ensureBuffer, // ensure any type of data is converted to buffer