appium-ios-remotexpc 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/src/base-plist-service.d.ts +51 -0
- package/build/src/base-plist-service.d.ts.map +1 -0
- package/build/src/base-plist-service.js +61 -0
- package/build/src/base-socket-service.d.ts +15 -0
- package/build/src/base-socket-service.d.ts.map +1 -0
- package/build/src/base-socket-service.js +46 -0
- package/build/src/index.d.ts +9 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +7 -0
- package/build/src/lib/apple-tv/constants.d.ts +49 -0
- package/build/src/lib/apple-tv/constants.d.ts.map +1 -0
- package/build/src/lib/apple-tv/constants.js +71 -0
- package/build/src/lib/apple-tv/errors.d.ts +17 -0
- package/build/src/lib/apple-tv/errors.d.ts.map +1 -0
- package/build/src/lib/apple-tv/errors.js +30 -0
- package/build/src/lib/apple-tv/tlv/decoder.d.ts +19 -0
- package/build/src/lib/apple-tv/tlv/decoder.d.ts.map +1 -0
- package/build/src/lib/apple-tv/tlv/decoder.js +49 -0
- package/build/src/lib/apple-tv/tlv/encoder.d.ts +10 -0
- package/build/src/lib/apple-tv/tlv/encoder.d.ts.map +1 -0
- package/build/src/lib/apple-tv/tlv/encoder.js +20 -0
- package/build/src/lib/apple-tv/tlv/index.d.ts +4 -0
- package/build/src/lib/apple-tv/tlv/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/tlv/index.js +3 -0
- package/build/src/lib/apple-tv/tlv/pairing-tlv.d.ts +14 -0
- package/build/src/lib/apple-tv/tlv/pairing-tlv.d.ts.map +1 -0
- package/build/src/lib/apple-tv/tlv/pairing-tlv.js +27 -0
- package/build/src/lib/apple-tv/types.d.ts +36 -0
- package/build/src/lib/apple-tv/types.d.ts.map +1 -0
- package/build/src/lib/apple-tv/types.js +1 -0
- package/build/src/lib/apple-tv/utils/buffer-utils.d.ts +40 -0
- package/build/src/lib/apple-tv/utils/buffer-utils.d.ts.map +1 -0
- package/build/src/lib/apple-tv/utils/buffer-utils.js +76 -0
- package/build/src/lib/apple-tv/utils/index.d.ts +3 -0
- package/build/src/lib/apple-tv/utils/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/utils/index.js +2 -0
- package/build/src/lib/apple-tv/utils/uuid-generator.d.ts +9 -0
- package/build/src/lib/apple-tv/utils/uuid-generator.d.ts.map +1 -0
- package/build/src/lib/apple-tv/utils/uuid-generator.js +36 -0
- package/build/src/lib/lockdown/index.d.ts +87 -0
- package/build/src/lib/lockdown/index.d.ts.map +1 -0
- package/build/src/lib/lockdown/index.js +324 -0
- package/build/src/lib/pair-record/index.d.ts +3 -0
- package/build/src/lib/pair-record/index.d.ts.map +1 -0
- package/build/src/lib/pair-record/index.js +2 -0
- package/build/src/lib/pair-record/pair-record.d.ts +48 -0
- package/build/src/lib/pair-record/pair-record.d.ts.map +1 -0
- package/build/src/lib/pair-record/pair-record.js +85 -0
- package/build/src/lib/plist/binary-plist-creator.d.ts +14 -0
- package/build/src/lib/plist/binary-plist-creator.d.ts.map +1 -0
- package/build/src/lib/plist/binary-plist-creator.js +475 -0
- package/build/src/lib/plist/binary-plist-parser.d.ts +14 -0
- package/build/src/lib/plist/binary-plist-parser.d.ts.map +1 -0
- package/build/src/lib/plist/binary-plist-parser.js +449 -0
- package/build/src/lib/plist/constants.d.ts +36 -0
- package/build/src/lib/plist/constants.d.ts.map +1 -0
- package/build/src/lib/plist/constants.js +43 -0
- package/build/src/lib/plist/index.d.ts +14 -0
- package/build/src/lib/plist/index.d.ts.map +1 -0
- package/build/src/lib/plist/index.js +16 -0
- package/build/src/lib/plist/length-based-splitter.d.ts +43 -0
- package/build/src/lib/plist/length-based-splitter.d.ts.map +1 -0
- package/build/src/lib/plist/length-based-splitter.js +228 -0
- package/build/src/lib/plist/plist-creator.d.ts +8 -0
- package/build/src/lib/plist/plist-creator.d.ts.map +1 -0
- package/build/src/lib/plist/plist-creator.js +33 -0
- package/build/src/lib/plist/plist-decoder.d.ts +25 -0
- package/build/src/lib/plist/plist-decoder.d.ts.map +1 -0
- package/build/src/lib/plist/plist-decoder.js +103 -0
- package/build/src/lib/plist/plist-encoder.d.ts +10 -0
- package/build/src/lib/plist/plist-encoder.d.ts.map +1 -0
- package/build/src/lib/plist/plist-encoder.js +27 -0
- package/build/src/lib/plist/plist-parser.d.ts +9 -0
- package/build/src/lib/plist/plist-parser.d.ts.map +1 -0
- package/build/src/lib/plist/plist-parser.js +109 -0
- package/build/src/lib/plist/plist-service.d.ts +86 -0
- package/build/src/lib/plist/plist-service.d.ts.map +1 -0
- package/build/src/lib/plist/plist-service.js +180 -0
- package/build/src/lib/plist/unified-plist-creator.d.ts +9 -0
- package/build/src/lib/plist/unified-plist-creator.d.ts.map +1 -0
- package/build/src/lib/plist/unified-plist-creator.js +14 -0
- package/build/src/lib/plist/unified-plist-parser.d.ts +8 -0
- package/build/src/lib/plist/unified-plist-parser.d.ts.map +1 -0
- package/build/src/lib/plist/unified-plist-parser.js +23 -0
- package/build/src/lib/plist/utils.d.ts +97 -0
- package/build/src/lib/plist/utils.d.ts.map +1 -0
- package/build/src/lib/plist/utils.js +287 -0
- package/build/src/lib/remote-xpc/constants.d.ts +20 -0
- package/build/src/lib/remote-xpc/constants.d.ts.map +1 -0
- package/build/src/lib/remote-xpc/constants.js +21 -0
- package/build/src/lib/remote-xpc/handshake-frames.d.ts +74 -0
- package/build/src/lib/remote-xpc/handshake-frames.d.ts.map +1 -0
- package/build/src/lib/remote-xpc/handshake-frames.js +285 -0
- package/build/src/lib/remote-xpc/handshake.d.ts +14 -0
- package/build/src/lib/remote-xpc/handshake.d.ts.map +1 -0
- package/build/src/lib/remote-xpc/handshake.js +95 -0
- package/build/src/lib/remote-xpc/remote-xpc-connection.d.ts +55 -0
- package/build/src/lib/remote-xpc/remote-xpc-connection.d.ts.map +1 -0
- package/build/src/lib/remote-xpc/remote-xpc-connection.js +365 -0
- package/build/src/lib/remote-xpc/xpc-protocol.d.ts +22 -0
- package/build/src/lib/remote-xpc/xpc-protocol.d.ts.map +1 -0
- package/build/src/lib/remote-xpc/xpc-protocol.js +368 -0
- package/build/src/lib/tunnel/index.d.ts +69 -0
- package/build/src/lib/tunnel/index.d.ts.map +1 -0
- package/build/src/lib/tunnel/index.js +205 -0
- package/build/src/lib/tunnel/packet-stream-client.d.ts +46 -0
- package/build/src/lib/tunnel/packet-stream-client.d.ts.map +1 -0
- package/build/src/lib/tunnel/packet-stream-client.js +152 -0
- package/build/src/lib/tunnel/packet-stream-server.d.ts +37 -0
- package/build/src/lib/tunnel/packet-stream-server.d.ts.map +1 -0
- package/build/src/lib/tunnel/packet-stream-server.js +109 -0
- package/build/src/lib/tunnel/tunnel-api-client.d.ts +85 -0
- package/build/src/lib/tunnel/tunnel-api-client.d.ts.map +1 -0
- package/build/src/lib/tunnel/tunnel-api-client.js +207 -0
- package/build/src/lib/tunnel/tunnel-registry-server.d.ts +68 -0
- package/build/src/lib/tunnel/tunnel-registry-server.d.ts.map +1 -0
- package/build/src/lib/tunnel/tunnel-registry-server.js +351 -0
- package/build/src/lib/types.d.ts +238 -0
- package/build/src/lib/types.d.ts.map +1 -0
- package/build/src/lib/types.js +4 -0
- package/build/src/lib/usbmux/index.d.ts +177 -0
- package/build/src/lib/usbmux/index.d.ts.map +1 -0
- package/build/src/lib/usbmux/index.js +490 -0
- package/build/src/lib/usbmux/usbmux-decoder.d.ts +19 -0
- package/build/src/lib/usbmux/usbmux-decoder.d.ts.map +1 -0
- package/build/src/lib/usbmux/usbmux-decoder.js +38 -0
- package/build/src/lib/usbmux/usbmux-encoder.d.ts +12 -0
- package/build/src/lib/usbmux/usbmux-encoder.d.ts.map +1 -0
- package/build/src/lib/usbmux/usbmux-encoder.js +32 -0
- package/build/src/service-connection.d.ts +34 -0
- package/build/src/service-connection.d.ts.map +1 -0
- package/build/src/service-connection.js +51 -0
- package/build/src/services/index.d.ts +6 -0
- package/build/src/services/index.d.ts.map +1 -0
- package/build/src/services/index.js +5 -0
- package/build/src/services/ios/base-service.d.ts +35 -0
- package/build/src/services/ios/base-service.d.ts.map +1 -0
- package/build/src/services/ios/base-service.js +55 -0
- package/build/src/services/ios/diagnostic-service/index.d.ts +46 -0
- package/build/src/services/ios/diagnostic-service/index.d.ts.map +1 -0
- package/build/src/services/ios/diagnostic-service/index.js +169 -0
- package/build/src/services/ios/diagnostic-service/keys.d.ts +5 -0
- package/build/src/services/ios/diagnostic-service/keys.d.ts.map +1 -0
- package/build/src/services/ios/diagnostic-service/keys.js +770 -0
- package/build/src/services/ios/syslog-service/index.d.ts +91 -0
- package/build/src/services/ios/syslog-service/index.d.ts.map +1 -0
- package/build/src/services/ios/syslog-service/index.js +323 -0
- package/build/src/services/ios/tunnel-service/index.d.ts +17 -0
- package/build/src/services/ios/tunnel-service/index.d.ts.map +1 -0
- package/build/src/services/ios/tunnel-service/index.js +57 -0
- package/build/src/services.d.ts +14 -0
- package/build/src/services.d.ts.map +1 -0
- package/build/src/services.js +48 -0
- package/package.json +12 -3
- package/.github/dependabot.yml +0 -38
- package/.github/workflows/format-check.yml +0 -43
- package/.github/workflows/lint-and-build.yml +0 -40
- package/.github/workflows/pr-title.yml +0 -16
- package/.github/workflows/publish.js.yml +0 -41
- package/.github/workflows/test-validation.yml +0 -40
- package/.mocharc.json +0 -8
- package/.prettierignore +0 -3
- package/.prettierrc +0 -17
- package/.releaserc +0 -48
- package/assets/images/ios-arch.png +0 -0
- package/eslint.config.js +0 -45
- package/npm-shrinkwrap.json +0 -2711
- package/test/integration/diagnostics-test.ts +0 -44
- package/test/integration/read-pair-record-test.ts +0 -39
- package/test/integration/tunnel-test.ts +0 -104
- package/test/unit/apple-tv/tlv/decoder.spec.ts +0 -144
- package/test/unit/apple-tv/tlv/encoder.spec.ts +0 -91
- package/test/unit/apple-tv/tlv/pairing-tlv.spec.ts +0 -101
- package/test/unit/apple-tv/tlv/tlv-integration.spec.ts +0 -146
- package/test/unit/apple-tv/utils/buffer-utils.spec.ts +0 -74
- package/test/unit/apple-tv/utils/uuid-generator.spec.ts +0 -39
- package/test/unit/fixtures/index.ts +0 -88
- package/test/unit/fixtures/usbmuxconnectmessage.bin +0 -0
- package/test/unit/fixtures/usbmuxlistdevicemessage.bin +0 -0
- package/test/unit/plist/error-handling.spec.ts +0 -101
- package/test/unit/plist/fixtures/sample.binary.plist +0 -0
- package/test/unit/plist/fixtures/sample.xml.plist +0 -38
- package/test/unit/plist/plist-parser.spec.ts +0 -283
- package/test/unit/plist/plist.spec.ts +0 -205
- package/test/unit/plist/tag-position-handling.spec.ts +0 -90
- package/test/unit/plist/unified-plist-parser.spec.ts +0 -227
- package/test/unit/plist/utils.spec.ts +0 -249
- package/test/unit/plist/xml-cleaning.spec.ts +0 -60
- package/test/unit/tunnel/tunnel-registry-server.spec.ts +0 -194
- package/test/unit/usbmux/usbmux-specs.ts +0 -71
- package/tsconfig.json +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [0.0.4](https://github.com/appium/appium-ios-remotexpc/compare/v0.0.3...v0.0.4) (2025-07-03)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* Add build release to npm module ([#49](https://github.com/appium/appium-ios-remotexpc/issues/49)) ([77c7720](https://github.com/appium/appium-ios-remotexpc/commit/77c77201d730e8a501813fc39bf1a768de2bf497))
|
|
6
|
+
|
|
7
|
+
## [0.0.3](https://github.com/appium/appium-ios-remotexpc/compare/v0.0.2...v0.0.3) (2025-07-03)
|
|
8
|
+
|
|
9
|
+
### Miscellaneous Chores
|
|
10
|
+
|
|
11
|
+
* add more permissions ([1933d7e](https://github.com/appium/appium-ios-remotexpc/commit/1933d7e1ce04fceeb90812ea62a2e8083c6d61ed))
|
|
12
|
+
|
|
1
13
|
## [0.0.2](https://github.com/appium/appium-ios-remotexpc/compare/v0.0.1...v0.0.2) (2025-07-03)
|
|
2
14
|
|
|
3
15
|
### Miscellaneous Chores
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Socket } from 'node:net';
|
|
2
|
+
import { PlistService, type PlistServiceOptions } from './lib/plist/plist-service.js';
|
|
3
|
+
import type { PlistDictionary } from './lib/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Message type for plist communications
|
|
6
|
+
*/
|
|
7
|
+
type PlistMessage = PlistDictionary;
|
|
8
|
+
/**
|
|
9
|
+
* Base class for services that use PlistService for communication
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class BasePlistService {
|
|
12
|
+
/**
|
|
13
|
+
* Sends a message and waits for a response
|
|
14
|
+
* @param message The message to send
|
|
15
|
+
* @param timeout Timeout in milliseconds
|
|
16
|
+
* @returns Promise resolving to the response
|
|
17
|
+
*/
|
|
18
|
+
sendAndReceive(message: PlistMessage, timeout?: number): Promise<PlistMessage>;
|
|
19
|
+
/**
|
|
20
|
+
* Closes the underlying connection
|
|
21
|
+
*/
|
|
22
|
+
close(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the PlistService instance
|
|
25
|
+
* @returns The PlistService instance
|
|
26
|
+
*/
|
|
27
|
+
protected getPlistService(): PlistService;
|
|
28
|
+
/**
|
|
29
|
+
* The underlying PlistService instance
|
|
30
|
+
*/
|
|
31
|
+
protected _plistService: PlistService;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new BasePlistService
|
|
34
|
+
* @param plistServiceOrSocket PlistService instance or Socket
|
|
35
|
+
* @param options Configuration options for PlistService
|
|
36
|
+
*/
|
|
37
|
+
protected constructor(plistServiceOrSocket: PlistService | Socket, options?: PlistServiceOptions);
|
|
38
|
+
/**
|
|
39
|
+
* Sends a message without waiting for a response
|
|
40
|
+
* @param message The message to send
|
|
41
|
+
*/
|
|
42
|
+
protected send(message: PlistMessage): void;
|
|
43
|
+
/**
|
|
44
|
+
* Waits for a message
|
|
45
|
+
* @param timeout Timeout in milliseconds
|
|
46
|
+
* @returns Promise resolving to the received message
|
|
47
|
+
*/
|
|
48
|
+
protected receive(timeout?: number): Promise<PlistMessage>;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=base-plist-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-plist-service.d.ts","sourceRoot":"","sources":["../../src/base-plist-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,KAAK,YAAY,GAAG,eAAe,CAAC;AAEpC;;GAEG;AACH,8BAAsB,gBAAgB;IACpC;;;;;OAKG;IACG,cAAc,CAClB,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC;IAIxB;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;OAGG;IACH,SAAS,CAAC,eAAe,IAAI,YAAY;IAIzC;;OAEG;IACH,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC;IAEtC;;;;OAIG;IACH,SAAS,aACP,oBAAoB,EAAE,YAAY,GAAG,MAAM,EAC3C,OAAO,GAAE,mBAAwB;IASnC;;;OAGG;IACH,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAI3C;;;;OAIG;cACa,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAGjE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Socket } from 'node:net';
|
|
2
|
+
import { PlistService, } from './lib/plist/plist-service.js';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for services that use PlistService for communication
|
|
5
|
+
*/
|
|
6
|
+
export class BasePlistService {
|
|
7
|
+
/**
|
|
8
|
+
* Sends a message and waits for a response
|
|
9
|
+
* @param message The message to send
|
|
10
|
+
* @param timeout Timeout in milliseconds
|
|
11
|
+
* @returns Promise resolving to the response
|
|
12
|
+
*/
|
|
13
|
+
async sendAndReceive(message, timeout) {
|
|
14
|
+
return this._plistService.sendPlistAndReceive(message, timeout);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Closes the underlying connection
|
|
18
|
+
*/
|
|
19
|
+
close() {
|
|
20
|
+
this._plistService.close();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets the PlistService instance
|
|
24
|
+
* @returns The PlistService instance
|
|
25
|
+
*/
|
|
26
|
+
getPlistService() {
|
|
27
|
+
return this._plistService;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The underlying PlistService instance
|
|
31
|
+
*/
|
|
32
|
+
_plistService;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new BasePlistService
|
|
35
|
+
* @param plistServiceOrSocket PlistService instance or Socket
|
|
36
|
+
* @param options Configuration options for PlistService
|
|
37
|
+
*/
|
|
38
|
+
constructor(plistServiceOrSocket, options = {}) {
|
|
39
|
+
if (plistServiceOrSocket instanceof PlistService) {
|
|
40
|
+
this._plistService = plistServiceOrSocket;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this._plistService = new PlistService(plistServiceOrSocket, options);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends a message without waiting for a response
|
|
48
|
+
* @param message The message to send
|
|
49
|
+
*/
|
|
50
|
+
send(message) {
|
|
51
|
+
this._plistService.sendPlist(message);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Waits for a message
|
|
55
|
+
* @param timeout Timeout in milliseconds
|
|
56
|
+
* @returns Promise resolving to the received message
|
|
57
|
+
*/
|
|
58
|
+
async receive(timeout) {
|
|
59
|
+
return this._plistService.receivePlist(timeout);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { Socket } from 'node:net';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
|
+
declare class BaseSocketService extends EventEmitter {
|
|
5
|
+
protected _socketClient: Socket;
|
|
6
|
+
protected _isConnected: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @param socketClient
|
|
9
|
+
*/
|
|
10
|
+
constructor(socketClient: Socket);
|
|
11
|
+
_assignClientFailureHandlers(...sourceStreams: Readable[]): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
14
|
+
export { BaseSocketService };
|
|
15
|
+
//# sourceMappingURL=base-socket-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-socket-service.d.ts","sourceRoot":"","sources":["../../src/base-socket-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,cAAM,iBAAkB,SAAQ,YAAY;IAC1C,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAS;IAExC;;OAEG;gBACS,YAAY,EAAE,MAAM;IA0BhC,4BAA4B,CAAC,GAAG,aAAa,EAAE,QAAQ,EAAE,GAAG,IAAI;IAUhE,KAAK,IAAI,IAAI;CAKd;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { Socket } from 'node:net';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
|
+
class BaseSocketService extends EventEmitter {
|
|
5
|
+
_socketClient;
|
|
6
|
+
_isConnected = false;
|
|
7
|
+
/**
|
|
8
|
+
* @param socketClient
|
|
9
|
+
*/
|
|
10
|
+
constructor(socketClient) {
|
|
11
|
+
super();
|
|
12
|
+
this._socketClient = socketClient;
|
|
13
|
+
// Check if already connected
|
|
14
|
+
this._isConnected = !socketClient.connecting && !socketClient.destroyed;
|
|
15
|
+
// if not connected and it's a raw socket
|
|
16
|
+
if (!this._isConnected && socketClient instanceof Socket) {
|
|
17
|
+
this._socketClient.once('connect', () => {
|
|
18
|
+
this._isConnected = true;
|
|
19
|
+
this.emit('connect');
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// setup basic error handling
|
|
23
|
+
this._socketClient.on('error', (err) => {
|
|
24
|
+
this.emit('error', err);
|
|
25
|
+
});
|
|
26
|
+
this._socketClient.on('close', () => {
|
|
27
|
+
this._isConnected = false;
|
|
28
|
+
this.emit('close');
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
_assignClientFailureHandlers(...sourceStreams) {
|
|
32
|
+
for (const evt of ['close', 'end']) {
|
|
33
|
+
this._socketClient.once(evt, () => {
|
|
34
|
+
sourceStreams.map((s) => {
|
|
35
|
+
s.unpipe(this._socketClient);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
close() {
|
|
41
|
+
if (!this._socketClient.destroyed) {
|
|
42
|
+
this._socketClient.end();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export { BaseSocketService };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createLockdownServiceByUDID } from './lib/lockdown/index.js';
|
|
2
|
+
import { PacketStreamClient, PacketStreamServer, TunnelManager } from './lib/tunnel/index.js';
|
|
3
|
+
import { TunnelRegistryServer, startTunnelRegistryServer } from './lib/tunnel/tunnel-registry-server.js';
|
|
4
|
+
import { Usbmux, createUsbmux } from './lib/usbmux/index.js';
|
|
5
|
+
import * as Services from './services.js';
|
|
6
|
+
import { startCoreDeviceProxy } from './services/ios/tunnel-service/index.js';
|
|
7
|
+
export type { DiagnosticsService, SyslogService, SocketInfo, TunnelResult, TunnelRegistry, TunnelRegistryEntry, } from './lib/types.js';
|
|
8
|
+
export { createUsbmux, Services, Usbmux, TunnelManager, PacketStreamServer, PacketStreamClient, createLockdownServiceByUDID, startCoreDeviceProxy, TunnelRegistryServer, startTunnelRegistryServer, };
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,GAC1B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createLockdownServiceByUDID } from './lib/lockdown/index.js';
|
|
2
|
+
import { PacketStreamClient, PacketStreamServer, TunnelManager, } from './lib/tunnel/index.js';
|
|
3
|
+
import { TunnelRegistryServer, startTunnelRegistryServer, } from './lib/tunnel/tunnel-registry-server.js';
|
|
4
|
+
import { Usbmux, createUsbmux } from './lib/usbmux/index.js';
|
|
5
|
+
import * as Services from './services.js';
|
|
6
|
+
import { startCoreDeviceProxy } from './services/ios/tunnel-service/index.js';
|
|
7
|
+
export { createUsbmux, Services, Usbmux, TunnelManager, PacketStreamServer, PacketStreamClient, createLockdownServiceByUDID, startCoreDeviceProxy, TunnelRegistryServer, startTunnelRegistryServer, };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const DEFAULT_PAIRING_CONFIG: {
|
|
2
|
+
readonly timeout: 30000;
|
|
3
|
+
readonly discoveryTimeout: 5000;
|
|
4
|
+
readonly maxRetries: 3;
|
|
5
|
+
readonly pairingDirectory: ".pairing";
|
|
6
|
+
};
|
|
7
|
+
export declare const PairingDataComponentType: {
|
|
8
|
+
readonly METHOD: 0;
|
|
9
|
+
readonly IDENTIFIER: 1;
|
|
10
|
+
readonly SALT: 2;
|
|
11
|
+
readonly PUBLIC_KEY: 3;
|
|
12
|
+
readonly PROOF: 4;
|
|
13
|
+
readonly ENCRYPTED_DATA: 5;
|
|
14
|
+
readonly STATE: 6;
|
|
15
|
+
readonly ERROR: 7;
|
|
16
|
+
readonly RETRY_DELAY: 8;
|
|
17
|
+
readonly CERTIFICATE: 9;
|
|
18
|
+
readonly SIGNATURE: 10;
|
|
19
|
+
readonly PERMISSIONS: 11;
|
|
20
|
+
readonly FRAGMENT_DATA: 12;
|
|
21
|
+
readonly FRAGMENT_LAST: 13;
|
|
22
|
+
readonly SESSION_ID: 14;
|
|
23
|
+
readonly TTL: 15;
|
|
24
|
+
readonly EXTRA_DATA: 16;
|
|
25
|
+
readonly INFO: 17;
|
|
26
|
+
readonly ACL: 18;
|
|
27
|
+
readonly FLAGS: 19;
|
|
28
|
+
readonly VALIDATION_DATA: 20;
|
|
29
|
+
readonly MFI_AUTH_TOKEN: 21;
|
|
30
|
+
readonly MFI_PRODUCT_TYPE: 22;
|
|
31
|
+
readonly SERIAL_NUMBER: 23;
|
|
32
|
+
readonly MFI_AUTH_TOKEN_UUID: 24;
|
|
33
|
+
readonly APP_FLAGS: 25;
|
|
34
|
+
readonly OWNERSHIP_PROOF: 26;
|
|
35
|
+
readonly SETUP_CODE_TYPE: 27;
|
|
36
|
+
readonly PRODUCTION_DATA: 28;
|
|
37
|
+
readonly APP_INFO: 29;
|
|
38
|
+
readonly SEPARATOR: 255;
|
|
39
|
+
};
|
|
40
|
+
export declare const TLV8_MAX_FRAGMENT_SIZE = 255;
|
|
41
|
+
export declare const SRP_PRIME_3072: bigint;
|
|
42
|
+
export declare const SRP_GENERATOR: bigint;
|
|
43
|
+
export declare const SRP_HASH_ALGORITHM = "sha512";
|
|
44
|
+
export declare const SRP_USERNAME = "Pair-Setup";
|
|
45
|
+
export declare const SRP_KEY_LENGTH_BYTES = 384;
|
|
46
|
+
export declare const SRP_PRIVATE_KEY_BITS = 256;
|
|
47
|
+
export declare const HKDF_HASH_ALGORITHM = "sha512";
|
|
48
|
+
export declare const HKDF_HASH_LENGTH = 64;
|
|
49
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/apple-tv/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAGX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC3B,CAAC;AAGX,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAG1C,eAAO,MAAM,cAAc,QAc1B,CAAC;AAGF,eAAO,MAAM,aAAa,QAAY,CAAC;AAGvC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAG3C,eAAO,MAAM,YAAY,eAAe,CAAC;AAGzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAGxC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAGxC,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAG5C,eAAO,MAAM,gBAAgB,KAAK,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Default configuration values for Apple TV pairing behavior
|
|
2
|
+
export const DEFAULT_PAIRING_CONFIG = {
|
|
3
|
+
timeout: 30000,
|
|
4
|
+
discoveryTimeout: 5000,
|
|
5
|
+
maxRetries: 3,
|
|
6
|
+
pairingDirectory: '.pairing',
|
|
7
|
+
};
|
|
8
|
+
// TLV8 component type identifiers used in pairing data exchange
|
|
9
|
+
export const PairingDataComponentType = {
|
|
10
|
+
METHOD: 0x00,
|
|
11
|
+
IDENTIFIER: 0x01,
|
|
12
|
+
SALT: 0x02,
|
|
13
|
+
PUBLIC_KEY: 0x03,
|
|
14
|
+
PROOF: 0x04,
|
|
15
|
+
ENCRYPTED_DATA: 0x05,
|
|
16
|
+
STATE: 0x06,
|
|
17
|
+
ERROR: 0x07,
|
|
18
|
+
RETRY_DELAY: 0x08,
|
|
19
|
+
CERTIFICATE: 0x09,
|
|
20
|
+
SIGNATURE: 0x0a,
|
|
21
|
+
PERMISSIONS: 0x0b,
|
|
22
|
+
FRAGMENT_DATA: 0x0c,
|
|
23
|
+
FRAGMENT_LAST: 0x0d,
|
|
24
|
+
SESSION_ID: 0x0e,
|
|
25
|
+
TTL: 0x0f,
|
|
26
|
+
EXTRA_DATA: 0x10,
|
|
27
|
+
INFO: 0x11,
|
|
28
|
+
ACL: 0x12,
|
|
29
|
+
FLAGS: 0x13,
|
|
30
|
+
VALIDATION_DATA: 0x14,
|
|
31
|
+
MFI_AUTH_TOKEN: 0x15,
|
|
32
|
+
MFI_PRODUCT_TYPE: 0x16,
|
|
33
|
+
SERIAL_NUMBER: 0x17,
|
|
34
|
+
MFI_AUTH_TOKEN_UUID: 0x18,
|
|
35
|
+
APP_FLAGS: 0x19,
|
|
36
|
+
OWNERSHIP_PROOF: 0x1a,
|
|
37
|
+
SETUP_CODE_TYPE: 0x1b,
|
|
38
|
+
PRODUCTION_DATA: 0x1c,
|
|
39
|
+
APP_INFO: 0x1d,
|
|
40
|
+
SEPARATOR: 0xff,
|
|
41
|
+
};
|
|
42
|
+
// Maximum allowed size of a TLV8 fragment
|
|
43
|
+
export const TLV8_MAX_FRAGMENT_SIZE = 255;
|
|
44
|
+
// RFC 5054 3072-bit safe prime used for SRP key exchange
|
|
45
|
+
export const SRP_PRIME_3072 = BigInt('0x' +
|
|
46
|
+
'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' +
|
|
47
|
+
'020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' +
|
|
48
|
+
'4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' +
|
|
49
|
+
'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' +
|
|
50
|
+
'98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' +
|
|
51
|
+
'9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' +
|
|
52
|
+
'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' +
|
|
53
|
+
'3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33' +
|
|
54
|
+
'A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' +
|
|
55
|
+
'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864' +
|
|
56
|
+
'D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E2' +
|
|
57
|
+
'08E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF');
|
|
58
|
+
// Generator value (g=5) used in SRP key exchange
|
|
59
|
+
export const SRP_GENERATOR = BigInt(5);
|
|
60
|
+
// Hash algorithm used in SRP protocol (per HomeKit spec)
|
|
61
|
+
export const SRP_HASH_ALGORITHM = 'sha512';
|
|
62
|
+
// SRP username identifier used in Apple Pair-Setup
|
|
63
|
+
export const SRP_USERNAME = 'Pair-Setup';
|
|
64
|
+
// Key length in bytes for SRP (3072 bits = 384 bytes)
|
|
65
|
+
export const SRP_KEY_LENGTH_BYTES = 384;
|
|
66
|
+
// Number of bits for SRP private key (usually 256 bits)
|
|
67
|
+
export const SRP_PRIVATE_KEY_BITS = 256;
|
|
68
|
+
// Hash algorithm used for HKDF in pairing encryption
|
|
69
|
+
export const HKDF_HASH_ALGORITHM = 'sha512';
|
|
70
|
+
// Output length (in bytes) for HKDF key derivation
|
|
71
|
+
export const HKDF_HASH_LENGTH = 64;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class AppleTVError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class PairingError extends AppleTVError {
|
|
5
|
+
code?: string | undefined;
|
|
6
|
+
details?: any | undefined;
|
|
7
|
+
constructor(message: string, code?: string | undefined, details?: any | undefined);
|
|
8
|
+
}
|
|
9
|
+
export declare class NetworkError extends AppleTVError {
|
|
10
|
+
}
|
|
11
|
+
export declare class CryptographyError extends AppleTVError {
|
|
12
|
+
}
|
|
13
|
+
export declare class SRPError extends AppleTVError {
|
|
14
|
+
}
|
|
15
|
+
export declare class TLV8Error extends AppleTVError {
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/apple-tv/errors.ts"],"names":[],"mappings":"AACA,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAK5B;AAGD,qBAAa,YAAa,SAAQ,YAAY;IAGnC,IAAI,CAAC,EAAE,MAAM;IACb,OAAO,CAAC,EAAE,GAAG;gBAFpB,OAAO,EAAE,MAAM,EACR,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,OAAO,CAAC,EAAE,GAAG,YAAA;CAIvB;AAGD,qBAAa,YAAa,SAAQ,YAAY;CAAG;AAGjD,qBAAa,iBAAkB,SAAQ,YAAY;CAAG;AAGtD,qBAAa,QAAS,SAAQ,YAAY;CAAG;AAG7C,qBAAa,SAAU,SAAQ,YAAY;CAAG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Base error class for all Apple TV related errors
|
|
2
|
+
export class AppleTVError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = new.target.name;
|
|
6
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
// Represents an error that occurs during the pairing process
|
|
10
|
+
export class PairingError extends AppleTVError {
|
|
11
|
+
code;
|
|
12
|
+
details;
|
|
13
|
+
constructor(message, code, details) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.details = details;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Represents an error related to network communication
|
|
20
|
+
export class NetworkError extends AppleTVError {
|
|
21
|
+
}
|
|
22
|
+
// Represents an error occurring during cryptographic operations
|
|
23
|
+
export class CryptographyError extends AppleTVError {
|
|
24
|
+
}
|
|
25
|
+
// Represents an error specific to SRP (Secure Remote Password) protocol
|
|
26
|
+
export class SRPError extends AppleTVError {
|
|
27
|
+
}
|
|
28
|
+
// Represents an error related to TLV8 encoding/decoding
|
|
29
|
+
export class TLV8Error extends AppleTVError {
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PairingDataComponentTypeValue, TLV8Item } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decodes a TLV8-formatted buffer into an array of TLV8 items.
|
|
4
|
+
*
|
|
5
|
+
* @param buffer - A Node.js Buffer containing TLV8 encoded data
|
|
6
|
+
* @returns Array of TLV8Item objects with `type` and `data`
|
|
7
|
+
* @throws TLV8Error if the buffer does not contain valid TLV8 data
|
|
8
|
+
*/
|
|
9
|
+
export declare function decodeTLV8(buffer: Buffer): TLV8Item[];
|
|
10
|
+
/**
|
|
11
|
+
* Decodes a TLV8-formatted buffer into a dictionary mapping
|
|
12
|
+
* each TLV8 type to its corresponding data buffer. If the same
|
|
13
|
+
* type occurs more than once, their values are concatenated.
|
|
14
|
+
*
|
|
15
|
+
* @param buffer - A Node.js Buffer containing TLV8 encoded data
|
|
16
|
+
* @returns A dictionary of type-value mappings
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodeTLV8ToDict(buffer: Buffer): Partial<Record<PairingDataComponentTypeValue, Buffer>>;
|
|
19
|
+
//# sourceMappingURL=decoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/tlv/decoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CA4BrD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC,CAiBxD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TLV8Error } from '../errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decodes a TLV8-formatted buffer into an array of TLV8 items.
|
|
4
|
+
*
|
|
5
|
+
* @param buffer - A Node.js Buffer containing TLV8 encoded data
|
|
6
|
+
* @returns Array of TLV8Item objects with `type` and `data`
|
|
7
|
+
* @throws TLV8Error if the buffer does not contain valid TLV8 data
|
|
8
|
+
*/
|
|
9
|
+
export function decodeTLV8(buffer) {
|
|
10
|
+
const items = [];
|
|
11
|
+
let offset = 0;
|
|
12
|
+
while (offset < buffer.length) {
|
|
13
|
+
if (offset + 2 > buffer.length) {
|
|
14
|
+
throw new TLV8Error(`Invalid TLV8: insufficient data for type and length at offset ${offset}`);
|
|
15
|
+
}
|
|
16
|
+
const type = buffer[offset];
|
|
17
|
+
const length = buffer[offset + 1];
|
|
18
|
+
offset += 2;
|
|
19
|
+
if (offset + length > buffer.length) {
|
|
20
|
+
throw new TLV8Error(`Invalid TLV8: insufficient data for value at offset ${offset}`);
|
|
21
|
+
}
|
|
22
|
+
const data = buffer.subarray(offset, offset + length);
|
|
23
|
+
offset += length;
|
|
24
|
+
items.push({ type, data });
|
|
25
|
+
}
|
|
26
|
+
return items;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Decodes a TLV8-formatted buffer into a dictionary mapping
|
|
30
|
+
* each TLV8 type to its corresponding data buffer. If the same
|
|
31
|
+
* type occurs more than once, their values are concatenated.
|
|
32
|
+
*
|
|
33
|
+
* @param buffer - A Node.js Buffer containing TLV8 encoded data
|
|
34
|
+
* @returns A dictionary of type-value mappings
|
|
35
|
+
*/
|
|
36
|
+
export function decodeTLV8ToDict(buffer) {
|
|
37
|
+
const items = decodeTLV8(buffer);
|
|
38
|
+
const result = {};
|
|
39
|
+
for (const { type, data } of items) {
|
|
40
|
+
if (!result[type]) {
|
|
41
|
+
result[type] = [];
|
|
42
|
+
}
|
|
43
|
+
result[type].push(data);
|
|
44
|
+
}
|
|
45
|
+
return Object.fromEntries(Object.entries(result).map(([type, buffers]) => [
|
|
46
|
+
type,
|
|
47
|
+
Buffer.concat(buffers),
|
|
48
|
+
]));
|
|
49
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TLV8Item } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Encodes an array of TLV8 items into a single TLV8-compliant buffer.
|
|
4
|
+
* If a data value exceeds TLV8_MAX_FRAGMENT_SIZE, it will be split across multiple entries.
|
|
5
|
+
*
|
|
6
|
+
* @param items - Array of TLV8 items to encode
|
|
7
|
+
* @returns A Buffer containing the encoded TLV8 data
|
|
8
|
+
*/
|
|
9
|
+
export declare function encodeTLV8(items: TLV8Item[]): Buffer;
|
|
10
|
+
//# sourceMappingURL=encoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/tlv/encoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAsBpD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TLV8_MAX_FRAGMENT_SIZE } from '../constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Encodes an array of TLV8 items into a single TLV8-compliant buffer.
|
|
4
|
+
* If a data value exceeds TLV8_MAX_FRAGMENT_SIZE, it will be split across multiple entries.
|
|
5
|
+
*
|
|
6
|
+
* @param items - Array of TLV8 items to encode
|
|
7
|
+
* @returns A Buffer containing the encoded TLV8 data
|
|
8
|
+
*/
|
|
9
|
+
export function encodeTLV8(items) {
|
|
10
|
+
const chunks = [];
|
|
11
|
+
for (const { type, data } of items) {
|
|
12
|
+
let offset = 0;
|
|
13
|
+
while (offset < data.length) {
|
|
14
|
+
const fragmentLength = Math.min(TLV8_MAX_FRAGMENT_SIZE, data.length - offset);
|
|
15
|
+
chunks.push(Buffer.from([type, fragmentLength]), data.subarray(offset, offset + fragmentLength));
|
|
16
|
+
offset += fragmentLength;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return Buffer.concat(chunks);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/tlv/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates TLV8-encoded setup data for manual pairing, with default METHOD and STATE.
|
|
3
|
+
*
|
|
4
|
+
* @returns Base64-encoded TLV8 string for manual pairing
|
|
5
|
+
*/
|
|
6
|
+
export declare function createSetupManualPairingData(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Creates TLV8-encoded data for pair verification, including the X25519 public key.
|
|
9
|
+
*
|
|
10
|
+
* @param x25519PublicKey - A buffer containing the X25519 public key
|
|
11
|
+
* @returns Base64-encoded TLV8 string for verification
|
|
12
|
+
*/
|
|
13
|
+
export declare function createPairVerificationData(x25519PublicKey: Buffer): string;
|
|
14
|
+
//# sourceMappingURL=pairing-tlv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairing-tlv.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/tlv/pairing-tlv.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAOrD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAO1E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PairingDataComponentType } from '../constants.js';
|
|
2
|
+
import { encodeTLV8 } from './encoder.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates TLV8-encoded setup data for manual pairing, with default METHOD and STATE.
|
|
5
|
+
*
|
|
6
|
+
* @returns Base64-encoded TLV8 string for manual pairing
|
|
7
|
+
*/
|
|
8
|
+
export function createSetupManualPairingData() {
|
|
9
|
+
const tlv = encodeTLV8([
|
|
10
|
+
{ type: PairingDataComponentType.METHOD, data: Buffer.from([0x00]) },
|
|
11
|
+
{ type: PairingDataComponentType.STATE, data: Buffer.from([0x01]) },
|
|
12
|
+
]);
|
|
13
|
+
return tlv.toString('base64');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates TLV8-encoded data for pair verification, including the X25519 public key.
|
|
17
|
+
*
|
|
18
|
+
* @param x25519PublicKey - A buffer containing the X25519 public key
|
|
19
|
+
* @returns Base64-encoded TLV8 string for verification
|
|
20
|
+
*/
|
|
21
|
+
export function createPairVerificationData(x25519PublicKey) {
|
|
22
|
+
const tlv = encodeTLV8([
|
|
23
|
+
{ type: PairingDataComponentType.STATE, data: Buffer.from([0x01]) },
|
|
24
|
+
{ type: PairingDataComponentType.PUBLIC_KEY, data: x25519PublicKey },
|
|
25
|
+
]);
|
|
26
|
+
return tlv.toString('base64');
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface AppleTVDeviceInfo {
|
|
2
|
+
altIRK: Buffer;
|
|
3
|
+
btAddr: string;
|
|
4
|
+
mac: Buffer;
|
|
5
|
+
remotePairingSerialNumber: string;
|
|
6
|
+
accountID: string;
|
|
7
|
+
model: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PairingKeys {
|
|
11
|
+
publicKey: Buffer;
|
|
12
|
+
privateKey: Buffer;
|
|
13
|
+
}
|
|
14
|
+
export interface PairingResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
pairingFile?: string;
|
|
17
|
+
deviceId: string;
|
|
18
|
+
error?: Error;
|
|
19
|
+
}
|
|
20
|
+
export interface PairingConfig {
|
|
21
|
+
timeout: number;
|
|
22
|
+
discoveryTimeout: number;
|
|
23
|
+
maxRetries: number;
|
|
24
|
+
pairingDirectory: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TLV8Item {
|
|
27
|
+
type: PairingDataComponentTypeValue;
|
|
28
|
+
data: Buffer;
|
|
29
|
+
}
|
|
30
|
+
export type PairingDataComponentTypeValue = number;
|
|
31
|
+
export type Opack2Value = null | undefined | boolean | number | string | Buffer | Opack2Array | Opack2Dictionary;
|
|
32
|
+
export interface Opack2Array extends Array<Opack2Value> {
|
|
33
|
+
}
|
|
34
|
+
export interface Opack2Dictionary extends Record<string, Opack2Value> {
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/apple-tv/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAGD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,6BAA6B,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAGnD,MAAM,MAAM,WAAW,GACnB,IAAI,GACJ,SAAS,GACT,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN,WAAW,GACX,gBAAgB,CAAC;AAGrB,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,WAAW,CAAC;CAAG;AAG1D,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|