Skip to main content
public func recoverPrivateKeys(addressInfos: [AddressInfo]) throws -> [PrivateKeyInfo]
let addressInfos: [AddressInfo] = [
    AddressInfo(bip32Path: "m/44/1/1/0/0", pubKey: "xpub6FRrW2AzsDQcVQPNCCQgiB7xSQ9UseQfrRCJdD9qjWswrNBmY1MysLdMYxpWbB1mnGJTwLCZWCfA4ko2kQNN37CPSzidD1c9aZCBXjTzfQn")
    AddressInfo(bip32Path: "m/44/1/1/0/1", pubKey: "xpub6FRrW2AzsDQcZahYm2GgsDz7VtqgkvNwR58boDejvwSuCYZ2ZRVvqP6Gaqef6hMGxKtkvj3PfcRxagKSycuh6XX7kJ3Bzc2vUrEAA4at5Jc")
]

do {
    let privateKeyInfos = try recoverKey?.recoverPrivateKeys(addressInfos: addressInfos)
    if let privateKeyInfos = privateKeyInfos {
        for privateKeyInfo in privateKeyInfos {
            print("Private Key Info: \(privateKeyInfo)")
        }
    } else {
        print("Failed to recover private keys.")
    }
} catch {
    print("Error: \(error)")
}

Parameters

addressInfos
object[]
A list of address information objects, each containing the BIP32 path and the optional root extended public key, required to recover the corresponding private keys.

Response

privateKeyInfos
object[]
The list of objects containing the recovered private keys and their corresponding addresses.