mrpc-js 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/mrpc.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrpc-js",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Zero-dependency mRPC request encoder and HMAC-SHA256 response validator",
5
5
  "keywords": [
6
6
  "mrpc",
package/src/mrpc.js CHANGED
@@ -34,18 +34,19 @@ export async function create_mRPC(user_id, token, version, payload) {
34
34
  */
35
35
 
36
36
  export async function validate_mRPC_response(response, tag, token) {
37
- const valid_keys = ['success', 'request_tag', 'seed', 'data', 'auth'];
38
37
  const key_types = {
39
38
  success: 'boolean',
39
+ action: 'string',
40
40
  request_tag: 'string',
41
41
  seed: 'string',
42
42
  data: 'object',
43
43
  auth: 'string'
44
44
  }
45
+ const valid_keys = Object.keys(key_types);
45
46
 
46
47
  const keys = Object.keys(response);
47
48
 
48
- if (keys.length !== 5) {
49
+ if (keys.length !== valid_keys.length) {
49
50
  return false;
50
51
  }
51
52