Skip to content

Commit

Permalink
Use cryptoJS
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarmer08 committed Feb 27, 2024
1 parent 95cd325 commit 49c8092
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ async function deviceListCheck() {
//const devices = await wyze.getDeviceByMac('7C78B2OA4ECO')
const devices = await wyze.getDeviceByName('Bob')
logger.debug(JSON.stringify(devices));
const cleaner = await wyze.setVacuumCleanStart(devices.mac)
//const cleaner = await wyze.setVacuumCleanStart(devices.mac)
//const bulb = await wyze.localBulbCommand(devices.product_model,devices.mac,devices.enr,devices.device_params.ip, "P3", "1")
logger.debug(JSON.stringify(cleaner));
//logger.debug(JSON.stringify(cleaner));
}

(async () => {
Expand Down
7 changes: 4 additions & 3 deletions src/util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const crypto = require("crypto");
const cryptojs = require("crypto-js");

const PADDING = Buffer.from("05", "hex");

Expand Down Expand Up @@ -32,9 +33,9 @@ function decrypt(key, enc) {


function createPassword(password) {
const hex1 = crypto.MD5(password).toString();
const hex2 = crypto.MD5(hex1).toString();
const hashedPassword = crypto.MD5(hex2).toString();
const hex1 = cryptojs.MD5(password).toString();
const hex2 = cryptojs.MD5(hex1).toString();
const hashedPassword = cryptojs.MD5(hex2).toString();
return hashedPassword;
}

Expand Down

0 comments on commit 49c8092

Please sign in to comment.