Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injimob 817 UUID changes #126

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions android/src/main/java/io/mosip/tuvali/verifier/GattService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import java.util.*
class GattService {
//TODO: Update UUIDs as per specification
companion object {
val IDENTIFY_REQUEST_CHAR_UUID: UUID = UUID.fromString("00002030-0000-1000-8000-00805f9b34fb")
val REQUEST_SIZE_CHAR_UUID: UUID = UUID.fromString("00002031-0000-1000-8000-00805f9b34fb")
val REQUEST_CHAR_UUID: UUID = UUID.fromString("00002032-0000-1000-8000-00805f9b34fb")
val RESPONSE_SIZE_CHAR_UUID: UUID = UUID.fromString("00002033-0000-1000-8000-00805f9b34fb")
val SUBMIT_RESPONSE_CHAR_UUID: UUID = UUID.fromString("00002034-0000-1000-8000-00805f9b34fb")
val TRANSFER_REPORT_REQUEST_CHAR_UUID: UUID = UUID.fromString("00002035-0000-1000-8000-00805f9b34fb")
val TRANSFER_REPORT_RESPONSE_CHAR_UUID: UUID = UUID.fromString("00002036-0000-1000-8000-00805f9b34fb")
val IDENTIFY_REQUEST_CHAR_UUID: UUID = UUID.fromString("00000006-5026-444A-9E0E-D6F2450F3A77")
val REQUEST_SIZE_CHAR_UUID: UUID = UUID.fromString("00000004-5026-444A-9E0E-D6F2450F3A77")
val REQUEST_CHAR_UUID: UUID = UUID.fromString("00000005-5026-444A-9E0E-D6F2450F3A77")
val RESPONSE_SIZE_CHAR_UUID: UUID = UUID.fromString("00000007-5026-444A-9E0E-D6F2450F3A77")
val SUBMIT_RESPONSE_CHAR_UUID: UUID = UUID.fromString("00000008-5026-444A-9E0E-D6F2450F3A77")
val TRANSFER_REPORT_REQUEST_CHAR_UUID: UUID = UUID.fromString("00000009-5026-444A-9E0E-D6F2450F3A77")
val TRANSFER_REPORT_RESPONSE_CHAR_UUID: UUID = UUID.fromString("0000000A-5026-444A-9E0E-D6F2450F3A77")
val VERIFICATION_STATUS_CHAR_UUID: UUID = UUID.fromString("00002037-0000-1000-8000-00805f9b34fb")
val DISCONNECT_CHAR_UUID: UUID = UUID.fromString("00002038-0000-1000-8000-00805f9b34fb")
val DISCONNECT_CHAR_UUID: UUID = UUID.fromString("0000000B-5026-444A-9E0E-D6F2450F3A77")
}

fun create(): BluetoothGattService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class VerifierBleCommunicator(
private var maxDataBytes = 20
//TODO: Update UUIDs as per specification
companion object {
val SERVICE_UUID: UUID = UUID.fromString("0000AB29-0000-1000-8000-00805f9b34fb")
val SCAN_RESPONSE_SERVICE_UUID: UUID = UUID.fromString("0000AB2A-0000-1000-8000-00805f9b34fb")
val SERVICE_UUID: UUID = UUID.fromString("00000001-0000-1000-8000-00805f9b34fb")
val SCAN_RESPONSE_SERVICE_UUID: UUID = UUID.fromString("00000002-0000-1000-8000-00805f9b34fb")
const val DISCONNECT_STATUS = 1
}

Expand Down
2 changes: 1 addition & 1 deletion ios/RNModules/RNVersionModule.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

@available(iOS 13.0, *)

@objc(VersionModule)
class VersionModule: RCTEventEmitter {
var tuvaliVersion: String = "unknown"

Expand Down
2 changes: 1 addition & 1 deletion ios/RNModules/RNWalletModule.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

@available(iOS 13.0, *)

@objc(WalletModule)
class WalletModule: RCTEventEmitter {
var wallet: WalletProtocol = Wallet()
var tuvaliVersion: String = "unknown"
Expand Down
588 changes: 588 additions & 0 deletions ios/Tuvali.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions ios/Wallet/Wallet.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Foundation
import os
public class Wallet: WalletProtocol {

class Wallet: WalletProtocol {

var bleCommunicator: WalletBleCommunicator?

public init() {
init() {
ErrorHandler.sharedInstance.setOnError(onError: self.handleError)
}

public func startConnection(_ uri: String) {
func startConnection(_ uri: String) {
print("startConnection->uri::\(uri)")
let openId4VpURI = OpenId4vpURI(uri: uri)

Expand All @@ -26,21 +26,21 @@ public class Wallet: WalletProtocol {
}
}

public func disconnect(){
func disconnect(){
bleCommunicator?.handleDestroyConnection(isSelfDisconnect: true)
bleCommunicator = nil
}

public func send(_ payload: String) {
func send(_ payload: String) {
bleCommunicator?.send(payload)
os_log(.info, ">> raw message size : %{public}d", payload.count)
}

public func subscribe( _ listener: @escaping (Event) -> Void) {
func subscribe( _ listener: @escaping (Event) -> Void) {
EventEmitter.sharedInstance.addListener(listener: listener)
}

public func unsubscribe() {
func unsubscribe() {
EventEmitter.sharedInstance.removeListeners()
}

Expand Down
7 changes: 5 additions & 2 deletions ios/Wallet/WalletBleCommunicator.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import Gzip
import os

@objc(Wallet)
@available(iOS 13.0, *)
class WalletBleCommunicator: NSObject {
Expand All @@ -18,7 +18,10 @@ class WalletBleCommunicator: NSObject {
central = Central()
}


@objc(getModuleName:withRejecter:)
func getModuleName(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
resolve(["iOS Wallet"])
}

func setAdvIdentifier(identifier: Data) {
self.advIdentifier = identifier
Expand Down
4 changes: 2 additions & 2 deletions ios/ble/Utility/BLEConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import Foundation
import CoreBluetooth

struct BLEConstants {
static let SERVICE_UUID = CBUUID(string: "0000AB29-0000-1000-8000-00805f9b34fb")
static let SCAN_RESPONSE_SERVICE_UUID = CBUUID(string: "0000AB2A-0000-1000-8000-00805f9b34fb")
static let SERVICE_UUID = CBUUID(string: "00000001-0000-1000-8000-00805f9b34fb")
static let SCAN_RESPONSE_SERVICE_UUID = CBUUID(string: "00000002-0000-1000-8000-00805f9b34fb")
static var ADV_IDENTIFIER = ""
static var verifierPublicKey: Data = Data()
static var DEFAULT_CHUNK_SIZE = 512
Expand Down
2 changes: 1 addition & 1 deletion ios/ble/Utility/TransferHandler.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import os

@available(iOS 13.0, *)
class TransferHandler {
var data: Data?
Expand Down
2 changes: 1 addition & 1 deletion ios/ble/Utility/chunker.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import os

typealias ChunkSeqIndex = Int
typealias ChunkSeqNumber = Int

Expand Down
1 change: 1 addition & 0 deletions ios/ble/central/Central.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import CoreBluetooth
import os
import React


@available(iOS 13.0, *)
Expand Down
6 changes: 3 additions & 3 deletions ios/ble/central/CentralManagerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ extension Central {
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {

let dataDict = advertisementData["kCBAdvDataServiceData"] as? [CBUUID: Any?]
if let uuidDict = dataDict, let data = uuidDict[CBUUID(string: "AB2A")], let data = data {
let scanResponseData = dataDict?[CBUUID(string: "AB2A")] as! Data
let advertisementData = dataDict?[CBUUID(string: "AB29")] as! Data
if let uuidDict = dataDict, let data = uuidDict[CBUUID(string: "00000002-0000-1000-8000-00805f9b34fb")], let data = data {
let scanResponseData = dataDict?[CBUUID(string: "00000002-0000-1000-8000-00805f9b34fb")] as! Data
let advertisementData = dataDict?[CBUUID(string: "00000001-0000-1000-8000-00805f9b34fb")] as! Data
let publicKeyData = advertisementData.subdata(in: advertisementData.count-5..<advertisementData.count) + scanResponseData
walletBleCommunicatorDelegate?.setVeriferKeyOnSameIdentifier(payload: advertisementData, publicData: publicKeyData) {
peripheral.delegate = self
Expand Down
48 changes: 24 additions & 24 deletions ios/ble/peripheral/Characteristics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,38 @@ struct CBcharatcteristic {
// TODO: Add conn status change everywhere

enum CharacteristicIds: String, CaseIterable {
case IDENTIFY_REQUEST_CHAR_UUID = "00002030-0000-1000-8000-00805f9b34fb"
case REQUEST_SIZE_CHAR_UUID = "00002031-0000-1000-8000-00805f9b34fb"
case REQUEST_CHAR_UUID = "00002032-0000-1000-8000-00805f9b34fb"
case RESPONSE_SIZE_CHAR_UUID = "00002033-0000-1000-8000-00805f9b34fb"
case SUBMIT_RESPONSE_CHAR_UUID = "00002034-0000-1000-8000-00805f9b34fb"
case TRANSFER_REPORT_REQUEST_CHAR_UUID = "00002035-0000-1000-8000-00805f9b34fb"
case TRANSFER_REPORT_RESPONSE_CHAR_UUID = "00002036-0000-1000-8000-00805f9b34fb"
case IDENTIFY_REQUEST_CHAR_UUID = "00000006-5026-444A-9E0E-D6F2450F3A77"
case REQUEST_SIZE_CHAR_UUID = "00000004-5026-444A-9E0E-D6F2450F3A77"
case REQUEST_CHAR_UUID = "00000005-5026-444A-9E0E-D6F2450F3A77"
case RESPONSE_SIZE_CHAR_UUID = "00000007-5026-444A-9E0E-D6F2450F3A77"
case SUBMIT_RESPONSE_CHAR_UUID = "00000008-5026-444A-9E0E-D6F2450F3A77"
case TRANSFER_REPORT_REQUEST_CHAR_UUID = "00000009-5026-444A-9E0E-D6F2450F3A77"
case TRANSFER_REPORT_RESPONSE_CHAR_UUID = "0000000A-5026-444A-9E0E-D6F2450F3A77"
case VERIFICATION_STATUS_CHAR_UUID = "00002037-0000-1000-8000-00805f9b34fb"
case DISCONNECT_CHAR_UUID = "00002038-0000-1000-8000-00805f9b34fb"
case DISCONNECT_CHAR_UUID = "0000000B-5026-444A-9E0E-D6F2450F3A77"
}

let characteristicsMap: [String: CharacteristicTuple] = [
"00002030-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00002031-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.read, .indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
"00002032-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.read, .indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
"00002033-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00002034-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00002035-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00002036-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
"00000006-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00000004-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.read, .indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
"00000005-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.read, .indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
"00000007-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00000008-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"00000009-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.writeWithoutResponse, .write]), permissions: CBAttributePermissions([.writeable]), value: nil),
"0000000A-5026-444A-9E0E-D6F2450F3A77": (properties: CBCharacteristicProperties([.indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
"00002037-0000-1000-8000-00805f9b34fb": (properties: CBCharacteristicProperties([.indicate]), permissions: CBAttributePermissions([.readable]), value: nil),
]

struct NetworkCharNums {
static let IDENTIFY_REQUEST_CHAR_UUID = CBUUID(string: "2030")
static let REQUEST_SIZE_CHAR_UUID = CBUUID(string: "2031")
static let REQUEST_CHAR_UUID = CBUUID(string: "2032")
static let RESPONSE_SIZE_CHAR_UUID = CBUUID(string: "2033")
static let SUBMIT_RESPONSE_CHAR_UUID = CBUUID(string: "2034")
static let TRANSFER_REPORT_REQUEST_CHAR_UUID = CBUUID(string: "2035")
static let TRANSFER_REPORT_RESPONSE_CHAR_UUID = CBUUID(string: "2036")
static let VERIFICATION_STATUS_CHAR_UUID = CBUUID(string: "2037")
static let DISCONNECT_CHAR_UUID = CBUUID(string: "2038")
static let IDENTIFY_REQUEST_CHAR_UUID = CBUUID(string: "00000006-5026-444A-9E0E-D6F2450F3A77")
static let REQUEST_SIZE_CHAR_UUID = CBUUID(string: "00000004-5026-444A-9E0E-D6F2450F3A77")
static let REQUEST_CHAR_UUID = CBUUID(string: "00000005-5026-444A-9E0E-D6F2450F3A77")
static let RESPONSE_SIZE_CHAR_UUID = CBUUID(string: "00000007-5026-444A-9E0E-D6F2450F3A77")
static let SUBMIT_RESPONSE_CHAR_UUID = CBUUID(string: "00000008-5026-444A-9E0E-D6F2450F3A77")
static let TRANSFER_REPORT_REQUEST_CHAR_UUID = CBUUID(string: "00000009-5026-444A-9E0E-D6F2450F3A77")
static let TRANSFER_REPORT_RESPONSE_CHAR_UUID = CBUUID(string: "0000000A-5026-444A-9E0E-D6F2450F3A77")
static let VERIFICATION_STATUS_CHAR_UUID = CBUUID(string: "00002037-0000-1000-8000-00805f9b34fb")
static let DISCONNECT_CHAR_UUID = CBUUID(string: "0000000B-5026-444A-9E0E-D6F2450F3A77")
}

enum NotificationEvent: String {
Expand Down
8 changes: 4 additions & 4 deletions ios/ble/peripheral/Peripheral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import CoreBluetooth
@available(iOS 13.0, *)
class Peripheral: NSObject {
private var peripheralManager: CBPeripheralManager!
static let SERVICE_UUID = CBUUID(string: "0000AB29-0000-1000-8000-00805f9b34fb")
static let SCAN_RESPONSE_SERVICE_UUID = CBUUID(string: "0000AB2A-0000-1000-8000-00805f9b34fb")

static let SERVICE_UUID = CBUUID(string: "00000001-0000-1000-8000-00805f9b34fb")
static let SCAN_RESPONSE_SERVICE_UUID = CBUUID(string: "00000002-0000-1000-8000-00805f9b34fb")

override init() {
super.init()
peripheralManager = CBPeripheralManager(delegate: self, queue: nil, options: [CBPeripheralManagerOptionShowPowerAlertKey: true])
Expand Down
2 changes: 1 addition & 1 deletion ios/common/Exception/ErrorHandler.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import os

class ErrorHandler {
public static var sharedInstance = ErrorHandler()
private var walletExceptionHandler: WalletExceptionHandler?
Expand Down
2 changes: 1 addition & 1 deletion ios/common/Exception/WalletExceptionHandler.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import os

class WalletExceptionHandler {

private var onError: ((_ message: String, _ code: String) -> Void)?
Expand Down
2 changes: 1 addition & 1 deletion ios/common/HexUtil.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import os

func hexStringToData(string: String) -> Data {
let stringArray = Array(string)
var data: Data = Data()
Expand Down
2 changes: 1 addition & 1 deletion ios/common/crc/CRC16.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import CrcSwift
import os

//CRC-16/Kermit: https://reveng.sourceforge.io/crc-catalogue/16.htm#crc.cat.crc-16-kermit
//width=16 poly=0x1021 init=0x0000 refin=true refout=true xorout=0x0000 check=0x2189 residue=0x0000 name="CRC-16/KERMIT"
//TODO: Need to identify what is check, and residue in the Kermit algorithm
Expand Down
2 changes: 1 addition & 1 deletion ios/common/events/Event.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation

public protocol Event {
protocol Event {
}
Loading