mobileconfig
Advanced tools
Comparing version 2.2.0 to 2.3.0
63
index.js
@@ -13,3 +13,4 @@ 'use strict'; | ||
carddav: Handlebars.compile(fs.readFileSync(path.join(__dirname, 'templates', 'carddav.plist'), 'utf-8')), | ||
caldav: Handlebars.compile(fs.readFileSync(path.join(__dirname, 'templates', 'caldav.plist'), 'utf-8')) | ||
caldav: Handlebars.compile(fs.readFileSync(path.join(__dirname, 'templates', 'caldav.plist'), 'utf-8')), | ||
wifi: Handlebars.compile(fs.readFileSync(path.join(__dirname, 'templates', 'wifi.plist'), 'utf-8')) | ||
}; | ||
@@ -22,11 +23,17 @@ | ||
let certs = []; | ||
[].concat(options.cert || []).concat(options.ca || []).map(ca => { | ||
ca = (ca || '').toString().trim().split('END CERTIFICATE-----'); | ||
ca.pop(); | ||
ca.forEach(ca => { | ||
ca += 'END CERTIFICATE-----'; | ||
certs.push(ca.trim()); | ||
[] | ||
.concat(options.cert || []) | ||
.concat(options.ca || []) | ||
.map(ca => { | ||
ca = (ca || '') | ||
.toString() | ||
.trim() | ||
.split('END CERTIFICATE-----'); | ||
ca.pop(); | ||
ca.forEach(ca => { | ||
ca += 'END CERTIFICATE-----'; | ||
certs.push(ca.trim()); | ||
}); | ||
return ca; | ||
}); | ||
return ca; | ||
}); | ||
@@ -54,4 +61,4 @@ certs = certs.reverse(); | ||
? { | ||
SigningTime: {} | ||
} | ||
SigningTime: {} | ||
} | ||
: {}, | ||
@@ -245,2 +252,36 @@ | ||
getWifiConfig(options, callback) { | ||
options = options || {}; | ||
let data = { | ||
displayName: options.displayName, | ||
encryptionType: options.wifi.encryptionType, | ||
ssid: options.wifi.ssid, | ||
password: options.wifi.password, | ||
organization: options.organization || false, | ||
contentUuid: options.contentUuid || uuid.v4(), | ||
plistUuid: options.plistUuid || uuid.v4() | ||
}; | ||
if (callback) { | ||
callback(null, templates.wifi(data)); | ||
return; | ||
} | ||
return templates.wifi(data); | ||
}, | ||
getSignedWifiConfig(options, callback) { | ||
options = options || {}; | ||
let plistFile; | ||
try { | ||
plistFile = module.exports.getWifiConfig(options); | ||
} catch (E) { | ||
return callback(E); | ||
} | ||
return module.exports.sign(plistFile, options.keys, callback); | ||
}, | ||
getSignedConfig(plistData, keys, callback) { | ||
@@ -247,0 +288,0 @@ plistData = plistData || []; |
{ | ||
"name": "mobileconfig", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Create and sign iOS mobileconfig configuration files", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"handlebars": "^4.1.0", | ||
"handlebars": "^4.1.2", | ||
"jsrsasign": "^8.0.12", | ||
@@ -33,8 +33,9 @@ "plist": "^3.0.1", | ||
"eslint-config-nodemailer": "^1.2.0", | ||
"grunt": "~1.0.3", | ||
"eslint-config-prettier": "^6.0.0", | ||
"grunt": "~1.0.4", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-eslint": "^21.0.0", | ||
"grunt-eslint": "^22.0.0", | ||
"grunt-mocha-test": "~0.13.3", | ||
"mocha": "^5.2.0" | ||
"mocha": "^6.2.0" | ||
} | ||
} |
@@ -36,3 +36,3 @@ # mobileconfig | ||
* **accountName** is an optional name for the email account | ||
* **accountName** is an optional description for the email account | ||
* **accountDescription** is an optional description for the email account | ||
* **imap** is the incoming IMAP configuration data with the following properties | ||
@@ -69,3 +69,3 @@ * **hostname** is the hostname of the server | ||
* **accountName** is an optional name for the CardDAV account | ||
* **accountName** is an optional description for the CardDAV account | ||
* **accountDescription** is an optional description for the CardDAV account | ||
* **dav** is the dav server configuration with the following properties | ||
@@ -96,3 +96,3 @@ * **hostname** is the hostname of the server | ||
* **accountName** is an optional name for the CalDAV account | ||
* **accountName** is an optional description for the CalDAV account | ||
* **accountDescription** is an optional description for the CalDAV account | ||
* **dav** is the dav server configuration with the following properties | ||
@@ -107,2 +107,21 @@ * **hostname** is the hostname of the server | ||
### Generate and sign WiFi configuration | ||
Generate and sign WiFi configuration with | ||
```javascript | ||
mobileconfig.getSignedWifiConfig(options, callback) | ||
``` | ||
Where | ||
* **options** is the options object for the account data with following properties | ||
* **organization** is an optional name of the signing organization | ||
* **displayName** is an optional name for the profile | ||
* **wifi** is the required wifi configuration with the following properties | ||
* **encryptionType** encryption type of the wifi network (e.g WPA) | ||
* **ssid** wifi network ssid | ||
* **password** string password for the wifi network | ||
* **keys** includes the key and the certificate for signing the configuration file. See [signing configuration](#signing-configuration) for details of this object | ||
* **callback** (*err*, *data*) is the callback function to run once the configuration is generated. | ||
### Generate and sign any configuration | ||
@@ -249,2 +268,4 @@ | ||
## Changelog | ||
#### 1.0.3 | ||
* WiFi template | ||
@@ -251,0 +272,0 @@ #### 1.0.2 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58989
20
752
283
8
6
Updatedhandlebars@^4.1.2