@4players/odin-common 2.4.13 → 2.6.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.
@@ -1,4 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MinDBFS = void 0;
3
+ exports.Backend = exports.MinDBFS = void 0;
4
4
  exports.MinDBFS = -758.596;
5
+ var Backend;
6
+ (function (Backend) {
7
+ let PeerCipherStatus;
8
+ (function (PeerCipherStatus) {
9
+ PeerCipherStatus[PeerCipherStatus["InvalidPassword"] = -1] = "InvalidPassword";
10
+ PeerCipherStatus[PeerCipherStatus["Unknown"] = 0] = "Unknown";
11
+ PeerCipherStatus[PeerCipherStatus["Unecrypted"] = 1] = "Unecrypted";
12
+ PeerCipherStatus[PeerCipherStatus["Encrypted"] = 2] = "Encrypted";
13
+ })(PeerCipherStatus = Backend.PeerCipherStatus || (Backend.PeerCipherStatus = {}));
14
+ })(Backend || (exports.Backend = Backend = {}));
@@ -1 +1,11 @@
1
1
  export const MinDBFS = -758.596;
2
+ export var Backend;
3
+ (function (Backend) {
4
+ let PeerCipherStatus;
5
+ (function (PeerCipherStatus) {
6
+ PeerCipherStatus[PeerCipherStatus["InvalidPassword"] = -1] = "InvalidPassword";
7
+ PeerCipherStatus[PeerCipherStatus["Unknown"] = 0] = "Unknown";
8
+ PeerCipherStatus[PeerCipherStatus["Unecrypted"] = 1] = "Unecrypted";
9
+ PeerCipherStatus[PeerCipherStatus["Encrypted"] = 2] = "Encrypted";
10
+ })(PeerCipherStatus = Backend.PeerCipherStatus || (Backend.PeerCipherStatus = {}));
11
+ })(Backend || (Backend = {}));
@@ -3,7 +3,7 @@ export declare namespace Backend {
3
3
  type UID = string;
4
4
  type OnStatusChanged = (status: 'started' | 'stopped') => void;
5
5
  type OnEvent = (method: string, properties: unknown) => void;
6
- type Version = '1';
6
+ type Version = '2';
7
7
  interface Plugin {
8
8
  readonly version: Version;
9
9
  readonly playbackVolume: Volume;
@@ -36,15 +36,18 @@ export declare namespace Backend {
36
36
  readonly roomId?: string;
37
37
  readonly userData?: Uint8Array;
38
38
  readonly position?: [number, number, number];
39
- readonly cipher?: Cipher;
39
+ readonly cipher?: SetupCipherSettings;
40
40
  readonly onEvent: OnEvent;
41
41
  }
42
42
  interface Room {
43
43
  readonly token: string;
44
+ readonly cipher: Cipher | undefined;
44
45
  request(method: string, properties: unknown): Promise<unknown>;
45
46
  link(media: Media): Promise<void>;
46
47
  unlink(media: Media): void;
47
48
  close(): void;
49
+ configureCipher(settings: CipherSettings): void;
50
+ getPeerCipherStatus(peerId: number): PeerCipherStatus;
48
51
  }
49
52
  interface Media {
50
53
  readonly customType?: string;
@@ -53,7 +56,7 @@ export declare namespace Backend {
53
56
  interface AudioMedia extends Media {
54
57
  readonly volume: Volume;
55
58
  readonly activity: Activity;
56
- setVolume(value: Volume): void;
59
+ setVolume(value: Volume): Promise<void>;
57
60
  }
58
61
  interface CreateAudioPlaybackParameters {
59
62
  readonly uid: UID;
@@ -76,8 +79,8 @@ export declare namespace Backend {
76
79
  readonly vad?: VadConfig;
77
80
  readonly apm?: ApmConfig;
78
81
  setVad(config: VadConfig): void;
79
- setApm(config: ApmConfig): void;
80
- setDevice(device: DeviceParameters): void;
82
+ setApm(config: ApmConfig): Promise<void>;
83
+ setDevice(device: DeviceParameters): Promise<void>;
81
84
  }
82
85
  interface VideoCapture extends Media {
83
86
  mediaStream?: MediaStream;
@@ -105,8 +108,21 @@ export declare namespace Backend {
105
108
  transientSuppressor: boolean;
106
109
  gainController: boolean;
107
110
  }
108
- type Cipher = {
111
+ type SetupCipherSettings = {
109
112
  type: 'OdinCrypto';
110
- password: string;
111
- };
113
+ } & OdinCryptoSettings;
114
+ type CipherSettings = OdinCryptoSettings;
115
+ interface OdinCryptoSettings {
116
+ password: string | null;
117
+ }
118
+ enum PeerCipherStatus {
119
+ InvalidPassword = -1,
120
+ Unknown = 0,
121
+ Unecrypted = 1,
122
+ Encrypted = 2
123
+ }
124
+ interface Cipher {
125
+ configure(settings: CipherSettings): void;
126
+ getPeerStatus(peerId: number): PeerCipherStatus;
127
+ }
112
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4players/odin-common",
3
- "version": "2.4.13",
3
+ "version": "2.6.0",
4
4
  "description": "A collection of commonly used type definitions and utility functions across ODIN web projects",
5
5
  "author": "Josho Bleicker <josho.bleicker@4players.io> (https://www.4players.io)",
6
6
  "homepage": "https://www.4players.io",