Skip to content

Commit c88fd80

Browse files
committed
chore: cleanup ios-security
1 parent de15d68 commit c88fd80

File tree

84 files changed

+609
-824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+609
-824
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,9 @@ packages/**/angular/dist
4545
packages/shared-notification-delegate/common.d.ts
4646
packages/shared-notification-delegate/common.js
4747
packages/shared-notification-delegate/common.js.map
48-
*.aar
48+
*.aar
49+
50+
# iOS:
51+
packages/**/native-src/ios/**/xcuserdata/
52+
packages/**/native-src/ios/**/project.xcworkspace/
53+
packages/**/native-src/ios/**/build

apps/demo-angular/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@nativescript/geolocation": "file:../../dist/packages/geolocation",
2020
"@nativescript/google-pay": "file:../../dist/packages/google-pay",
2121
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
22+
"@nativescript/ios-security": "file:../../dist/packages/ios-security",
2223
"@nativescript/iqkeyboardmanager": "file:../../dist/packages/iqkeyboardmanager",
2324
"@nativescript/local-notifications": "file:../../dist/packages/local-notifications",
2425
"@nativescript/localize": "file:../../dist/packages/localize",

apps/demo-angular/src/home.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export class HomeComponent {
5757
{
5858
name: 'imagepicker',
5959
},
60+
{
61+
name: 'ios-security',
62+
},
6063
{
6164
name: 'iqkeyboardmanager',
6265
},
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Component, NgZone } from '@angular/core';
2-
import { DemoSharedIosSecurity } from '@demo/shared';
2+
import { DemoSharedIOSSecurity } from '@demo/shared';
33
import {} from '@nativescript/ios-security';
44

55
@Component({
66
selector: 'demo-ios-security',
77
templateUrl: 'ios-security.component.html',
88
})
9-
export class IosSecurityComponent {
10-
demoShared: DemoSharedIosSecurity;
9+
export class IOSSecurityComponent {
10+
demoShared: DemoSharedIOSSecurity;
1111

1212
constructor(private _ngZone: NgZone) {}
1313

1414
ngOnInit() {
15-
this.demoShared = new DemoSharedIosSecurity();
15+
this.demoShared = new DemoSharedIOSSecurity();
1616
}
1717
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
22
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3-
import { IosSecurityComponent } from './ios-security.component';
3+
import { IOSSecurityComponent } from './ios-security.component';
44

55
@NgModule({
6-
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: IosSecurityComponent }])],
7-
declarations: [IosSecurityComponent],
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: IOSSecurityComponent }])],
7+
declarations: [IOSSecurityComponent],
88
schemas: [NO_ERRORS_SCHEMA],
99
})
10-
export class IosSecurityModule {}
10+
export class IOSSecurityModule {}

apps/demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@nativescript/geolocation": "file:../../packages/geolocation",
2323
"@nativescript/google-pay": "file:../../packages/google-pay",
2424
"@nativescript/imagepicker": "file:../../packages/imagepicker",
25+
"@nativescript/ios-security": "file:../../packages/ios-security",
2526
"@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager",
2627
"@nativescript/local-notifications": "file:../../packages/local-notifications",
2728
"@nativescript/localize": "file:../../dist/packages/localize",

apps/demo/src/main-page.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<Button text="geolocation" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2323
<Button text="google-pay" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2424
<Button text="imagepicker" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
25+
<Button text="ios-security" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2526
<Button text="iqkeyboardmanager" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2627
<Button text="local-notifications" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2728
<Button text="localize" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Observable, EventData, Page } from '@nativescript/core';
2-
import { DemoSharedIosSecurity } from '@demo/shared';
2+
import { DemoSharedIOSSecurity } from '@demo/shared';
33
import {} from '@nativescript/ios-security';
44

55
export function navigatingTo(args: EventData) {
66
const page = <Page>args.object;
77
page.bindingContext = new DemoModel();
88
}
99

10-
export class DemoModel extends DemoSharedIosSecurity {}
10+
export class DemoModel extends DemoSharedIOSSecurity {}

packages/ios-security/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# @nativescript/ios-security
22

3+
[IOSSecuritySuite](https://github.com/securing/IOSSecuritySuite) for NativeScript.
4+
35
```javascript
46
ns plugin add @nativescript/ios-security
57
```
@@ -18,16 +20,17 @@ In short here are the steps:
1820

1921
*TypeScript*
2022
```
21-
import * as IosSecurity from "@nativescript/ios-security";
23+
import { IOSSecurity } from "@nativescript/ios-security";
2224
```
2325

2426
*Javascript*
2527
```
26-
var IosSecurity = require("@nativescript/ios-security");
28+
var IOSSecurity = require("@nativescript/ios-security").IOSSecurity;
2729
```
2830

2931
### Update Info.plist
30-
After adding ios-security to your project, you will also need to update your main Info.plist. There is a check in jailbreak detection module that uses ```canOpenURL(_:)``` method and [requires](https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl) specifying URLs that will be queried.
32+
33+
After adding ios-security to your project, you will also need to update your Info.plist. There is a check in jailbreak detection module that uses ```canOpenURL(_:)``` method and [requires](https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl) specifying URLs that will be queried.
3134

3235
```xml
3336
<key>LSApplicationQueriesSchemes</key>
@@ -43,11 +46,11 @@ After adding ios-security to your project, you will also need to update your mai
4346

4447
### Jailbreak detector module
4548

46-
* **The simplest method** returns True/False if you just want to know if the device is jailbroken or jailed
49+
* **The simplest method** returns true/false if you just want to know if the device is jailbroken or jailed
4750

4851
*Javascript*
4952
```
50-
if (IosSecurity.amIJailbroken()) {
53+
if (IOSSecurity.amIJailbroken()) {
5154
console.log("This device is jailbroken");
5255
} else {
5356
console.log("This device is not jailbroken");
@@ -56,27 +59,27 @@ if (IosSecurity.amIJailbroken()) {
5659

5760
### Debugger detector module
5861
```
59-
let amIDebugged = IosSecurity.amIDebugged();
62+
const amIDebugged = IOSSecurity.amIDebugged();
6063
```
6164

6265
### Deny debugger at all
6366
```
64-
IosSecurity.denyDebugger();
67+
IOSSecurity.denyDebugger();
6568
```
6669

6770
### Emulator detector module
6871
```
69-
let runInEmulator = IosSecurity.amIRunInEmulator();
72+
const runInEmulator = IOSSecurity.amIRunInEmulator();
7073
```
7174

7275
### Reverse engineering tools detector module
7376
```
74-
let amIReverseEngineered = IosSecurity.amIReverseEngineered();
77+
const amIReverseEngineered = IOSSecurity.amIReverseEngineered();
7578
```
7679

7780
### System proxy detector module
7881
```
79-
let amIProxied = IosSecurity.amIProxied();
82+
const amIProxied = IOSSecurity.amIProxied();
8083
```
8184

8285
## License
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export class IOSSecurity {
2+
static amIJailbroken(): boolean {
3+
return false;
4+
}
5+
6+
static amIDebugged(): boolean {
7+
return false;
8+
}
9+
10+
static amIRunInEmulator(): boolean {
11+
return false;
12+
}
13+
14+
static denyDebugger() {
15+
return false;
16+
}
17+
18+
static amIReverseEngineered(): boolean {
19+
return false;
20+
}
21+
22+
static amIProxied(): boolean {
23+
return false;
24+
}
25+
26+
// @ts-ignore
27+
static amIRuntimeHookedWithDyldWhiteListDetectionClassSelectorIsClassMethod(dyldWhiteList: Array<unknown>, detectionClass: any, selector: string, isClassMethod: boolean): boolean {
28+
return false;
29+
}
30+
31+
// @ts-ignore
32+
static amITampered(checks: Array<unknown>): Array<unknown> {
33+
return [];
34+
}
35+
36+
}

packages/ios-security/index.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { IosSecurityCommon } from './common';
2-
3-
export declare class IosSecurity extends IosSecurityCommon {
1+
export declare class IOSSecurity {
42
static amIJailbroken():boolean;
53

64
static amIDebugged(): boolean;
@@ -17,5 +15,5 @@ export declare class IosSecurity extends IosSecurityCommon {
1715
static amIRuntimeHookedWithDyldWhiteListDetectionClassSelectorIsClassMethod(dyldWhiteList: NSArray<string> | string[], detectionClass: typeof NSObject, selector: string, isClassMethod: boolean): boolean;
1816

1917
// @ts-ignore
20-
static amITampered(checks: NSArray<FileIntegrityCheckFacade> | FileIntegrityCheckFacade[]): NSArray<any>;
18+
static amITampered(checks: NSArray<any> | any[]): NSArray<any>;
2119
}

packages/ios-security/index.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare var SecurityFacade;
22

3-
export class IosSecurity {
3+
export class IOSSecurity {
44
static amIJailbroken(): boolean {
55
return SecurityFacade.amIJailbroken();
66
}
@@ -31,7 +31,7 @@ export class IosSecurity {
3131
}
3232

3333
// @ts-ignore
34-
static amITampered(checks: NSArray<FileIntegrityCheckFacade> | FileIntegrityCheckFacade[]): NSArray<any> {
34+
static amITampered(checks: NSArray<any> | any[]): NSArray<any> {
3535
return SecurityFacade.amITampered(checks);
3636
}
3737

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
echo "Set exit on simple errors"
4+
set -e
5+
6+
echo "Use dumb terminal"
7+
export TERM=dumb
8+
9+
rm -rf ../platforms/ios || true
10+
mkdir -p ../platforms/ios
11+
12+
echo "Build iOS"
13+
14+
cd ios
15+
./build.sh
16+
cd ..
17+
echo "Copy ios/build/*.xcframework platforms/ios"
18+
19+
cp -R ios/build/NativeScriptIOSSecurity.xcframework ../platforms/ios
20+
21+
# cp ios/build/*.framework.dSYM.zip dist/package/platforms/ios

0 commit comments

Comments
 (0)