Skip to content

Instantly share code, notes, and snippets.

@tompsota
Last active March 25, 2024 11:16
Show Gist options
  • Save tompsota/f2a9e70ac6497cdb0ffe10dced16c80b to your computer and use it in GitHub Desktop.
Save tompsota/f2a9e70ac6497cdb0ffe10dced16c80b to your computer and use it in GitHub Desktop.
freeRASP Cordova demo
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Wait for the deviceready event before using any of Cordova's device APIs.
// See https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady () {
// Cordova is now initialized. Have fun!
console.log(`Running cordova-${cordova.platformId}@${cordova.version}`);
const config = {
androidConfig: {
packageName: 'com.example.helloapp',
certificateHashes: ['your_signing_certificate_hash_base64']
// supportedAlternativeStores: ['storeOne', 'storeTwo'],
},
iosConfig: {
appBundleIds: 'com.example.helloapp',
appTeamId: 'your_team_ID'
},
watcherMail: 'your_email_address@example.com',
isProd: true
};
const actions = {
// Android & iOS
privilegedAccess: () => {
console.log('privilegedAccess');
},
// Android & iOS
debug: () => {
console.log('debug');
},
// Android & iOS
simulator: () => {
console.log('simulator');
},
// Android & iOS
appIntegrity: () => {
console.log('appIntegrity');
},
// Android & iOS
unofficialStore: () => {
console.log('unofficialStore');
},
// Android & iOS
hooks: () => {
console.log('hooks');
},
// Android & iOS
deviceBinding: () => {
console.log('deviceBinding');
},
// Android & iOS
secureHardwareNotAvailable: () => {
console.log('secureHardwareNotAvailable');
},
// Android & iOS
passcode: () => {
console.log('passcode');
},
// iOS only
deviceID: () => {
console.log('deviceID');
},
// Android only
overlay: () => {
console.log('overlay');
},
// Android only
obfuscationIssues: () => {
console.log('obfuscationIssues');
}
};
talsec
.start(config, actions)
.then(() => {
console.log('Talsec initialized.');
})
.catch((error) => {
console.log('Error during Talsec initialization: ', error);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment