अपना framework चुनें
एक build डिफ़ॉल्ट रूप से क्या करती है
lightpreset: complexity 5। String literals encode किए जाते हैं, identifiers rename किए जाते हैं और syntax दोबारा लिखा जाता है, और कोई संरचनात्मक layer नहीं जोड़ी जाती। जैसे-जैसे project को अधिक सुरक्षा चाहिए, preset बढ़ाएँ; देखें Presets।- हर build पर एक नया random seed, इसलिए एक ही source की दो builds संरचना में अलग निकलती हैं। एक बार build करें और वही bytes promote करें;
seed: "git"केवल तब pin करें जब आपको reproducible output चाहिए। - Dev builds अछूती रहती हैं। Plugin केवल production build पर काम करता है।
- यह fail closed है। जिस फ़ाइल को engine obfuscate नहीं कर सकता, वह build को विफल कर देती है और उस फ़ाइल का नाम बताती है। देखें Exit codes।
Plugin को installed रखते हुए एक run के लिए engine को छोड़ने के लिए, build.autorun को false पर सेट करें।
परिणाम जाँचें
Protection Map आपका मूल source है, जिसमें हर token इस आधार पर रंगा गया है कि उस पर कितना transformation हुआ। जब bundler ने source map emit किया हो, तो CI के बाहर यह .afterpack/protectionMap.html में लिखा जाता है; हर framework guide दिखाती है कि इसे कैसे चालू करें। इस रिपोर्ट में आपका पूरा source होता है। इसे कभी commit या serve न करें। .afterpack/ की अपनी .gitignore होती है, इसलिए git उसे ignore करता है।
entitlements.js, 54 lines, built at the light preset with a directive around the signature check. Click any token to see what was applied to it.अपनी पहली build से पहले एक उदाहरण देखने के लिए लाइव demo रिपोर्ट खोलें।
विशेष कोड को और मज़बूती से protect करें
Global obfuscation पूरे bundle को कवर करती है। किसी एक region को और आगे ले जाने के लिए, या उसे अछूता छोड़ने के लिए, उसे एक directive से चिह्नित करें:
/* @afterpack preset=hard */
function checkLicense(token: string) {
return verify(token);
}
/* @afterpack end */
const apiKey = /* @afterpack preset=extreme */ "YOUR_SECRET";Directives Pro builds पर प्रभावी होते हैं; grammar और हर उस key के लिए जो सेट की जा सकती है, Directives reference है।
आगे
- AfterPack कैसे काम करता है: एक attacker क्या recover कर सकता है और क्या नहीं।
- Configuration: हर विकल्प और उसे कहाँ सेट करें।
- Best practices: क्या चिह्नित करें, क्या अछूता छोड़ें, और CI।