Skip to content

Commit

Permalink
Add support to send your public key to the vehicle
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasman committed Mar 7, 2024
1 parent 4bb677c commit 70a7c88
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 38 deletions.
18 changes: 16 additions & 2 deletions Sources/TeslaSwift/TeslaSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public extension TeslaSwift {
This is not to be used in client apps, but only to help register your Tesla app

- parameter domain: The domain where your public key is hosted
- returns: The asociated public key with this app and a few more details about the app
- returns: The associated public key with this app and a few more details about the app
*/
func registerApp(domain: String) async throws -> PartnerResponse {

Expand Down Expand Up @@ -261,6 +261,20 @@ extension TeslaSwift {
TeslaWebLoginViewController.removeCookies()
#endif
}

/**
Create a URL to send your public key to vehicle.
Old Model S and X do not need to call this function
Your website must include the pem file in doman/.well-known/appspecific/com.tesla.3p.public-key.pem

Call this function after the user has authenticated then use UIApplication.shared.open(url)

- parameter domain: The domain where your public key is hosted
- returns: The URL for your app to open to register the public key in the vehicle
*/
public func urlToSendPublicKeyToVehicle(domain: String) -> URL? {
return URL(string: "https://tesla.com/_ak/\(domain)")
}
}

//MARK: User APIs
Expand All @@ -277,7 +291,7 @@ extension TeslaSwift {
}

/**
Fetchs the uer region
Fetchs the user region

- returns: the user region
*/
Expand Down
Loading

0 comments on commit 70a7c88

Please sign in to comment.