https://github.com/xendit/xenissuing-ios
https://github.com/xendit/xenissuing-ios
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/xendit/xenissuing-ios
- Owner: xendit
- License: mit
- Created: 2022-08-02T06:49:04.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-01T15:18:33.000Z (10 months ago)
- Last Synced: 2025-10-01T17:27:45.155Z (10 months ago)
- Language: Swift
- Size: 55.7 KB
- Stars: 0
- Watchers: 9
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://github.com/apple/swift-package-manager)
# Xenissuing
The XenIssuing SDK provides a secure way to handle sensitive operations in your iOS applications. This SDK includes:
- **SecureSession**: A module that ensures encrypted communication between your application and Xendit's services.
## Prerequisites
- iOS 10.15 or later
- Swift 5.0 or later
- A public key from Xendit (Contact Xendit to obtain this)
## Usage
### Creating a Secure Session
```swift
import Xenissuing
let publicKey = """
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA... // Your RSA public key without header/footer
"""
do {
// Create secure session
let secureSession = try Xenissuing.createSecureSession(
xenditPublicKeyData: Data(base64Encoded: publicKey)!
)
// Get session ID for API authentication
let sessionId = secureSession.getSessionId().base64EncodedString()
// Important: URL encode the session ID as it will be used as a URL parameter
let allowedCharacters = CharacterSet(charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
let encodedSessionId = sessionId.addingPercentEncoding(withAllowedCharacters: allowedCharacters) ?? ""
// Use encodedSessionId in API requests
let apiUrl = "https://api.xendit.co/card_issuing/cards/{cardId}/pan?session_id=\(encodedSessionId)"
} catch {
print("Error:", error)
}
```
### Public Key Format
The public key should be:
- An RSA public key provided by Xendit
- Without the "-----BEGIN PUBLIC KEY-----" and "-----END PUBLIC KEY-----" headers
- A single continuous string (can use Swift multi-line string format for readability)
Example format:
```swift
let publicKey = """
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
"""
```
### Session ID Usage
The session ID must be URL encoded because:
- It contains base64 characters that may include '+' and '/'
- It will be used as a URL parameter in API requests
- URL encoding ensures safe transmission of the session ID in HTTP requests
Example API usage:
```swift
let apiUrl = "https://api.xendit.co/card_issuing/cards/\(cardId)/pan?session_id=\(encodedSessionId)"
```
### Decrypting Card Data
When you receive encrypted card data from Xendit's API:
```swift
do {
let decryptedData = try secureSession.decryptCardData(
secret: encryptedCardData, // Base64 encoded encrypted data
iv: initializationVector // Base64 encoded IV
)
// Process the decrypted card data
let cardInfo = String(data: decryptedData, encoding: .utf8)
} catch {
print("Decryption error:", error)
}
```
## Support
For issues, questions, or assistance, please reach out to the XenIssuing team at Xendit.
- Email: xenissuing@xendit.co
- API Documentation: https://developers.xendit.co