forked from nowsecure/node-applesign
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
83 lines (76 loc) · 2.34 KB
/
index.js
File metadata and controls
83 lines (76 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
const tools = require('./tools');
const path = require('path');
const ApplesignSession = require('./session');
module.exports = class Applesign {
constructor (options, cb) {
this.config = this.withConfig(options);
if (typeof cb === 'function') {
tools.findInPath(cb, this);
}
}
withConfig (opt) {
if (typeof opt !== 'object') {
opt = {};
}
return {
file: opt.file ? path.resolve(opt.file) : undefined,
use7zip: opt.use7zip === true,
useOpenSSL: opt.useOpenSSL === true,
outdir: undefined,
outfile: opt.outfile,
keychain: opt.keychain,
cloneEntitlements: opt.cloneEntitlements || false,
ignoreVerificationErrors: true,
ignoreCodesignErrors: true,
ignoreZipErrors: opt.ignoreZipErrors || false,
insertLibrary: opt.insertLibrary || undefined,
entitlement: opt.entitlement || undefined,
entry: opt.entry || undefined,
lipoArch: opt.lipoArch || undefined,
bundleid: opt.bundleid || undefined,
identity: opt.identity || undefined,
replaceipa: opt.replaceipa || false,
withoutWatchapp: opt.withoutWatchapp || false,
mobileprovision: opt.mobileprovision || undefined,
massageEntitlements: opt.massageEntitlements || false,
forceFamily: opt.forceFamily || false,
parallel: opt.parallel || false,
verifyTwice: opt.verifyTwice || false,
unfairPlay: opt.unfairPlay || false,
selfSignedProvision: opt.selfSignedProvision || false,
dontVerify: opt.dontVerify || false,
bundleIdKeychainGroup: opt.bundleIdKeychainGroup || false,
customKeychainGroup: opt.customKeychainGroup || undefined,
noclean: opt.noclean || false
};
}
signIPA (file, cb) {
const s = new ApplesignSession(this.config);
if (typeof file === 'function') {
cb = file;
} else {
s.setFile(file);
}
return s.signIPA((err) => {
s.finalize(cb, err)
});
}
signFile (file, cb) {
const s = new ApplesignSession(this.config);
return s.signFile(file, cb);
}
signXCarchive (file, cb) {
const ipaFile = file + '.ipa';
tools.xcaToIpa(file, (error) => {
if (error) {
this.emit('warning', error);
return cb(error);
}
this.signIPA(ipaFile, cb);
});
}
getIdentities (cb) {
tools.getIdentities(cb);
}
};