magicrealmsshared 0.3.8 → 0.3.10

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,4 @@
1
- import { Well } from "../types/types";
1
+ import { Auth_Token, Player, Well } from "../types/types";
2
2
  export declare const AUTH = "AUTH";
3
3
  export declare const AUTH_ACK = "AUTH_ACK";
4
4
  export declare const LOGIN_COMMAND = "LOGIN";
@@ -7,6 +7,16 @@ export type LOGIN_DATA = {
7
7
  passwordHash: string;
8
8
  passwordSalt: string;
9
9
  };
10
+ export declare const LOGIN_RESPONSE_COMMAND = "NIGOL";
11
+ export type LOGIN_RESPONSE_DATA<T> = {
12
+ code: number;
13
+ playerData?: Player<T>;
14
+ authToken?: Auth_Token;
15
+ };
16
+ export declare const LOGIN_RESPONSE_CODE_SUCCESS = 0;
17
+ export declare const LOGIN_RESPONSE_CODE_EMAIL_INVALID = 10;
18
+ export declare const LOGIN_RESPONSE_CODE_PASSWORD_INVALID = 20;
19
+ export declare const LOGIN_RESPONSE_CODE_SERVER_ERROR = 1000;
10
20
  export declare const DATA_UPDATE_COMMAND = "DATA_UPDATE";
11
21
  export type DATA_UPDATE<T> = {
12
22
  wells: Well<T>[];
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.POSUPDATE_COMMAND = exports.DATA_UPDATE_COMMAND = exports.LOGIN_COMMAND = exports.AUTH_ACK = exports.AUTH = void 0;
3
+ exports.POSUPDATE_COMMAND = exports.DATA_UPDATE_COMMAND = exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = exports.LOGIN_RESPONSE_CODE_EMAIL_INVALID = exports.LOGIN_RESPONSE_CODE_SUCCESS = exports.LOGIN_RESPONSE_COMMAND = exports.LOGIN_COMMAND = exports.AUTH_ACK = exports.AUTH = void 0;
4
4
  exports.AUTH = "AUTH";
5
5
  exports.AUTH_ACK = "AUTH_ACK";
6
6
  exports.LOGIN_COMMAND = "LOGIN";
7
+ exports.LOGIN_RESPONSE_COMMAND = "NIGOL";
8
+ exports.LOGIN_RESPONSE_CODE_SUCCESS = 0;
9
+ exports.LOGIN_RESPONSE_CODE_EMAIL_INVALID = 10;
10
+ exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = 20;
11
+ exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = 1000;
7
12
  exports.DATA_UPDATE_COMMAND = "DATA_UPDATE";
8
13
  exports.POSUPDATE_COMMAND = "POSUPDATE";
@@ -10,6 +10,20 @@ export type WorldObject<T> = ObjectWithId<T> & {
10
10
  export type Privileges = {
11
11
  all?: boolean;
12
12
  };
13
+ export type Auth_Token = {
14
+ /**
15
+ * Auth-Token-String
16
+ *
17
+ * @type {string}
18
+ */
19
+ s: string;
20
+ /**
21
+ * Expiration
22
+ *
23
+ * @type {Date}
24
+ */
25
+ e: Date;
26
+ };
13
27
  export type Player<T> = ObjectWithId<T> & {
14
28
  email: string;
15
29
  password: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magicrealmsshared",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,10 +1,11 @@
1
- import { Well } from "../types/types";
1
+ import { Auth_Token, Player, Well } from "../types/types";
2
2
 
3
3
 
4
4
  export const AUTH = "AUTH";
5
5
  export const AUTH_ACK = "AUTH_ACK";
6
6
 
7
7
 
8
+
8
9
  export const LOGIN_COMMAND = "LOGIN";
9
10
  export type LOGIN_DATA = {
10
11
  email: string;
@@ -12,6 +13,18 @@ export type LOGIN_DATA = {
12
13
  passwordSalt: string;
13
14
  }
14
15
 
16
+ export const LOGIN_RESPONSE_COMMAND = "NIGOL";
17
+ export type LOGIN_RESPONSE_DATA<T> = {
18
+ code: number;
19
+ playerData?: Player<T>;
20
+ authToken?: Auth_Token;
21
+ }
22
+
23
+ export const LOGIN_RESPONSE_CODE_SUCCESS = 0;
24
+ export const LOGIN_RESPONSE_CODE_EMAIL_INVALID = 10;
25
+ export const LOGIN_RESPONSE_CODE_PASSWORD_INVALID = 20;
26
+ export const LOGIN_RESPONSE_CODE_SERVER_ERROR = 1000;
27
+
15
28
 
16
29
  export const DATA_UPDATE_COMMAND = "DATA_UPDATE";
17
30
  export type DATA_UPDATE<T> = {
@@ -18,6 +18,24 @@ export type Privileges = {
18
18
  //TODO: add other privileges as required
19
19
  };
20
20
 
21
+ export type Auth_Token = {
22
+
23
+ /**
24
+ * Auth-Token-String
25
+ *
26
+ * @type {string}
27
+ */
28
+ s: string,
29
+
30
+
31
+ /**
32
+ * Expiration
33
+ *
34
+ * @type {Date}
35
+ */
36
+ e: Date,
37
+ };
38
+
21
39
  export type Player<T> = ObjectWithId<T> & {
22
40
  email: string,
23
41
  password: string,