@basmilius/apple-companion-link 0.0.65 → 0.0.67
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/dist/api.d.ts +28 -0
- package/dist/const.d.ts +38 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +10 -7
- package/dist/messages.d.ts +26 -0
- package/dist/{protocol/pairing.d.ts → pairing.d.ts} +4 -4
- package/dist/{protocol/socket.d.ts → socket.d.ts} +0 -25
- package/dist/utils.d.ts +2 -0
- package/dist/{protocol/verify.d.ts → verify.d.ts} +4 -4
- package/package.json +2 -2
- package/dist/protocol/api.d.ts +0 -72
- package/dist/protocol/index.d.ts +0 -4
- /package/dist/{protocol/protocol.d.ts → protocol.d.ts} +0 -0
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type HidCommandKey, type MediaControlCommandKey } from "./const";
|
|
2
|
+
import type { AttentionState, ButtonPressType, LaunchableApp, UserAccount } from "./types";
|
|
3
|
+
import type Protocol from "./protocol";
|
|
4
|
+
import type Socket from "./socket";
|
|
5
|
+
export default class CompanionLinkApi {
|
|
6
|
+
#private;
|
|
7
|
+
get socket(): Socket;
|
|
8
|
+
constructor(protocol: Protocol);
|
|
9
|
+
fetchMediaControlStatus(): Promise<void>;
|
|
10
|
+
fetchNowPlayingInfo(): Promise<void>;
|
|
11
|
+
fetchSupportedActions(): Promise<void>;
|
|
12
|
+
getAttentionState(): Promise<AttentionState>;
|
|
13
|
+
getLaunchableApps(): Promise<LaunchableApp[]>;
|
|
14
|
+
getSiriRemoteInfo(): Promise<any>;
|
|
15
|
+
getUserAccounts(): Promise<UserAccount[]>;
|
|
16
|
+
hidCommand(command: HidCommandKey, down?: boolean): Promise<void>;
|
|
17
|
+
launchApp(bundleId: string): Promise<void>;
|
|
18
|
+
launchUrl(url: string): Promise<void>;
|
|
19
|
+
mediaControlCommand(command: MediaControlCommandKey, content?: object): Promise<object>;
|
|
20
|
+
pressButton(command: HidCommandKey, type?: ButtonPressType, holdDelayMs?: number): Promise<void>;
|
|
21
|
+
switchUserAccount(accountId: string): Promise<void>;
|
|
22
|
+
_subscribe(event: string, fn: (data: unknown) => void): Promise<void>;
|
|
23
|
+
_unsubscribe(event: string, fn?: (data: unknown) => void): Promise<void>;
|
|
24
|
+
_sessionStart(): Promise<object>;
|
|
25
|
+
_systemInfo(pairingId: Buffer): Promise<object>;
|
|
26
|
+
_touchStart(): Promise<object>;
|
|
27
|
+
_tvrcSessionStart(): Promise<object>;
|
|
28
|
+
}
|
package/dist/const.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const HidCommand: {
|
|
2
|
+
readonly Up: 1;
|
|
3
|
+
readonly Down: 2;
|
|
4
|
+
readonly Left: 3;
|
|
5
|
+
readonly Right: 4;
|
|
6
|
+
readonly Menu: 5;
|
|
7
|
+
readonly Select: 6;
|
|
8
|
+
readonly Home: 7;
|
|
9
|
+
readonly VolumeUp: 8;
|
|
10
|
+
readonly VolumeDown: 9;
|
|
11
|
+
readonly Siri: 10;
|
|
12
|
+
readonly Screensaver: 11;
|
|
13
|
+
readonly Sleep: 12;
|
|
14
|
+
readonly Wake: 13;
|
|
15
|
+
readonly PlayPause: 14;
|
|
16
|
+
readonly ChannelIncrement: 15;
|
|
17
|
+
readonly ChannelDecrement: 16;
|
|
18
|
+
readonly Guide: 17;
|
|
19
|
+
readonly PageUp: 18;
|
|
20
|
+
readonly PageDown: 19;
|
|
21
|
+
};
|
|
22
|
+
export declare const MediaControlCommand: {
|
|
23
|
+
readonly Play: 1;
|
|
24
|
+
readonly Pause: 2;
|
|
25
|
+
readonly NextTrack: 3;
|
|
26
|
+
readonly PreviousTrack: 4;
|
|
27
|
+
readonly GetVolume: 5;
|
|
28
|
+
readonly SetVolume: 6;
|
|
29
|
+
readonly SkipBy: 7;
|
|
30
|
+
readonly FastForwardBegin: 8;
|
|
31
|
+
readonly FastForwardEnd: 9;
|
|
32
|
+
readonly RewindBegin: 10;
|
|
33
|
+
readonly RewindEnd: 11;
|
|
34
|
+
readonly GetCaptionSettings: 12;
|
|
35
|
+
readonly SetCaptionSettings: 13;
|
|
36
|
+
};
|
|
37
|
+
export type HidCommandKey = keyof typeof HidCommand;
|
|
38
|
+
export type MediaControlCommandKey = keyof typeof MediaControlCommand;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export {
|
|
1
|
+
export type { default as CompanionLinkApi } from "./api";
|
|
2
|
+
export type { default as CompanionLinkPairing } from "./pairing";
|
|
3
|
+
export type { default as CompanionLinkVerify } from "./verify";
|
|
4
|
+
export type { HidCommandKey, MediaControlCommandKey } from "./const";
|
|
5
|
+
export type { AttentionState, ButtonPressType, LaunchableApp, UserAccount } from "./types";
|
|
6
|
+
export { HidCommand, MediaControlCommand } from "./const";
|
|
7
|
+
export { convertAttentionState } from "./utils";
|
|
8
|
+
export { default as CompanionLink } from "./protocol";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var f={Up:1,Down:2,Left:3,Right:4,Menu:5,Select:6,Home:7,VolumeUp:8,VolumeDown:9,Siri:10,Screensaver:11,Sleep:12,Wake:13,PlayPause:14,ChannelIncrement:15,ChannelDecrement:16,Guide:17,PageUp:18,PageDown:19},C={Play:1,Pause:2,NextTrack:3,PreviousTrack:4,GetVolume:5,SetVolume:6,SkipBy:7,FastForwardBegin:8,FastForwardEnd:9,RewindBegin:10,RewindEnd:11,GetCaptionSettings:12,SetCaptionSettings:13};function A(t){switch(t){case 1:return"asleep";case 2:return"screensaver";case 3:return"awake";case 4:return"idle";default:return"unknown"}}import{randomInt as v}from"node:crypto";import{opackFloat as x,parseBinaryPlist as E,reporter as K,waitFor as F}from"@basmilius/apple-common";var o={Unknown:0,Noop:1,PS_Start:3,PS_Next:4,PV_Start:5,PV_Next:6,U_OPACK:7,E_OPACK:8,P_OPACK:9,PA_Request:10,PA_Response:11,SessionStartRequest:16,SessionStartResponse:17,SessionData:18,FamilyIdentityRequest:32,FamilyIdentityResponse:33,FamilyIdentityUpdate:34},n={Event:1,Request:2,Response:3},g=[o.PS_Start,o.PS_Next,o.PV_Start,o.PV_Next,o.U_OPACK,o.E_OPACK,o.P_OPACK],k=[o.PS_Start,o.PS_Next,o.PV_Start,o.PV_Next];class h{get socket(){return this.#t.socket}#t;constructor(t){this.#t=t}async fetchMediaControlStatus(){await this.socket.exchange(o.E_OPACK,{_i:"FetchMediaControlStatus",_t:n.Request,_c:{}})}async fetchNowPlayingInfo(){await this.socket.exchange(o.E_OPACK,{_i:"FetchCurrentNowPlayingInfoEvent",_t:n.Request,_c:{}})}async fetchSupportedActions(){await this.socket.exchange(o.E_OPACK,{_i:"FetchSupportedActionsEvent",_t:n.Request,_c:{}})}async getAttentionState(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"FetchAttentionState",_t:n.Request,_c:{}}),{_c:e}=_(t);return A(e.state)}async getLaunchableApps(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"FetchLaunchableApplicationsEvent",_t:n.Request,_c:{}}),{_c:e}=_(t);return Object.entries(e).map(([i,s])=>({bundleId:i,name:s}))}async getSiriRemoteInfo(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"FetchSiriRemoteInfo",_t:n.Request,_c:{}});return E(Buffer.from(t._c.SiriRemoteInfoKey).buffer)}async getUserAccounts(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"FetchUserAccountsEvent",_t:n.Request,_c:{}}),{_c:e}=_(t);return Object.entries(e).map(([i,s])=>({accountId:i,name:s}))}async hidCommand(t,e=!1){await this.socket.exchange(o.E_OPACK,{_i:"_hidC",_t:n.Request,_c:{_hBtS:e?1:2,_hidC:f[t]}})}async launchApp(t){await this.socket.exchange(o.E_OPACK,{_i:"_launchApp",_t:n.Request,_c:{_bundleID:t}})}async launchUrl(t){await this.socket.exchange(o.E_OPACK,{_i:"_launchApp",_t:n.Request,_c:{_urlS:t}})}async mediaControlCommand(t,e){let[,i]=await this.socket.exchange(o.E_OPACK,{_i:"_mcc",_t:n.Request,_c:{_mcc:C[t],...e||{}}});return _(i)}async pressButton(t,e="SingleTap",i=500){switch(e){case"DoubleTap":await this.hidCommand(t,!0),await this.hidCommand(t,!1),await this.hidCommand(t,!0),await this.hidCommand(t,!1);break;case"Hold":await this.hidCommand(t,!0),await F(i),await this.hidCommand(t,!1);break;case"SingleTap":await this.hidCommand(t,!0),await this.hidCommand(t,!1);break}}async switchUserAccount(t){await this.socket.exchange(o.E_OPACK,{_i:"SwitchUserAccountEvent",_t:n.Request,_c:{SwitchAccountID:t}})}async _subscribe(t,e){this.socket.on(t,e),await this.socket.send(o.E_OPACK,{_i:"_interest",_t:n.Event,_c:{_regEvents:[t]}})}async _unsubscribe(t,e){if(e)this.socket.off(t,e);await this.socket.send(o.E_OPACK,{_i:"_interest",_t:n.Event,_c:{_deregEvents:[t]}})}async _sessionStart(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"_sessionStart",_t:n.Request,_c:{_srvT:"com.apple.tvremoteservices",_sid:v(0,4294967295)}});return _(t)}async _systemInfo(t){let[,e]=await this.socket.exchange(o.E_OPACK,{_i:"_systemInfo",_t:n.Request,_c:{_bf:0,_cf:512,_clFl:128,_i:"cafecafecafe",_idsID:t.toString(),_pubID:"FF:70:79:61:74:76",_sf:256,_sv:"170.18",model:"iPhone10,6",name:"Bas Companion Link"}});return _(e)}async _touchStart(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"_touchStart",_t:n.Request,_c:{_height:x(1000),_tFl:0,_width:x(1000)}});return _(t)}async _tvrcSessionStart(){let[,t]=await this.socket.exchange(o.E_OPACK,{_i:"TVRCSessionStart",_t:n.Request,_btHP:!1,_inUseProc:"tvremoted",_c:{}});return _(t)}}function _(t){if(typeof t==="object")return t;throw K.error("Expected an object.",{obj:t}),Error("Expected an object.")}import{AccessoryPair as O}from"@basmilius/apple-common";class P{get internal(){return this.#t}get socket(){return this.#s.socket}#t;#s;constructor(t){this.#t=new O(this.#e.bind(this)),this.#s=t}async start(){await this.#t.start()}async pin(t){return this.#t.pin(t)}async transient(){return this.#t.transient()}async#e(t,e){let i=t==="m1"?o.PS_Start:o.PS_Next,[,s]=await this.socket.exchange(i,{_pd:e,_pwTy:1});if(typeof s!=="object"||s===null)throw Error("Invalid response from receiver.");return s._pd}}import{randomInt as T}from"node:crypto";import{Socket as V}from"node:net";import{BaseSocket as I,decodeOPack as U,decryptChacha20 as B,encodeOPack as q,encryptChacha20 as M,opackSizedInt as N,reporter as a}from"@basmilius/apple-common";var S=4;class y extends I{get isConnected(){return this.#t.readyState==="open"}get isEncrypted(){return!!this.#o&&!!this.#n}#t;#s={};#e=Buffer.alloc(0);#i;#o;#c;#n;#r;constructor(t,e){super(t,e);this.#r=T(0,65536),this.onClose=this.onClose.bind(this),this.onConnect=this.onConnect.bind(this),this.onData=this.onData.bind(this),this.onEnd=this.onEnd.bind(this),this.onError=this.onError.bind(this),this.#t=new V,this.#t.on("close",this.onClose),this.#t.on("connect",this.onConnect),this.#t.on("data",this.onData),this.#t.on("end",this.onEnd),this.#t.on("error",this.onError)}async connect(){return a.net(`Connecting to ${this.address}:${this.port}...`),await new Promise((t)=>{this.#t.connect({host:this.address,port:this.port,keepAlive:!0},t)})}async disconnect(){this.#t.destroy()}async enableEncryption(t,e){this.#o=t,this.#n=e,this.#i=0,this.#c=0}async exchange(t,e){let i=this.#r;return new Promise((s,r)=>{if(k.includes(t))this.#s[-1]=s;else this.#s[i]=s;this.send(t,e).catch(r)})}async send(t,e){let i=this.#r++;e._x??=N(i,8);let s=Buffer.from(q(e)),r=s.byteLength;if(this.isEncrypted&&r>0)r+=16;let m=Buffer.alloc(4);m.writeUint8(t,0),m.writeUintBE(r,1,3);let c;if(this.isEncrypted){let p=Buffer.alloc(12);p.writeBigUInt64LE(BigInt(this.#c++),0);let u=M(this.#n,p,m,s);c=Buffer.concat([m,u.ciphertext,u.authTag])}else c=Buffer.concat([m,s]);return a.raw("Send data frame",this.isEncrypted,Buffer.from(c).toString("hex"),e),new Promise((p,u)=>{this.#t.write(c,(d)=>d&&u(d)),p()})}async onClose(){await super.onClose(),a.net(`Connection closed from ${this.address}:${this.port}`)}async onConnect(){await super.onConnect(),a.net(`Connected to ${this.address}:${this.port}`)}async onData(t){this.#e=Buffer.concat([this.#e,t]);while(this.#e.byteLength>=S){let e=this.#e.subarray(0,S),i=e.readUintBE(1,3),s=S+i;if(this.#e.byteLength<s){a.warn(`Not enough data yet, waiting on the next frame.. needed=${s} available=${this.#e.byteLength} receivedLength=${t.byteLength}`);return}a.raw(`Frame found length=${s} availableLength=${this.#e.byteLength} receivedLength=${t.byteLength}`);let r=Buffer.from(this.#e.subarray(0,s));this.#e=this.#e.subarray(s),a.raw(`Handle frame, ${this.#e.byteLength} bytes left...`);let c=(await this.#a(r)).subarray(4,s);await this.#m(e,c)}}async onEnd(){a.net("Connection ended")}async onError(t){await super.onError(t),a.error("Error received",t)}async#a(t){if(!this.isEncrypted)return t;let e=t.subarray(0,4),i=e.readUintBE(1,3),s=t.subarray(4,4+i),r=s.subarray(s.byteLength-16),m=s.subarray(0,s.byteLength-16),c=Buffer.alloc(12);c.writeBigUint64LE(BigInt(this.#i++),0);let p=B(this.#o,c,e,m,r);return Buffer.concat([e,p,r])}async#m(t,e){let i=t.readInt8();if(!g.includes(i)){a.warn("Packet not handled, no opack frame.");return}if([e]=U(e),a.raw("Decoded OPACK",{header:t,payload:e}),"_x"in e){let s=e._x;if(s in this.#s)(this.#s[s]??null)?.([t,e]),delete this.#s[s];else if("_i"in e)this.emit(e._i,e._c);else{let r=e._c,m=Object.keys(r).map((c)=>c.substring(0,-3));for(let c of m)this.emit(c,r[c])}}else if(this.#s[-1])(this.#s[-1]??null)?.([t,e]),delete this.#s[-1];else a.warn("No handler for message",[t,e])}}import{AccessoryVerify as b,hkdf as R}from"@basmilius/apple-common";class l{get socket(){return this.#s.socket}#t;#s;constructor(t){this.#t=new b(this.#e.bind(this)),this.#s=t}async start(t){let e=await this.#t.start(t),i=R({hash:"sha512",key:e.sharedSecret,length:32,salt:Buffer.alloc(0),info:Buffer.from("ServerEncrypt-main")}),s=R({hash:"sha512",key:e.sharedSecret,length:32,salt:Buffer.alloc(0),info:Buffer.from("ClientEncrypt-main")});return{accessoryToControllerKey:i,controllerToAccessoryKey:s,pairingId:e.pairingId,sharedSecret:e.sharedSecret}}async#e(t,e){let i=t==="m1"?o.PV_Start:o.PV_Next,[,s]=await this.socket.exchange(i,{_pd:e,_auTy:4});if(typeof s!=="object"||s===null)throw Error("Invalid response from receiver.");return s._pd}}class w{get api(){return this.#t}get device(){return this.#s}get socket(){return this.#e}get pairing(){return this.#i}get verify(){return this.#o}#t;#s;#e;#i;#o;constructor(t){this.#s=t,this.#e=new y(t.address,t.service.port),this.#t=new h(this),this.#i=new P(this),this.#o=new l(this)}async connect(){await this.#e.connect()}async disconnect(){await this.#e.disconnect()}}export{A as convertAttentionState,C as MediaControlCommand,f as HidCommand,w as CompanionLink};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=833289E21DFDB55564756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/
|
|
3
|
+
"sources": ["../src/const.ts", "../src/utils.ts", "../src/api.ts", "../src/messages.ts", "../src/pairing.ts", "../src/socket.ts", "../src/verify.ts", "../src/protocol.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"
|
|
6
|
-
"import
|
|
7
|
-
"import {
|
|
8
|
-
"
|
|
5
|
+
"export const HidCommand = {\n Up: 1,\n Down: 2,\n Left: 3,\n Right: 4,\n Menu: 5,\n Select: 6,\n Home: 7,\n VolumeUp: 8,\n VolumeDown: 9,\n Siri: 10,\n Screensaver: 11,\n Sleep: 12,\n Wake: 13,\n PlayPause: 14,\n ChannelIncrement: 15,\n ChannelDecrement: 16,\n Guide: 17,\n PageUp: 18,\n PageDown: 19\n} as const;\n\nexport const MediaControlCommand = {\n Play: 1,\n Pause: 2,\n NextTrack: 3,\n PreviousTrack: 4,\n GetVolume: 5,\n SetVolume: 6,\n SkipBy: 7,\n FastForwardBegin: 8,\n FastForwardEnd: 9,\n RewindBegin: 10,\n RewindEnd: 11,\n GetCaptionSettings: 12,\n SetCaptionSettings: 13\n} as const;\n\nexport type HidCommandKey = keyof typeof HidCommand;\nexport type MediaControlCommandKey = keyof typeof MediaControlCommand;\n",
|
|
6
|
+
"import type { AttentionState } from './types';\n\nexport function convertAttentionState(state: number): AttentionState {\n switch (state) {\n case 0x01:\n return 'asleep';\n\n case 0x02:\n return 'screensaver';\n\n case 0x03:\n return 'awake';\n\n case 0x04:\n return 'idle';\n\n default:\n return 'unknown';\n }\n}\n",
|
|
7
|
+
"import { randomInt } from 'node:crypto';\nimport { opackFloat, parseBinaryPlist, reporter, waitFor } from '@basmilius/apple-common';\nimport { HidCommand, type HidCommandKey, MediaControlCommand, type MediaControlCommandKey } from './const';\nimport { FrameType, MessageType } from './messages';\nimport type { AttentionState, ButtonPressType, LaunchableApp, UserAccount } from './types';\nimport { convertAttentionState } from './utils';\nimport type Protocol from './protocol';\nimport type Socket from './socket';\n\nexport default class CompanionLinkApi {\n get socket(): Socket {\n return this.#protocol.socket;\n }\n\n readonly #protocol: Protocol;\n\n constructor(protocol: Protocol) {\n this.#protocol = protocol;\n }\n\n async fetchMediaControlStatus(): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchMediaControlStatus',\n _t: MessageType.Request,\n _c: {}\n });\n }\n\n async fetchNowPlayingInfo(): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchCurrentNowPlayingInfoEvent',\n _t: MessageType.Request,\n _c: {}\n });\n }\n\n async fetchSupportedActions(): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchSupportedActionsEvent',\n _t: MessageType.Request,\n _c: {}\n });\n }\n\n async getAttentionState(): Promise<AttentionState> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchAttentionState',\n _t: MessageType.Request,\n _c: {}\n });\n\n const {_c} = objectOrFail<AttentionStateResponse>(payload);\n\n return convertAttentionState(_c.state);\n }\n\n async getLaunchableApps(): Promise<LaunchableApp[]> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchLaunchableApplicationsEvent',\n _t: MessageType.Request,\n _c: {}\n });\n\n const {_c} = objectOrFail<LaunchableAppsResponse>(payload);\n\n return Object.entries(_c).map(([bundleId, name]) => ({\n bundleId,\n name\n }));\n }\n\n async getSiriRemoteInfo(): Promise<any> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchSiriRemoteInfo',\n _t: MessageType.Request,\n _c: {}\n });\n\n return parseBinaryPlist(Buffer.from(payload['_c']['SiriRemoteInfoKey']).buffer);\n }\n\n async getUserAccounts(): Promise<UserAccount[]> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'FetchUserAccountsEvent',\n _t: MessageType.Request,\n _c: {}\n });\n\n const {_c} = objectOrFail<UserAccountsResponse>(payload);\n\n return Object.entries(_c).map(([accountId, name]) => ({\n accountId,\n name\n }));\n }\n\n async hidCommand(command: HidCommandKey, down = false): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_hidC',\n _t: MessageType.Request,\n _c: {\n _hBtS: down ? 1 : 2,\n _hidC: HidCommand[command]\n }\n });\n }\n\n async launchApp(bundleId: string): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_launchApp',\n _t: MessageType.Request,\n _c: {\n _bundleID: bundleId\n }\n });\n }\n\n async launchUrl(url: string): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_launchApp',\n _t: MessageType.Request,\n _c: {\n _urlS: url\n }\n });\n }\n\n async mediaControlCommand(command: MediaControlCommandKey, content?: object): Promise<object> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_mcc',\n _t: MessageType.Request,\n _c: {\n _mcc: MediaControlCommand[command],\n ...(content || {})\n }\n });\n\n return objectOrFail(payload);\n }\n\n async pressButton(command: HidCommandKey, type: ButtonPressType = 'SingleTap', holdDelayMs = 500): Promise<void> {\n switch (type) {\n case 'DoubleTap':\n await this.hidCommand(command, true);\n await this.hidCommand(command, false);\n\n await this.hidCommand(command, true);\n await this.hidCommand(command, false);\n break;\n\n case 'Hold':\n await this.hidCommand(command, true);\n await waitFor(holdDelayMs);\n await this.hidCommand(command, false);\n break;\n\n case 'SingleTap':\n await this.hidCommand(command, true);\n await this.hidCommand(command, false);\n break;\n }\n }\n\n async switchUserAccount(accountId: string): Promise<void> {\n await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'SwitchUserAccountEvent',\n _t: MessageType.Request,\n _c: {\n SwitchAccountID: accountId\n }\n });\n }\n\n async _subscribe(event: string, fn: (data: unknown) => void): Promise<void> {\n this.socket.on(event, fn);\n\n await this.socket.send(FrameType.E_OPACK, {\n _i: '_interest',\n _t: MessageType.Event,\n _c: {\n _regEvents: [event]\n }\n });\n }\n\n async _unsubscribe(event: string, fn?: (data: unknown) => void): Promise<void> {\n if (fn) {\n this.socket.off(event, fn);\n }\n\n await this.socket.send(FrameType.E_OPACK, {\n _i: '_interest',\n _t: MessageType.Event,\n _c: {\n _deregEvents: [event]\n }\n });\n }\n\n async _sessionStart(): Promise<object> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_sessionStart',\n _t: MessageType.Request,\n _c: {\n _srvT: 'com.apple.tvremoteservices',\n _sid: randomInt(0, 2 ** 32 - 1)\n }\n });\n\n return objectOrFail(payload);\n }\n\n async _systemInfo(pairingId: Buffer): Promise<object> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_systemInfo',\n _t: MessageType.Request,\n _c: {\n _bf: 0,\n _cf: 512,\n _clFl: 128,\n _i: 'cafecafecafe',\n _idsID: pairingId.toString(),\n _pubID: 'FF:70:79:61:74:76',\n _sf: 256,\n _sv: '170.18',\n model: 'iPhone10,6',\n name: 'Bas Companion Link'\n }\n });\n\n return objectOrFail(payload);\n }\n\n async _touchStart(): Promise<object> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: '_touchStart',\n _t: MessageType.Request,\n _c: {\n _height: opackFloat(1000.0),\n _tFl: 0,\n _width: opackFloat(1000.0)\n }\n });\n\n return objectOrFail(payload);\n }\n\n async _tvrcSessionStart(): Promise<object> {\n const [, payload] = await this.socket.exchange(FrameType.E_OPACK, {\n _i: 'TVRCSessionStart',\n _t: MessageType.Request,\n _btHP: false,\n _inUseProc: 'tvremoted',\n _c: {}\n });\n\n return objectOrFail(payload);\n }\n}\n\nfunction objectOrFail<T = object>(obj: unknown): T {\n if (typeof obj === 'object') {\n return obj as T;\n }\n\n reporter.error('Expected an object.', {obj});\n\n throw new Error('Expected an object.');\n}\n\ntype AttentionStateResponse = {\n readonly _c: {\n readonly state: number;\n };\n};\n\ntype LaunchableAppsResponse = {\n readonly _c: Record<string, string>;\n};\n\ntype UserAccountsResponse = {\n readonly _c: Record<string, string>;\n};\n",
|
|
8
|
+
"export const FrameType = {\n Unknown: 0,\n Noop: 1,\n\n PS_Start: 3,\n PS_Next: 4,\n PV_Start: 5,\n PV_Next: 6,\n\n U_OPACK: 7,\n E_OPACK: 8,\n P_OPACK: 9,\n\n PA_Request: 10,\n PA_Response: 11,\n\n SessionStartRequest: 16,\n SessionStartResponse: 17,\n SessionData: 18,\n\n FamilyIdentityRequest: 32,\n FamilyIdentityResponse: 33,\n FamilyIdentityUpdate: 34\n} as const;\n\nexport const MessageType = {\n Event: 1,\n Request: 2,\n Response: 3\n} as const;\n\nexport const OPackFrameTypes: number[] = [\n FrameType.PS_Start,\n FrameType.PS_Next,\n FrameType.PV_Start,\n FrameType.PV_Next,\n\n FrameType.U_OPACK,\n FrameType.E_OPACK,\n FrameType.P_OPACK\n];\n\nexport const PairFrameTypes: number[] = [\n FrameType.PS_Start,\n FrameType.PS_Next,\n FrameType.PV_Start,\n FrameType.PV_Next\n];\n",
|
|
9
|
+
"import { type AccessoryCredentials, type AccessoryKeys, AccessoryPair } from '@basmilius/apple-common';\nimport { FrameType } from './messages';\nimport type Socket from './socket';\nimport type Protocol from './protocol';\n\nexport default class CompanionLinkPairing {\n get internal(): AccessoryPair {\n return this.#internal;\n }\n\n get socket(): Socket {\n return this.#protocol.socket;\n }\n\n readonly #internal: AccessoryPair;\n readonly #protocol: Protocol;\n\n constructor(protocol: Protocol) {\n this.#internal = new AccessoryPair(this.#request.bind(this));\n this.#protocol = protocol;\n }\n\n async start(): Promise<void> {\n await this.#internal.start();\n }\n\n async pin(askPin: () => Promise<string>): Promise<AccessoryCredentials> {\n return this.#internal.pin(askPin);\n }\n\n async transient(): Promise<AccessoryKeys> {\n return this.#internal.transient();\n }\n\n async #request(step: 'm1' | 'm3' | 'm5', data: Buffer): Promise<Buffer> {\n const frameType = step === 'm1' ? FrameType.PS_Start : FrameType.PS_Next;\n const [, response] = await this.socket.exchange(frameType, {\n _pd: data,\n _pwTy: 1\n });\n\n if (typeof response !== 'object' || response === null) {\n throw new Error('Invalid response from receiver.');\n }\n\n return response['_pd'];\n }\n}\n",
|
|
10
|
+
"import { randomInt } from 'node:crypto';\nimport { Socket } from 'node:net';\nimport { BaseSocket, decodeOPack, decryptChacha20, encodeOPack, encryptChacha20, opackSizedInt, reporter } from '@basmilius/apple-common';\nimport { OPackFrameTypes, PairFrameTypes } from './messages';\n\nconst HEADER_BYTES = 4;\n\nexport default class CompanionLinkSocket extends BaseSocket<Record<string, [unknown]>> {\n get isConnected(): boolean {\n return this.#socket.readyState === 'open';\n }\n\n get isEncrypted(): boolean {\n return !!this.#readKey && !!this.#writeKey;\n }\n\n readonly #socket: Socket;\n readonly #queue: Record<number, Function> = {};\n #buffer: Buffer = Buffer.alloc(0);\n #readCount: number;\n #readKey?: Buffer;\n #writeCount: number;\n #writeKey?: Buffer;\n #xid: number;\n\n constructor(address: string, port: number) {\n super(address, port);\n\n this.#xid = randomInt(0, 2 ** 16);\n\n this.onClose = this.onClose.bind(this);\n this.onConnect = this.onConnect.bind(this);\n this.onData = this.onData.bind(this);\n this.onEnd = this.onEnd.bind(this);\n this.onError = this.onError.bind(this);\n\n this.#socket = new Socket();\n this.#socket.on('close', this.onClose);\n this.#socket.on('connect', this.onConnect);\n this.#socket.on('data', this.onData);\n this.#socket.on('end', this.onEnd);\n this.#socket.on('error', this.onError);\n }\n\n async connect(): Promise<void> {\n reporter.net(`Connecting to ${this.address}:${this.port}...`);\n\n return await new Promise(resolve => {\n this.#socket.connect({\n host: this.address,\n port: this.port,\n keepAlive: true\n }, resolve);\n });\n }\n\n async disconnect(): Promise<void> {\n this.#socket.destroy();\n }\n\n async enableEncryption(readKey: Buffer, writeKey: Buffer): Promise<void> {\n this.#readKey = readKey;\n this.#writeKey = writeKey;\n this.#readCount = 0;\n this.#writeCount = 0;\n }\n\n async exchange(type: number, obj: Record<string, unknown>): Promise<[number, unknown]> {\n const _x = this.#xid;\n\n return new Promise<[number, number]>((resolve, reject) => {\n if (PairFrameTypes.includes(type)) {\n this.#queue[-1] = resolve;\n } else {\n this.#queue[_x] = resolve;\n }\n\n this.send(type, obj).catch(reject);\n });\n }\n\n async send(type: number, obj: Record<string, unknown>): Promise<void> {\n const _x = this.#xid++;\n obj._x ??= opackSizedInt(_x, 8);\n\n let payload = Buffer.from(encodeOPack(obj));\n let payloadLength = payload.byteLength;\n\n if (this.isEncrypted && payloadLength > 0) {\n payloadLength += 16;\n }\n\n const header = Buffer.alloc(4);\n header.writeUint8(type, 0);\n header.writeUintBE(payloadLength, 1, 3);\n\n let data: Buffer;\n\n if (this.isEncrypted) {\n const nonce = Buffer.alloc(12);\n nonce.writeBigUInt64LE(BigInt(this.#writeCount++), 0);\n\n const encrypted = encryptChacha20(this.#writeKey, nonce, header, payload);\n data = Buffer.concat([header, encrypted.ciphertext, encrypted.authTag]);\n } else {\n data = Buffer.concat([header, payload]);\n }\n\n reporter.raw('Send data frame', this.isEncrypted, Buffer.from(data).toString('hex'), obj);\n\n return new Promise((resolve, reject) => {\n this.#socket.write(data, err => err && reject(err));\n resolve();\n });\n }\n\n async onClose(): Promise<void> {\n await super.onClose();\n reporter.net(`Connection closed from ${this.address}:${this.port}`);\n }\n\n async onConnect(): Promise<void> {\n await super.onConnect();\n reporter.net(`Connected to ${this.address}:${this.port}`);\n }\n\n async onData(buffer: Buffer): Promise<void> {\n // reporter.raw('Received data frame', buffer.toString('hex'));\n\n this.#buffer = Buffer.concat([this.#buffer, buffer]);\n\n while (this.#buffer.byteLength >= HEADER_BYTES) {\n const header = this.#buffer.subarray(0, HEADER_BYTES);\n const payloadLength = header.readUintBE(1, 3);\n const totalLength = HEADER_BYTES + payloadLength;\n\n if (this.#buffer.byteLength < totalLength) {\n reporter.warn(`Not enough data yet, waiting on the next frame.. needed=${totalLength} available=${this.#buffer.byteLength} receivedLength=${buffer.byteLength}`);\n return;\n }\n\n reporter.raw(`Frame found length=${totalLength} availableLength=${this.#buffer.byteLength} receivedLength=${buffer.byteLength}`);\n\n const frame = Buffer.from(this.#buffer.subarray(0, totalLength));\n this.#buffer = this.#buffer.subarray(totalLength);\n\n reporter.raw(`Handle frame, ${this.#buffer.byteLength} bytes left...`);\n\n const data = await this.#decrypt(frame);\n let payload = data.subarray(4, totalLength);\n\n await this.#handle(header, payload);\n }\n }\n\n async onEnd(): Promise<void> {\n reporter.net('Connection ended');\n }\n\n async onError(err: Error): Promise<void> {\n await super.onError(err);\n reporter.error('Error received', err);\n }\n\n async #decrypt(data: Buffer): Promise<Buffer> {\n if (!this.isEncrypted) {\n return data;\n }\n\n const header = data.subarray(0, 4);\n const payloadLength = header.readUintBE(1, 3);\n\n const payload = data.subarray(4, 4 + payloadLength);\n const authTag = payload.subarray(payload.byteLength - 16);\n const ciphertext = payload.subarray(0, payload.byteLength - 16);\n\n const nonce = Buffer.alloc(12);\n nonce.writeBigUint64LE(BigInt(this.#readCount++), 0);\n\n const decrypted = decryptChacha20(this.#readKey, nonce, header, ciphertext, authTag);\n\n return Buffer.concat([header, decrypted, authTag]);\n }\n\n async #handle(header: Buffer, payload: Buffer): Promise<void> {\n const type = header.readInt8();\n\n if (!OPackFrameTypes.includes(type)) {\n reporter.warn('Packet not handled, no opack frame.');\n return;\n }\n\n [payload] = decodeOPack(payload);\n\n reporter.raw('Decoded OPACK', {header, payload});\n\n if ('_x' in payload) {\n const _x = (payload as any)._x;\n\n if (_x in this.#queue) {\n const resolve = this.#queue[_x] ?? null;\n resolve?.([header, payload]);\n\n delete this.#queue[_x];\n } else if ('_i' in payload) {\n this.emit(payload['_i'] as string, payload['_c']);\n } else {\n // probably an event\n const content = payload['_c'];\n const keys = Object.keys(content).map(k => k.substring(0, -3));\n\n for (const key of keys) {\n this.emit(key, content[key]);\n }\n }\n } else if (this.#queue[-1]) {\n const _x = -1;\n const resolve = this.#queue[_x] ?? null;\n resolve?.([header, payload]);\n\n delete this.#queue[_x];\n } else {\n reporter.warn('No handler for message', [header, payload]);\n }\n }\n}\n",
|
|
11
|
+
"import { type AccessoryCredentials, type AccessoryKeys, AccessoryVerify, hkdf } from '@basmilius/apple-common';\nimport { FrameType } from './messages';\nimport type Protocol from './protocol';\nimport type Socket from './socket';\n\nexport default class CompanionLinkVerify {\n get socket(): Socket {\n return this.#protocol.socket;\n }\n\n readonly #internal: AccessoryVerify;\n readonly #protocol: Protocol;\n\n constructor(protocol: Protocol) {\n this.#internal = new AccessoryVerify(this.#request.bind(this));\n this.#protocol = protocol;\n }\n\n async start(credentials: AccessoryCredentials): Promise<AccessoryKeys> {\n const keys = await this.#internal.start(credentials);\n\n const accessoryToControllerKey = hkdf({\n hash: 'sha512',\n key: keys.sharedSecret,\n length: 32,\n salt: Buffer.alloc(0),\n info: Buffer.from('ServerEncrypt-main')\n });\n\n const controllerToAccessoryKey = hkdf({\n hash: 'sha512',\n key: keys.sharedSecret,\n length: 32,\n salt: Buffer.alloc(0),\n info: Buffer.from('ClientEncrypt-main')\n });\n\n return {\n accessoryToControllerKey,\n controllerToAccessoryKey,\n pairingId: keys.pairingId,\n sharedSecret: keys.sharedSecret\n };\n }\n\n async #request(step: 'm1' | 'm3' | 'm5', data: Buffer): Promise<Buffer> {\n const frameType = step === 'm1' ? FrameType.PV_Start : FrameType.PV_Next;\n const [, response] = await this.socket.exchange(frameType, {\n _pd: data,\n _auTy: 4\n });\n\n if (typeof response !== 'object' || response === null) {\n throw new Error('Invalid response from receiver.');\n }\n\n return response['_pd'];\n }\n}\n",
|
|
9
12
|
"import type { DiscoveryResult } from '@basmilius/apple-common';\nimport Api from './api';\nimport Pairing from './pairing';\nimport Socket from './socket';\nimport Verify from './verify';\n\nexport default class CompanionLink {\n get api(): Api {\n return this.#api;\n }\n\n get device(): DiscoveryResult {\n return this.#device;\n }\n\n get socket(): Socket {\n return this.#socket;\n }\n\n get pairing(): Pairing {\n return this.#pairing;\n }\n\n get verify(): Verify {\n return this.#verify;\n }\n\n readonly #api: Api;\n readonly #device: DiscoveryResult;\n readonly #socket: Socket;\n readonly #pairing: Pairing;\n readonly #verify: Verify;\n\n constructor(device: DiscoveryResult) {\n this.#device = device;\n this.#socket = new Socket(device.address, device.service.port);\n this.#api = new Api(this);\n this.#pairing = new Pairing(this);\n this.#verify = new Verify(this);\n }\n\n async connect(): Promise<void> {\n await this.#socket.connect();\n }\n\n async disconnect(): Promise<void> {\n await this.#socket.disconnect();\n }\n}\n"
|
|
10
13
|
],
|
|
11
|
-
"mappings": "
|
|
12
|
-
"debugId": "
|
|
14
|
+
"mappings": "AAAO,IAAM,EAAa,CACtB,GAAI,EACJ,KAAM,EACN,KAAM,EACN,MAAO,EACP,KAAM,EACN,OAAQ,EACR,KAAM,EACN,SAAU,EAC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ExB,CCpDA,MAAqB,CAAc,IAC3B,IAAG,EAAQ,CACX,OAAO,KAAK,MAGZ,OAAM,EAAoB,CAC1B,OAAO,KAAK,MAGZ,OAAM,EAAW,CACjB,OAAO,KAAK,MAGZ,QAAO,EAAY,CACnB,OAAO,KAAK,MAGZ,OAAM,EAAW,CACjB,OAAO,KAAK,GAGP,GACA,GACA,GACA,GACA,GAET,WAAW,CAAC,EAAyB,CACjC,KAAK,GAAU,EACf,KAAK,GAAU,IAAI,EAAO,EAAO,QAAS,EAAO,QAAQ,IAAI,EAC7D,KAAK,GAAO,IAAI,EAAI,IAAI,EACxB,KAAK,GAAW,IAAI,EAAQ,IAAI,EAChC,KAAK,GAAU,IAAI,EAAO,IAAI,OAG5B,QAAO,EAAkB,CAC3B,MAAM,KAAK,GAAQ,QAAQ,OAGzB,WAAU,EAAkB,CAC9B,MAAM,KAAK,GAAQ,WAAW,EAEtC",
|
|
15
|
+
"debugId": "833289E21DFDB55564756E2164756E21",
|
|
13
16
|
"names": []
|
|
14
17
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const FrameType: {
|
|
2
|
+
readonly Unknown: 0;
|
|
3
|
+
readonly Noop: 1;
|
|
4
|
+
readonly PS_Start: 3;
|
|
5
|
+
readonly PS_Next: 4;
|
|
6
|
+
readonly PV_Start: 5;
|
|
7
|
+
readonly PV_Next: 6;
|
|
8
|
+
readonly U_OPACK: 7;
|
|
9
|
+
readonly E_OPACK: 8;
|
|
10
|
+
readonly P_OPACK: 9;
|
|
11
|
+
readonly PA_Request: 10;
|
|
12
|
+
readonly PA_Response: 11;
|
|
13
|
+
readonly SessionStartRequest: 16;
|
|
14
|
+
readonly SessionStartResponse: 17;
|
|
15
|
+
readonly SessionData: 18;
|
|
16
|
+
readonly FamilyIdentityRequest: 32;
|
|
17
|
+
readonly FamilyIdentityResponse: 33;
|
|
18
|
+
readonly FamilyIdentityUpdate: 34;
|
|
19
|
+
};
|
|
20
|
+
export declare const MessageType: {
|
|
21
|
+
readonly Event: 1;
|
|
22
|
+
readonly Request: 2;
|
|
23
|
+
readonly Response: 3;
|
|
24
|
+
};
|
|
25
|
+
export declare const OPackFrameTypes: number[];
|
|
26
|
+
export declare const PairFrameTypes: number[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type AccessoryCredentials, type AccessoryKeys, AccessoryPair } from "@basmilius/apple-common";
|
|
2
|
-
import
|
|
3
|
-
import type
|
|
2
|
+
import type Socket from "./socket";
|
|
3
|
+
import type Protocol from "./protocol";
|
|
4
4
|
export default class CompanionLinkPairing {
|
|
5
5
|
#private;
|
|
6
6
|
get internal(): AccessoryPair;
|
|
7
|
-
get socket():
|
|
8
|
-
constructor(protocol:
|
|
7
|
+
get socket(): Socket;
|
|
8
|
+
constructor(protocol: Protocol);
|
|
9
9
|
start(): Promise<void>;
|
|
10
10
|
pin(askPin: () => Promise<string>): Promise<AccessoryCredentials>;
|
|
11
11
|
transient(): Promise<AccessoryKeys>;
|
|
@@ -15,28 +15,3 @@ export default class CompanionLinkSocket extends BaseSocket<Record<string, [unkn
|
|
|
15
15
|
onEnd(): Promise<void>;
|
|
16
16
|
onError(err: Error): Promise<void>;
|
|
17
17
|
}
|
|
18
|
-
export declare const FrameType: {
|
|
19
|
-
readonly Unknown: 0;
|
|
20
|
-
readonly Noop: 1;
|
|
21
|
-
readonly PS_Start: 3;
|
|
22
|
-
readonly PS_Next: 4;
|
|
23
|
-
readonly PV_Start: 5;
|
|
24
|
-
readonly PV_Next: 6;
|
|
25
|
-
readonly U_OPACK: 7;
|
|
26
|
-
readonly E_OPACK: 8;
|
|
27
|
-
readonly P_OPACK: 9;
|
|
28
|
-
readonly PA_Request: 10;
|
|
29
|
-
readonly PA_Response: 11;
|
|
30
|
-
readonly SessionStartRequest: 16;
|
|
31
|
-
readonly SessionStartResponse: 17;
|
|
32
|
-
readonly SessionData: 18;
|
|
33
|
-
readonly FamilyIdentityRequest: 32;
|
|
34
|
-
readonly FamilyIdentityResponse: 33;
|
|
35
|
-
readonly FamilyIdentityUpdate: 34;
|
|
36
|
-
};
|
|
37
|
-
export declare const MessageType: {
|
|
38
|
-
readonly Event: 1;
|
|
39
|
-
readonly Request: 2;
|
|
40
|
-
readonly Response: 3;
|
|
41
|
-
};
|
|
42
|
-
export declare const OPackFrameTypes: number[];
|
package/dist/utils.d.ts
ADDED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type AccessoryCredentials, type AccessoryKeys } from "@basmilius/apple-common";
|
|
2
|
-
import
|
|
3
|
-
import type
|
|
2
|
+
import type Protocol from "./protocol";
|
|
3
|
+
import type Socket from "./socket";
|
|
4
4
|
export default class CompanionLinkVerify {
|
|
5
5
|
#private;
|
|
6
|
-
get socket():
|
|
7
|
-
constructor(protocol:
|
|
6
|
+
get socket(): Socket;
|
|
7
|
+
constructor(protocol: Protocol);
|
|
8
8
|
start(credentials: AccessoryCredentials): Promise<AccessoryKeys>;
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basmilius/apple-companion-link",
|
|
3
3
|
"description": "Implementation of Apple's Companion Link in Node.js.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.67",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@basmilius/apple-common": "0.0.
|
|
43
|
+
"@basmilius/apple-common": "0.0.67"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@basmilius/tools": "^2.23.0",
|
package/dist/protocol/api.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { type default as CompanionLinkSocket } from "./socket";
|
|
2
|
-
import type CompanionLink from "./protocol";
|
|
3
|
-
export default class CompanionLinkApi {
|
|
4
|
-
#private;
|
|
5
|
-
get socket(): CompanionLinkSocket;
|
|
6
|
-
constructor(protocol: CompanionLink);
|
|
7
|
-
fetchMediaControlStatus(): Promise<void>;
|
|
8
|
-
fetchNowPlayingInfo(): Promise<void>;
|
|
9
|
-
fetchSupportedActions(): Promise<void>;
|
|
10
|
-
getAttentionState(): Promise<AttentionState>;
|
|
11
|
-
getLaunchableApps(): Promise<LaunchableApp[]>;
|
|
12
|
-
getSiriRemoteInfo(): Promise<any>;
|
|
13
|
-
getUserAccounts(): Promise<UserAccount[]>;
|
|
14
|
-
hidCommand(command: keyof typeof HidCommand, down?: boolean): Promise<void>;
|
|
15
|
-
launchApp(bundleId: string): Promise<void>;
|
|
16
|
-
launchUrl(url: string): Promise<void>;
|
|
17
|
-
mediaControlCommand(command: keyof typeof MediaControlCommand, content?: object): Promise<object>;
|
|
18
|
-
pressButton(command: keyof typeof HidCommand, type?: ButtonPressType, holdDelayMs?: number): Promise<void>;
|
|
19
|
-
switchUserAccount(accountId: string): Promise<void>;
|
|
20
|
-
_subscribe(event: string, fn: (data: unknown) => void): Promise<void>;
|
|
21
|
-
_unsubscribe(event: string, fn?: (data: unknown) => void): Promise<void>;
|
|
22
|
-
_sessionStart(): Promise<object>;
|
|
23
|
-
_systemInfo(pairingId: Buffer): Promise<object>;
|
|
24
|
-
_touchStart(): Promise<object>;
|
|
25
|
-
_tvrcSessionStart(): Promise<object>;
|
|
26
|
-
}
|
|
27
|
-
declare const HidCommand: {
|
|
28
|
-
readonly Up: 1;
|
|
29
|
-
readonly Down: 2;
|
|
30
|
-
readonly Left: 3;
|
|
31
|
-
readonly Right: 4;
|
|
32
|
-
readonly Menu: 5;
|
|
33
|
-
readonly Select: 6;
|
|
34
|
-
readonly Home: 7;
|
|
35
|
-
readonly VolumeUp: 8;
|
|
36
|
-
readonly VolumeDown: 9;
|
|
37
|
-
readonly Siri: 10;
|
|
38
|
-
readonly Screensaver: 11;
|
|
39
|
-
readonly Sleep: 12;
|
|
40
|
-
readonly Wake: 13;
|
|
41
|
-
readonly PlayPause: 14;
|
|
42
|
-
readonly ChannelIncrement: 15;
|
|
43
|
-
readonly ChannelDecrement: 16;
|
|
44
|
-
readonly Guide: 17;
|
|
45
|
-
readonly PageUp: 18;
|
|
46
|
-
readonly PageDown: 19;
|
|
47
|
-
};
|
|
48
|
-
declare const MediaControlCommand: {
|
|
49
|
-
readonly Play: 1;
|
|
50
|
-
readonly Pause: 2;
|
|
51
|
-
readonly NextTrack: 3;
|
|
52
|
-
readonly PreviousTrack: 4;
|
|
53
|
-
readonly GetVolume: 5;
|
|
54
|
-
readonly SetVolume: 6;
|
|
55
|
-
readonly SkipBy: 7;
|
|
56
|
-
readonly FastForwardBegin: 8;
|
|
57
|
-
readonly FastForwardEnd: 9;
|
|
58
|
-
readonly RewindBegin: 10;
|
|
59
|
-
readonly RewindEnd: 11;
|
|
60
|
-
readonly GetCaptionSettings: 12;
|
|
61
|
-
readonly SetCaptionSettings: 13;
|
|
62
|
-
};
|
|
63
|
-
type ButtonPressType = "DoubleTap" | "Hold" | "SingleTap";
|
|
64
|
-
type AttentionState = "unknown" | "asleep" | "screensaver" | "awake" | "idle";
|
|
65
|
-
type LaunchableApp = {
|
|
66
|
-
readonly bundleId: string;
|
|
67
|
-
readonly name: string;
|
|
68
|
-
};
|
|
69
|
-
type UserAccount = {
|
|
70
|
-
readonly accountId: string;
|
|
71
|
-
readonly name: string;
|
|
72
|
-
};
|
package/dist/protocol/index.d.ts
DELETED
|
File without changes
|