🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

hap-controller

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hap-controller - npm Package Compare versions

Comparing version

to
0.9.0

6

lib/model/error.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const json_bigint_1 = __importDefault(require("json-bigint"));
class HomekitControllerError extends Error {

@@ -24,3 +28,3 @@ constructor(message, statusCode, body) {

try {
this.body = JSON.parse(body.toString('utf-8'));
this.body = json_bigint_1.default.parse(body.toString('utf-8'));
}

@@ -27,0 +31,0 @@ catch (err) {

17

lib/transport/ip/http-client.js

@@ -40,2 +40,3 @@ "use strict";

const queue_1 = require("../../utils/queue");
const json_bigint_1 = __importDefault(require("json-bigint"));
const debug = (0, debug_1.default)('hap-controller:http-client');

@@ -322,3 +323,3 @@ class HttpClient extends events_1.EventEmitter {

}
const res = JSON.parse(response.body.toString());
const res = json_bigint_1.default.parse(response.body.toString());
res.accessories.forEach((accessory) => {

@@ -371,3 +372,3 @@ accessory.services.forEach((service) => {

}
return JSON.parse(response.body.toString());
return json_bigint_1.default.parse(response.body.toString());
}

@@ -410,3 +411,3 @@ finally {

try {
const response = await connection.put('/characteristics', Buffer.from(JSON.stringify(data)));
const response = await connection.put('/characteristics', Buffer.from(json_bigint_1.default.stringify(data)));
if (response.statusCode === 204) {

@@ -416,3 +417,3 @@ return data;

else if (response.statusCode === 207) {
return JSON.parse(response.body.toString());
return json_bigint_1.default.parse(response.body.toString());
}

@@ -474,3 +475,3 @@ else {

*/
this.emit('event', JSON.parse(ev));
this.emit('event', json_bigint_1.default.parse(ev));
});

@@ -495,3 +496,3 @@ connection.once('disconnect', () => {

}
const response = await connection.put('/characteristics', Buffer.from(JSON.stringify(data)), 'application/hap+json', true);
const response = await connection.put('/characteristics', Buffer.from(json_bigint_1.default.stringify(data)), 'application/hap+json', true);
if (response.statusCode !== 204 && response.statusCode !== 207) {

@@ -543,3 +544,3 @@ if (!this.subscribedCharacteristics.length) {

if (data.characteristics.length) {
const response = await this.subscriptionConnection.put('/characteristics', Buffer.from(JSON.stringify(data)));
const response = await this.subscriptionConnection.put('/characteristics', Buffer.from(json_bigint_1.default.stringify(data)));
if (response.statusCode !== 204 && response.statusCode !== 207) {

@@ -589,3 +590,3 @@ throw new error_1.default(`Unsubscribe failed with status ${response.statusCode}`, response.statusCode, response.body);

try {
const response = await connection.post('/resource', Buffer.from(JSON.stringify(data)));
const response = await connection.post('/resource', Buffer.from(json_bigint_1.default.stringify(data)));
if (response.statusCode !== 200) {

@@ -592,0 +593,0 @@ throw new error_1.default(`Image request errored with status ${response.statusCode}`, response.statusCode, response.body);

{
"name": "hap-controller",
"version": "0.8.4",
"version": "0.9.0",
"description": "Library to implement a HAP (HomeKit) controller",

@@ -36,2 +36,3 @@ "main": "lib/index.js",

"http-parser-js": "^0.5.8",
"json-bigint": "^1.0.0",
"libsodium-wrappers": "^0.7.10",

@@ -45,12 +46,13 @@ "node-hkdf-sync": "^1.0.0",

"@types/dnssd": "^0.4.2",
"@types/json-bigint": "^1.0.1",
"@types/libsodium-wrappers": "^0.7.10",
"@types/node": "^18.11.17",
"@types/node": "^18.11.18",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"eslint": "^8.31.0",
"eslint-config-prettier": "^8.6.0",
"event-to-promise": "^0.8.0",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier": "^2.8.2",
"typescript": "^4.9.4"

@@ -57,0 +59,0 @@ },

@@ -276,2 +276,5 @@ # hap-controller

## Changelog
### 0.9.0 (2023-01-09)
* (Apollon77) BREAKING: Returned data objects partially contain BigInt values (represented by bignumber.js instances) for iid/aid fields!
### 0.8.4 (2023-01-05)

@@ -278,0 +281,0 @@ * (Apollon77) Upgrade noble

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet