Welcome to TPObfuscatedString!

TPObfuscatedString is a powerful tool that enables you to obfuscate sensitive string data in your iOS applications. By using this library, you can protect important data such as API keys, passwords, or any other confidential information present in your app’s codebase.

Why use TPObfuscatedString?

There are several reasons why TPObfuscatedString is a great choice for protecting your sensitive string data:

  • Enhanced Security: TPObfuscatedString uses an algorithm that makes it extremely difficult for anyone to reverse engineer your obfuscated strings.
  • Flexibility: This library provides various obfuscation methods, giving you the flexibility to choose the most suitable one for your specific needs.
  • Easy to integrate: TPObfuscatedString can be easily integrated into your Xcode project as a Cocoapod.
  • Reduced Risk: By obfuscating your sensitive data, you reduce the risk of unauthorized access and potential data breaches.

Getting Started

To start using TPObfuscatedString in your iOS project, follow these steps:

Step 1: Install TPObfuscatedString

Open your terminal and navigate to your project’s directory. Run the following command to install TPObfuscatedString using Cocoapods:

pod ‘TPObfuscatedString’

Step 2: Import TPObfuscatedString

In your Xcode project, open the file where you want to use TPObfuscatedString and import the library:

import TPObfuscatedString

Step 3: Initialize TPObfuscatedString

Create an instance of TPObfuscatedString by calling the initializer method. Pass your sensitive string as the parameter:

let obfuscatedString = TPObfuscatedString(“your_sensitive_string”)

Now, the value of obfuscatedString will be obfuscated, and it can be utilized securely in your app.

Step 4: Retrieve the Obfuscated String

To retrieve the original string from the obfuscated form, simply access the unobfuscatedString property:

let originalString = obfuscatedString.unobfuscatedString

Step 5: Finishing Up

Remember to handle the obfuscated string and the original string securely throughout your application. Avoid logging them, hardcoding them within your code, or transmitting them without proper encryption.

Advanced Usage

TPObfuscatedString provides various customization options and advanced features to cater to more complex use cases:

Additional Obfuscation Methods

By default, TPObfuscatedString uses a built-in obfuscation method. However, you can choose from different obfuscation methods available:

  • Custom Key: Specify a custom key to further enhance the obfuscation process.
  • Encryption: Encrypt the obfuscated string using a custom encryption algorithm.

To utilize these methods, simply pass the desired options as parameters when creating the instance of TPObfuscatedString.

let obfuscatedString = TPObfuscatedString(“your_sensitive_string”, obfuscationMethod: .customKey(“your_custom_key”))

Integration with Keychain

TPObfuscatedString can also directly integrate with iOS Keychain for enhanced security. This feature allows you to store the obfuscated string securely in the device’s Keychain and retrieve it when needed.

To integrate with Keychain:

// Store the obfuscated string in the Keychain obfuscatedString.storeInKeychain(accessibility: .whenUnlocked, serviceName: “YourServiceName”) // Retrieve the obfuscated string from Keychain let obfuscatedStringFromKeychain = TPObfuscatedString.fromKeychain(serviceName: “YourServiceName”)


Using TPObfuscatedString ensures the protection and confidentiality of your sensitive strings within your iOS application. By obfuscating important data, you reduce the risk of unauthorized access and potential data breaches. So, don’t wait any longer – start securing your strings today!