appium-ios-device 2.0.0 → 2.3.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/lib/utilities.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import Usbmux, { getDefaultSocket } from './usbmux';
2
- import { upgradeToSSL } from './ssl-helper';
2
+ import { upgradeToSSL, enableSSLHandshakeOnly } from './ssl-helper';
3
3
  import _ from 'lodash';
4
4
  import log from './logger';
5
5
 
@@ -73,6 +73,55 @@ async function getDeviceName (udid, socket = null) {
73
73
  }
74
74
  }
75
75
 
76
+ /**
77
+ * Returns all available device values
78
+ * @param {string} udid Device UDID
79
+ * @param {?net.Socket} socket the socket of usbmuxd. It will default to /var/run/usbmuxd if it is not passed
80
+ * @returns {object} Returns available default device values via lockdown.
81
+ * e.g.
82
+ * {
83
+ * "BasebandCertId"=>3840149528,
84
+ * "BasebandKeyHashInformation"=>
85
+ * {"AKeyStatus"=>2,
86
+ * "SKeyHash"=>{
87
+ * "type"=>"Buffer",
88
+ * "data"=>[187, 239, ....]},
89
+ * "SKeyStatus"=>0},
90
+ * "BasebandSerialNumber"=>{"type"=>"Buffer", "data"=>[...]},
91
+ * "BasebandVersion"=>"11.01.02",
92
+ * "BoardId"=>2,
93
+ * "BuildVersion"=>"19C56",
94
+ * "CPUArchitecture"=>"arm64",
95
+ * "ChipID"=>32768,
96
+ * "DeviceClass"=>"iPhone",
97
+ * "DeviceColor"=>"#c8caca",
98
+ * "DeviceName"=>"kazu",
99
+ * "DieID"=>1111111111111,
100
+ * "HardwareModel"=>"N69uAP",
101
+ * "HasSiDP"=>true,
102
+ * "PartitionType"=>"GUID_partition_scheme",
103
+ * "ProductName"=>"iPhone OS",
104
+ * "ProductType"=>"iPhone8,4",
105
+ * "ProductVersion"=>"15.2",
106
+ * "ProductionSOC"=>true,
107
+ * "ProtocolVersion"=>"2",
108
+ * "SupportedDeviceFamilies"=>[1],
109
+ * "TelephonyCapability"=>true,
110
+ * "UniqueChipID"=>1111111111111,
111
+ * "UniqueDeviceID"=>"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
112
+ * "WiFiAddress"=>"00:00:00:00:00:00"
113
+ * }
114
+ */
115
+ async function getDeviceInfo (udid, socket = null) {
116
+ const usbmux = new Usbmux(socket || await getDefaultSocket());
117
+ try {
118
+ const lockdown = await usbmux.connectLockdown(udid);
119
+ return await lockdown.getValue();
120
+ } finally {
121
+ usbmux.close();
122
+ }
123
+ }
124
+
76
125
  /**
77
126
  * @typedef {Object} DeviceTime
78
127
  *
@@ -134,9 +183,10 @@ async function startLockdownSession (udid, socket = null) {
134
183
  * @param {string} udid Device UDID
135
184
  * @param {number} port Port to connect
136
185
  * @param {?net.Socket} socket the socket of usbmuxd. It will default to /var/run/usbmuxd if it is not passed
186
+ * @param {boolean} handshakeOnly only handshake and return the initial socket
137
187
  * @returns {tls.TLSSocket|Object} The socket or the object returned in the callback if the callback function exists
138
188
  */
139
- async function connectPortSSL (udid, port, socket = null) {
189
+ async function connectPortSSL (udid, port, socket = null, handshakeOnly = false) {
140
190
  const usbmux = new Usbmux(socket || await getDefaultSocket());
141
191
  try {
142
192
  const device = await usbmux.findDevice(udid);
@@ -148,7 +198,9 @@ async function connectPortSSL (udid, port, socket = null) {
148
198
  throw new Error(`Could not find a pair record for device '${udid}'. Please first pair with the device`);
149
199
  }
150
200
  const socket = await usbmux.connect(device.Properties.DeviceID, port, undefined);
151
- return upgradeToSSL(socket, pairRecord.HostPrivateKey, pairRecord.HostCertificate);
201
+ return handshakeOnly ?
202
+ await enableSSLHandshakeOnly(socket, pairRecord.HostPrivateKey, pairRecord.HostCertificate) :
203
+ upgradeToSSL(socket, pairRecord.HostPrivateKey, pairRecord.HostCertificate);
152
204
  } catch (e) {
153
205
  usbmux.close();
154
206
  throw e;
@@ -179,5 +231,5 @@ async function connectPort (udid, port, socket = null) {
179
231
 
180
232
  export {
181
233
  getConnectedDevices, getOSVersion, getDeviceName, getDeviceTime,
182
- startLockdownSession, connectPort, connectPortSSL,
234
+ startLockdownSession, connectPort, connectPortSSL, getDeviceInfo
183
235
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "appium"
6
6
  ],
7
- "version": "2.0.0",
7
+ "version": "2.3.0",
8
8
  "author": "appium",
9
9
  "license": "Apache-2.0",
10
10
  "repository": {
@@ -31,10 +31,14 @@
31
31
  "dependencies": {
32
32
  "@appium/support": "^2.55.3",
33
33
  "@babel/runtime": "^7.0.0",
34
+ "asyncbox": "^2.9.2",
34
35
  "bluebird": "^3.1.1",
36
+ "bplist-creator": "^0.x",
37
+ "bplist-parser": "^0.x",
35
38
  "lodash": "^4.17.15",
36
39
  "semver": "^7.0.0",
37
- "source-map-support": "^0.x"
40
+ "source-map-support": "^0.x",
41
+ "uuid": "^8.3.2"
38
42
  },
39
43
  "scripts": {
40
44
  "build": "gulp transpile",
@@ -54,9 +58,11 @@
54
58
  "devDependencies": {
55
59
  "@appium/gulp-plugins": "^6.0.0",
56
60
  "@appium/eslint-config-appium": "^5.0.0",
61
+ "@semantic-release/git": "^10.0.1",
57
62
  "chai": "^4.1.2",
58
63
  "chai-as-promised": "^7.1.1",
59
64
  "gulp": "^4.0.0",
60
- "pre-commit": "^1.1.3"
65
+ "pre-commit": "^1.1.3",
66
+ "semantic-release": "^19.0.2"
61
67
  }
62
68
  }