Configuration
To configure the SDK properly for both transfer target and source, WPTConfig
instance is needed.
Configuration must be the same on both sides of the transfer otherwise the Bluetooth connection won’t be successful.
The same configuration also needs to be implemented on Android.
Configuration items
serviceUUID
- UUID used for the Bluetooth servicecharacteristicUUID
- UUID used for the Bluetooth connectioncoder
- will provide encryption and decryption for the transfer
Coder
Currently, only one coder is available WPTAESCoder
. To configure this coder, you need to provide two byte arrays:
salt
- salt that will be mixed into the cipher. No length limitation.iv
- IV for the cipher. Needs to be 16 bytes long. Smaller IV will produce an error and longer will be truncated.
Example configuration
let config = WPTConfig(
serviceUUID: UUID(uuidString: "21f8190c-e4bc-11ed-b5ea-0242ac120001")!,
characteristicUUID: UUID(uuidString: "21f8190c-e4bc-11ed-b5ea-0242ac120002")!,
coder: WPTAESCoder(
salt: "MyApplicationDemoSalt!".data(using: .utf8)!, // static data
iv: Data(base64Encoded: "7x9ZEvEVf4IqlBxuYmzKhw==")! // 16 bytes encoded in Base64
)
)
Read next
Last updated on Jan 30, 2024 (12:32)
Edit on Github
Send Feedback