appium-ios-remotexpc 0.12.0 → 0.13.0
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 +6 -0
- package/build/src/constants.d.ts +2 -0
- package/build/src/constants.d.ts.map +1 -0
- package/build/src/constants.js +3 -0
- package/build/src/index.d.ts +2 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -1
- package/build/src/lib/apple-tv/constants.d.ts +0 -1
- package/build/src/lib/apple-tv/constants.d.ts.map +1 -1
- package/build/src/lib/apple-tv/constants.js +0 -1
- package/build/src/lib/apple-tv/discovery/device-discovery.d.ts +10 -0
- package/build/src/lib/apple-tv/discovery/device-discovery.d.ts.map +1 -0
- package/build/src/lib/apple-tv/discovery/device-discovery.js +22 -0
- package/build/src/lib/apple-tv/discovery/index.d.ts +2 -0
- package/build/src/lib/apple-tv/discovery/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/discovery/index.js +1 -0
- package/build/src/lib/apple-tv/index.d.ts +5 -0
- package/build/src/lib/apple-tv/index.d.ts.map +1 -1
- package/build/src/lib/apple-tv/index.js +5 -0
- package/build/src/lib/apple-tv/network/constants.d.ts +10 -0
- package/build/src/lib/apple-tv/network/constants.d.ts.map +1 -0
- package/build/src/lib/apple-tv/network/constants.js +9 -0
- package/build/src/lib/apple-tv/network/index.d.ts +4 -0
- package/build/src/lib/apple-tv/network/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/network/index.js +2 -0
- package/build/src/lib/apple-tv/network/network-client.d.ts +16 -0
- package/build/src/lib/apple-tv/network/network-client.d.ts.map +1 -0
- package/build/src/lib/apple-tv/network/network-client.js +169 -0
- package/build/src/lib/apple-tv/network/types.d.ts +8 -0
- package/build/src/lib/apple-tv/network/types.d.ts.map +1 -0
- package/build/src/lib/apple-tv/network/types.js +1 -0
- package/build/src/lib/apple-tv/pairing/index.d.ts +3 -0
- package/build/src/lib/apple-tv/pairing/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing/index.js +2 -0
- package/build/src/lib/apple-tv/pairing/pairing-service.d.ts +15 -0
- package/build/src/lib/apple-tv/pairing/pairing-service.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing/pairing-service.js +112 -0
- package/build/src/lib/apple-tv/pairing/user-input-service.d.ts +8 -0
- package/build/src/lib/apple-tv/pairing/user-input-service.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing/user-input-service.js +61 -0
- package/build/src/lib/apple-tv/pairing-protocol/constants.d.ts +18 -0
- package/build/src/lib/apple-tv/pairing-protocol/constants.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing-protocol/constants.js +17 -0
- package/build/src/lib/apple-tv/pairing-protocol/index.d.ts +4 -0
- package/build/src/lib/apple-tv/pairing-protocol/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing-protocol/index.js +2 -0
- package/build/src/lib/apple-tv/pairing-protocol/pairing-protocol.d.ts +159 -0
- package/build/src/lib/apple-tv/pairing-protocol/pairing-protocol.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing-protocol/pairing-protocol.js +494 -0
- package/build/src/lib/apple-tv/pairing-protocol/types.d.ts +57 -0
- package/build/src/lib/apple-tv/pairing-protocol/types.d.ts.map +1 -0
- package/build/src/lib/apple-tv/pairing-protocol/types.js +1 -0
- package/build/src/lib/apple-tv/storage/index.d.ts +3 -0
- package/build/src/lib/apple-tv/storage/index.d.ts.map +1 -0
- package/build/src/lib/apple-tv/storage/index.js +1 -0
- package/build/src/lib/apple-tv/storage/pairing-storage.d.ts +12 -0
- package/build/src/lib/apple-tv/storage/pairing-storage.d.ts.map +1 -0
- package/build/src/lib/apple-tv/storage/pairing-storage.js +36 -0
- package/build/src/lib/apple-tv/storage/types.d.ts +5 -0
- package/build/src/lib/apple-tv/storage/types.d.ts.map +1 -0
- package/build/src/lib/apple-tv/storage/types.js +1 -0
- package/build/src/lib/apple-tv/types.d.ts +0 -1
- package/build/src/lib/apple-tv/types.d.ts.map +1 -1
- package/build/src/lib/bonjour/bonjour-discovery.d.ts.map +1 -1
- package/build/src/lib/bonjour/bonjour-discovery.js +2 -0
- package/package.json +4 -2
- package/scripts/pair-appletv.ts +79 -0
- package/scripts/test-tunnel-creation.ts +1 -1
- package/src/constants.ts +4 -0
- package/src/index.ts +2 -0
- package/src/lib/apple-tv/constants.ts +0 -1
- package/src/lib/apple-tv/discovery/device-discovery.ts +34 -0
- package/src/lib/apple-tv/discovery/index.ts +1 -0
- package/src/lib/apple-tv/index.ts +5 -0
- package/src/lib/apple-tv/network/constants.ts +9 -0
- package/src/lib/apple-tv/network/index.ts +3 -0
- package/src/lib/apple-tv/network/network-client.ts +214 -0
- package/src/lib/apple-tv/network/types.ts +7 -0
- package/src/lib/apple-tv/pairing/index.ts +2 -0
- package/src/lib/apple-tv/pairing/pairing-service.ts +175 -0
- package/src/lib/apple-tv/pairing/user-input-service.ts +71 -0
- package/src/lib/apple-tv/pairing-protocol/constants.ts +19 -0
- package/src/lib/apple-tv/pairing-protocol/index.ts +8 -0
- package/src/lib/apple-tv/pairing-protocol/pairing-protocol.ts +636 -0
- package/src/lib/apple-tv/pairing-protocol/types.ts +60 -0
- package/src/lib/apple-tv/storage/index.ts +2 -0
- package/src/lib/apple-tv/storage/pairing-storage.ts +60 -0
- package/src/lib/apple-tv/storage/types.ts +9 -0
- package/src/lib/apple-tv/types.ts +0 -1
- package/src/lib/bonjour/bonjour-discovery.ts +2 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Constants for pairing protocol states */
|
|
2
|
+
export declare const PAIRING_STATES: {
|
|
3
|
+
readonly M3: 3;
|
|
4
|
+
readonly M5: 5;
|
|
5
|
+
readonly M6: 6;
|
|
6
|
+
};
|
|
7
|
+
/** Constants for pairing protocol messages */
|
|
8
|
+
export declare const PAIRING_MESSAGES: {
|
|
9
|
+
readonly ENCRYPT_SALT: "Pair-Setup-Encrypt-Salt";
|
|
10
|
+
readonly ENCRYPT_INFO: "Pair-Setup-Encrypt-Info";
|
|
11
|
+
readonly SIGN_SALT: "Pair-Setup-Controller-Sign-Salt";
|
|
12
|
+
readonly SIGN_INFO: "Pair-Setup-Controller-Sign-Info";
|
|
13
|
+
readonly M5_NONCE: "PS-Msg05";
|
|
14
|
+
readonly M6_NONCE: "PS-Msg06";
|
|
15
|
+
};
|
|
16
|
+
/** TLV type for device info */
|
|
17
|
+
export declare const INFO_TYPE = 17;
|
|
18
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/pairing-protocol/constants.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAEX,+BAA+B;AAC/B,eAAO,MAAM,SAAS,KAAO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Constants for pairing protocol states */
|
|
2
|
+
export const PAIRING_STATES = {
|
|
3
|
+
M3: 0x03,
|
|
4
|
+
M5: 0x05,
|
|
5
|
+
M6: 0x06,
|
|
6
|
+
};
|
|
7
|
+
/** Constants for pairing protocol messages */
|
|
8
|
+
export const PAIRING_MESSAGES = {
|
|
9
|
+
ENCRYPT_SALT: 'Pair-Setup-Encrypt-Salt',
|
|
10
|
+
ENCRYPT_INFO: 'Pair-Setup-Encrypt-Info',
|
|
11
|
+
SIGN_SALT: 'Pair-Setup-Controller-Sign-Salt',
|
|
12
|
+
SIGN_INFO: 'Pair-Setup-Controller-Sign-Info',
|
|
13
|
+
M5_NONCE: 'PS-Msg05',
|
|
14
|
+
M6_NONCE: 'PS-Msg06',
|
|
15
|
+
};
|
|
16
|
+
/** TLV type for device info */
|
|
17
|
+
export const INFO_TYPE = 0x11;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { PairingProtocol } from './pairing-protocol.js';
|
|
2
|
+
export { PAIRING_STATES, PAIRING_MESSAGES, INFO_TYPE } from './constants.js';
|
|
3
|
+
export type { EncryptionKeys, PairingRequest, UserInputInterface, PairingProtocolInterface, } from './types.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/pairing-protocol/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7E,YAAY,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { AppleTVDevice } from '../../bonjour/bonjour-discovery.js';
|
|
2
|
+
import type { NetworkClientInterface } from '../network/types.js';
|
|
3
|
+
import type { PairingProtocolInterface, UserInputInterface } from './types.js';
|
|
4
|
+
/** Implements the Apple TV pairing protocol including SRP authentication and key exchange */
|
|
5
|
+
export declare class PairingProtocol implements PairingProtocolInterface {
|
|
6
|
+
private readonly networkClient;
|
|
7
|
+
private readonly userInput;
|
|
8
|
+
private static readonly log;
|
|
9
|
+
private _sequenceNumber;
|
|
10
|
+
constructor(networkClient: NetworkClientInterface, userInput: UserInputInterface);
|
|
11
|
+
executePairingFlow(device: AppleTVDevice): Promise<string>;
|
|
12
|
+
private createRequest;
|
|
13
|
+
/**
|
|
14
|
+
* Fragments a buffer into TLV8 items of maximum fragment size
|
|
15
|
+
* @param buffer Buffer to fragment
|
|
16
|
+
* @param type TLV8 type identifier
|
|
17
|
+
* @returns Array of TLV8 items
|
|
18
|
+
*/
|
|
19
|
+
private fragmentBuffer;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a nonce buffer with prefix padding
|
|
22
|
+
* @param nonceString The nonce string identifier
|
|
23
|
+
* @returns Padded nonce buffer
|
|
24
|
+
*/
|
|
25
|
+
private createNonce;
|
|
26
|
+
/**
|
|
27
|
+
* Performs initial handshake with Apple TV to establish connection
|
|
28
|
+
* Sends handshake request with host options and wire protocol version
|
|
29
|
+
*/
|
|
30
|
+
private performHandshake;
|
|
31
|
+
/**
|
|
32
|
+
* Attempts to verify existing pairing credentials with Apple TV
|
|
33
|
+
* Creates pair verification request and handles expected failure for new pairing flow
|
|
34
|
+
*/
|
|
35
|
+
private attemptPairVerification;
|
|
36
|
+
/**
|
|
37
|
+
* Initiates manual pairing setup process with Apple TV
|
|
38
|
+
* Sends setup request and receives SRP challenge data
|
|
39
|
+
* @returns Response containing SRP salt and server public key
|
|
40
|
+
*/
|
|
41
|
+
private setupManualPairing;
|
|
42
|
+
/**
|
|
43
|
+
* Extracts and validates SRP pairing data from Apple TV response
|
|
44
|
+
* @param response Network response containing pairing data
|
|
45
|
+
* @returns Parsed TLV8 dictionary with SRP challenge components
|
|
46
|
+
* @throws PairingError if pairing data is missing or invalid
|
|
47
|
+
*/
|
|
48
|
+
private extractAndValidatePairingData;
|
|
49
|
+
/**
|
|
50
|
+
* Performs SRP authentication using user-provided PIN
|
|
51
|
+
* Prompts for PIN, creates SRP client, sends proof, and validates response
|
|
52
|
+
* @param parsedSRP SRP challenge data from Apple TV
|
|
53
|
+
* @returns Authenticated SRP client with session key
|
|
54
|
+
* @throws PairingError if PIN is incorrect or authentication fails
|
|
55
|
+
*/
|
|
56
|
+
private performSRPAuthentication;
|
|
57
|
+
/**
|
|
58
|
+
* Receives and processes M6 pairing completion message from Apple TV
|
|
59
|
+
* Attempts to decrypt and validate final pairing state
|
|
60
|
+
* @param decryptKey Decryption key for M6 encrypted data
|
|
61
|
+
*/
|
|
62
|
+
private receiveM6Completion;
|
|
63
|
+
/**
|
|
64
|
+
* Constructs initial handshake request packet
|
|
65
|
+
* Includes host options and wire protocol version for pairing session
|
|
66
|
+
* @returns Handshake request with sequence number 0
|
|
67
|
+
*/
|
|
68
|
+
private createHandshakeRequest;
|
|
69
|
+
/**
|
|
70
|
+
* Creates pair verification request with X25519 public key
|
|
71
|
+
* Used to attempt verification of existing pairing credentials
|
|
72
|
+
* @returns Pair verification request with random X25519 key
|
|
73
|
+
*/
|
|
74
|
+
private createPairVerificationRequest;
|
|
75
|
+
/**
|
|
76
|
+
* Creates pair verification failed event request
|
|
77
|
+
* Sent after verification attempt to proceed with manual pairing setup
|
|
78
|
+
* @returns Pair verify failed event packet
|
|
79
|
+
*/
|
|
80
|
+
private createPairVerifyFailedRequest;
|
|
81
|
+
/**
|
|
82
|
+
* Constructs manual pairing setup request packet
|
|
83
|
+
* Initiates M1/M2 exchange with setup pairing data
|
|
84
|
+
* @returns Setup manual pairing request with host information
|
|
85
|
+
*/
|
|
86
|
+
private createSetupManualPairingRequest;
|
|
87
|
+
/**
|
|
88
|
+
* Parses base64-encoded TLV8 response into dictionary
|
|
89
|
+
* Decodes base64 string and converts TLV8 format to key-value pairs
|
|
90
|
+
* @param data Base64-encoded TLV8 data
|
|
91
|
+
* @returns Dictionary mapping TLV8 type numbers to buffer values
|
|
92
|
+
* @throws PairingError if TLV8 parsing fails
|
|
93
|
+
*/
|
|
94
|
+
private parseTLV8Response;
|
|
95
|
+
/**
|
|
96
|
+
* Validates SRP response for errors and required challenge data
|
|
97
|
+
* Checks for error codes and verifies presence of salt and public key
|
|
98
|
+
* @param parsedSRP Parsed SRP response dictionary
|
|
99
|
+
* @throws PairingError if response contains errors or missing required data
|
|
100
|
+
*/
|
|
101
|
+
private validateSRPResponse;
|
|
102
|
+
/**
|
|
103
|
+
* Initializes SRP client with PIN and server challenge data
|
|
104
|
+
* Sets up identity, salt, and server public key for proof computation
|
|
105
|
+
* @param pin User-provided pairing PIN
|
|
106
|
+
* @param parsedSRP SRP challenge data containing salt and server public key
|
|
107
|
+
* @returns Configured SRP client ready for proof generation
|
|
108
|
+
* @throws PairingError if required SRP data is missing
|
|
109
|
+
*/
|
|
110
|
+
private createSRPClient;
|
|
111
|
+
/**
|
|
112
|
+
* Sends M3 message containing SRP proof to Apple TV
|
|
113
|
+
* Includes client public key and computed proof for authentication
|
|
114
|
+
* @param srpClient Configured SRP client with computed proof
|
|
115
|
+
*/
|
|
116
|
+
private sendSRPProof;
|
|
117
|
+
/**
|
|
118
|
+
* Validates M4 SRP proof response from Apple TV
|
|
119
|
+
* Checks for authentication errors indicating incorrect PIN
|
|
120
|
+
* @param response Network response containing SRP proof validation result
|
|
121
|
+
* @throws PairingError if PIN authentication failed
|
|
122
|
+
*/
|
|
123
|
+
private validateSRPProofResponse;
|
|
124
|
+
/**
|
|
125
|
+
* Sends M5 exchange message with encrypted pairing credentials
|
|
126
|
+
* Includes long-term public key, signature, and device information encrypted with session key
|
|
127
|
+
* @param encryptKey Encryption key derived from session key
|
|
128
|
+
* @param devicePairingID Host device pairing identifier
|
|
129
|
+
* @param ltpk Long-term public key (Ed25519)
|
|
130
|
+
* @param ltsk Long-term secret key (Ed25519)
|
|
131
|
+
* @param sessionKey SRP session key for signature derivation
|
|
132
|
+
* @throws PairingError if M5 message creation fails
|
|
133
|
+
*/
|
|
134
|
+
private sendM5Message;
|
|
135
|
+
/**
|
|
136
|
+
* Processes and decrypts M6 completion response from Apple TV
|
|
137
|
+
* Validates pairing completion state and decrypts final exchange data
|
|
138
|
+
* @param m6Response Network response containing M6 completion message
|
|
139
|
+
* @param decryptKey Decryption key for M6 encrypted data
|
|
140
|
+
*/
|
|
141
|
+
private processM6Response;
|
|
142
|
+
/**
|
|
143
|
+
* Derives encryption and decryption keys from SRP session key
|
|
144
|
+
* Uses HKDF with pairing-specific salt and info strings
|
|
145
|
+
* @param sessionKey SRP session key from authentication
|
|
146
|
+
* @returns Encryption keys for M5/M6 message exchange
|
|
147
|
+
*/
|
|
148
|
+
private deriveEncryptionKeys;
|
|
149
|
+
/**
|
|
150
|
+
* Saves pairing credentials to storage and returns credential path
|
|
151
|
+
* Persists long-term public and private keys for future connections
|
|
152
|
+
* @param device Apple TV device information
|
|
153
|
+
* @param ltpk Long-term public key to save
|
|
154
|
+
* @param ltsk Long-term secret key to save
|
|
155
|
+
* @returns Path to saved pairing credentials file
|
|
156
|
+
*/
|
|
157
|
+
private createPairingResult;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=pairing-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairing-protocol.d.ts","sourceRoot":"","sources":["../../../../../src/lib/apple-tv/pairing-protocol/pairing-protocol.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAexE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAYlE,OAAO,KAAK,EAEV,wBAAwB,EAExB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,6FAA6F;AAC7F,qBAAa,eAAgB,YAAW,wBAAwB;IAK5D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAL5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAuC;IAClE,OAAO,CAAC,eAAe,CAAK;gBAGT,aAAa,EAAE,sBAAsB,EACrC,SAAS,EAAE,kBAAkB;IAG1C,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAwChE,OAAO,CAAC,aAAa;IAYrB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAetB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAInB;;;OAGG;YACW,gBAAgB;IAO9B;;;OAGG;YACW,uBAAuB;IAUrC;;;;OAIG;YACW,kBAAkB;IAQhC;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAYrC;;;;;;OAMG;YACW,wBAAwB;IActC;;;;OAIG;YACW,mBAAmB;IAcjC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAuB9B;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IAmBrC;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IAUrC;;;;OAIG;IACH,OAAO,CAAC,+BAA+B;IAmBvC;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAqBzB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAyB3B;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;;OAIG;YACW,YAAY;IAmC1B;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAiBhC;;;;;;;;;OASG;YACW,aAAa;IA2E3B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAsCzB;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;;;;;;OAOG;YACW,mBAAmB;CAQlC"}
|