@4players/odin-common 2.5.0 → 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 = {}));
@@ -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;
@@ -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.5.0",
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",