Files
node-screenlogic/messages/SLLoginMessage.js
Parnic a09df2569b Added support for remote + passworded access
This password encoder was decompiled from the Android app then manually cleaned up and ported to Javascript. It ain't pretty, but it works.

I don't know that this is all necessarily the most correct or idiomatic way to implement these features, but I wanted to make sure the functionality got committed to help out people wanting to use this for smart home appliances (#1).
2019-02-22 16:06:11 -06:00

29 lines
697 B
JavaScript
Executable File

'use strict';
const SLMessage = require('./SLMessage.js').SLMessage;
const MSG_ID = 27;
exports.SLLoginMessage = class SLLoginMessage extends SLMessage {
constructor(password) {
super(0, MSG_ID);
this.writeInt32LE(348); // schema
this.writeInt32LE(0); // connection type
this.writeSLString('node-screenlogic'); // version
if (!password) {
password = new Array(16);
}
if (password.length > 16) {
password = password.slice(0, 16);
}
this.writeSLArray(password); // encoded password. empty/unused for local connections
this.writeInt32LE(2); // procID
}
static getResponseId() {
return MSG_ID + 1;
}
};