StringArrayCallsWrapperRc4CodeHelper.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { injectable, } from 'inversify';
  2. import { AtobTemplate } from './templates/string-array-calls-wrapper/AtobTemplate';
  3. import { Rc4Template } from './templates/string-array-calls-wrapper/Rc4Template';
  4. import { StringArrayRC4DecodeTemplate } from './templates/string-array-calls-wrapper/StringArrayRC4DecodeTemplate';
  5. import { StringArrayCallsWrapperCodeHelper } from './StringArrayCallsWrapperCodeHelper';
  6. @injectable()
  7. export class StringArrayCallsWrapperRc4CodeHelper extends StringArrayCallsWrapperCodeHelper {
  8. /**
  9. * @returns {string}
  10. */
  11. protected getDecodeStringArrayTemplate (): string {
  12. const atobFunctionName: string = this.randomGenerator.getRandomString(6);
  13. const atobPolyfill: string = this.customCodeHelperFormatter.formatTemplate(AtobTemplate(), {
  14. atobFunctionName
  15. });
  16. const rc4Polyfill: string = this.customCodeHelperFormatter.formatTemplate(Rc4Template(), {
  17. atobFunctionName
  18. });
  19. const selfDefendingCode: string = this.getSelfDefendingTemplate();
  20. return this.customCodeHelperFormatter.formatTemplate(
  21. StringArrayRC4DecodeTemplate(this.randomGenerator),
  22. {
  23. atobPolyfill,
  24. rc4Polyfill,
  25. selfDefendingCode,
  26. stringArrayName: this.stringArrayName,
  27. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  28. }
  29. );
  30. }
  31. }