@basmilius/apple-airplay 0.1.3 → 0.2.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/dist/pairing.d.ts CHANGED
@@ -1,13 +1,20 @@
1
- import { type AccessoryCredentials, type AccessoryKeys, AccessoryPair } from "@basmilius/apple-common";
1
+ import { type AccessoryCredentials, type AccessoryKeys, AccessoryPair, AccessoryVerify } from "@basmilius/apple-common";
2
+ import type ControlStream from "./controlStream";
2
3
  import type Protocol from "./protocol";
3
- import type RTSP from "./rtsp";
4
- export default class AirPlayPairing {
4
+ export declare class Pairing {
5
5
  #private;
6
+ get controlStream(): ControlStream;
6
7
  get internal(): AccessoryPair;
7
- get rtsp(): RTSP;
8
8
  constructor(protocol: Protocol);
9
9
  start(): Promise<void>;
10
10
  pin(askPin: () => Promise<string>): Promise<AccessoryCredentials>;
11
11
  pinStart(): Promise<void>;
12
12
  transient(): Promise<AccessoryKeys>;
13
13
  }
14
+ export declare class Verify {
15
+ #private;
16
+ get controlStream(): ControlStream;
17
+ get internal(): AccessoryVerify;
18
+ constructor(protocol: Protocol);
19
+ start(credentials: AccessoryCredentials): Promise<AccessoryKeys>;
20
+ }
@@ -1,23 +1,24 @@
1
- import { type DiscoveryResult, TimingServer } from "@basmilius/apple-common";
1
+ import { Context, type DiscoveryResult, type TimingServer } from "@basmilius/apple-common";
2
+ import { Pairing, Verify } from "./pairing";
3
+ import ControlStream from "./controlStream";
2
4
  import DataStream from "./dataStream";
3
5
  import EventStream from "./eventStream";
4
- import Pairing from "./pairing";
5
- import RTSP from "./rtsp";
6
- import Verify from "./verify";
7
- export default class AirPlay {
6
+ export default class Protocol {
8
7
  #private;
9
- get device(): DiscoveryResult;
8
+ get context(): Context;
9
+ get controlStream(): ControlStream;
10
10
  get dataStream(): DataStream | undefined;
11
+ get discoveryResult(): DiscoveryResult;
11
12
  get eventStream(): EventStream | undefined;
12
13
  get pairing(): Pairing;
13
- get rtsp(): RTSP;
14
14
  get sessionUUID(): string;
15
15
  get verify(): Verify;
16
- constructor(device: DiscoveryResult);
16
+ constructor(deviceId: string, discoveryResult: DiscoveryResult);
17
17
  connect(): Promise<void>;
18
+ destroy(): Promise<void>;
18
19
  disconnect(): Promise<void>;
19
20
  feedback(): Promise<void>;
20
- setupDataStream(sharedSecret: Buffer, onBeforeConnect?: () => Promise<void>): Promise<void>;
21
- setupEventStream(pairingId: Buffer, sharedSecret: Buffer): Promise<void>;
22
- setupTimingServer(timing: TimingServer): Promise<void>;
21
+ setupDataStream(sharedSecret: Buffer, onBeforeConnect?: () => void): Promise<void>;
22
+ setupEventStream(sharedSecret: Buffer, pairingId: Buffer): Promise<void>;
23
+ useTimingServer(timingServer: TimingServer): void;
23
24
  }
package/dist/utils.d.ts CHANGED
@@ -1,18 +1,11 @@
1
- import type { RTSPMethod } from "./types";
2
- export declare function makeHttpHeader(method: RTSPMethod, path: string, headers: HeadersInit, cseq: number): string;
3
- export declare function makeHttpRequest(buffer: Buffer): HttpRequest | null;
4
- export declare function makeHttpResponse(buffer: Buffer): HttpResponse | null;
5
- export declare function randomInt32(): number;
6
- export declare function randomInt64(): bigint;
7
- type HttpRequest = {
8
- readonly headers: Record<string, string>;
9
- readonly method: RTSPMethod;
10
- readonly path: string;
11
- readonly body: Buffer;
12
- readonly requestLength: number;
13
- };
14
- type HttpResponse = {
15
- readonly response: Response;
16
- readonly responseLength: number;
17
- };
18
- export {};
1
+ import * as Proto from "./proto";
2
+ export declare function generateActiveRemoteId(): string;
3
+ export declare function generateDacpId(): string;
4
+ export declare function generateSessionId(): string;
5
+ export declare function nonce(counter: number): Buffer;
6
+ export declare function buildHeader(totalSize: number, seqno: bigint): Buffer;
7
+ export declare function buildReply(seqno: bigint): Buffer;
8
+ export declare function encodeVarint(value: number): Uint8Array;
9
+ export declare function parseHeaderSeqno(header: Buffer): bigint;
10
+ export declare function parseMessages(content: Buffer): Proto.ProtocolMessage[];
11
+ export declare function readVariant(buf: Buffer, offset?: number): [number, number];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-airplay",
3
3
  "description": "Implementation of Apple's AirPlay2 in Node.js.",
4
- "version": "0.1.3",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -41,8 +41,8 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@basmilius/apple-common": "0.1.3",
45
- "@basmilius/apple-encoding": "0.1.3",
44
+ "@basmilius/apple-common": "0.2.0",
45
+ "@basmilius/apple-encoding": "0.2.0",
46
46
  "@bufbuild/protobuf": "^2.11.0"
47
47
  },
48
48
  "devDependencies": {
package/dist/stream.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { EncryptionAwareConnection } from "@basmilius/apple-common";
2
- type EventMap = {
3
- close: [];
4
- connect: [];
5
- error: [Error];
6
- timeout: [];
7
- };
8
- export default class AirPlayStream<TEventMap extends Record<string, any>> extends EncryptionAwareConnection<EventMap & TEventMap> {
9
- #private;
10
- decrypt(data: Buffer): Promise<Buffer>;
11
- encrypt(data: Buffer): Promise<Buffer>;
12
- nonce(counter: number): Buffer;
13
- }
package/dist/types.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export type RTSPMethod =
2
- | 'GET'
3
- | 'OPTIONS'
4
- | 'POST'
5
- | 'PUT'
6
- | 'GET_PARAMETER'
7
- | 'SET_PARAMETER'
8
- | 'ANNOUNCE'
9
- | 'RECORD'
10
- | 'SETUP'
11
- | 'TEARDOWN';
package/dist/verify.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { type AccessoryCredentials, type AccessoryKeys } from "@basmilius/apple-common";
2
- import type Protocol from "./protocol";
3
- import type RTSP from "./rtsp";
4
- export default class AirPlayVerify {
5
- #private;
6
- get rtsp(): RTSP;
7
- constructor(protocol: Protocol);
8
- start(credentials: AccessoryCredentials): Promise<AccessoryKeys>;
9
- }