mirror of
https://github.com/nab138/isideload.git
synced 2026-03-02 22:46:15 +01:00
Add list development certs to dev session api
This commit is contained in:
@@ -37,4 +37,5 @@ pbkdf2 = "0.12.2"
|
||||
hmac = "0.12.1"
|
||||
cbc = { version = "0.1.2", features = ["std"] }
|
||||
aes = "0.8.4"
|
||||
aes-gcm = "0.10.3"
|
||||
aes-gcm = "0.10.3"
|
||||
serde_bytes = "0.11.19"
|
||||
|
||||
@@ -14,7 +14,8 @@ use crate::{
|
||||
dev::structures::{
|
||||
DeveloperDevice,
|
||||
DeveloperDeviceType::{self, *},
|
||||
DeveloperTeam, ListDevicesResponse, ListTeamsResponse,
|
||||
DeveloperTeam, DevelopmentCertificate, ListCertificatesResponse, ListDevicesResponse,
|
||||
ListTeamsResponse,
|
||||
},
|
||||
util::plist::PlistDataExtract,
|
||||
};
|
||||
@@ -136,6 +137,30 @@ impl<'a> DeveloperSession<'a> {
|
||||
|
||||
Ok(response.devices)
|
||||
}
|
||||
|
||||
pub async fn list_all_development_certs(
|
||||
&self,
|
||||
team: &DeveloperTeam,
|
||||
device_type: impl Into<Option<DeveloperDeviceType>>,
|
||||
) -> Result<Vec<DevelopmentCertificate>, Report> {
|
||||
let body = plist!(dict {
|
||||
"teamId": &team.team_id,
|
||||
});
|
||||
|
||||
let response: ListCertificatesResponse = self
|
||||
.send_developer_request(&dev_url("listAllDevelopmentCerts", device_type), body)
|
||||
.await
|
||||
.context("Failed to list development certificates")?;
|
||||
|
||||
if response.result_code != 0 {
|
||||
warn!(
|
||||
"Non-zero list development certs response code: {}",
|
||||
response.result_code
|
||||
)
|
||||
};
|
||||
|
||||
Ok(response.certificates)
|
||||
}
|
||||
}
|
||||
|
||||
fn dev_url(endpoint: &str, device_type: impl Into<Option<DeveloperDeviceType>>) -> String {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use serde::Deserialize;
|
||||
use serde_bytes::ByteBuf;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DeveloperDeviceType {
|
||||
@@ -50,3 +51,20 @@ pub struct ListDevicesResponse {
|
||||
pub devices: Vec<DeveloperDevice>,
|
||||
pub result_code: i64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DevelopmentCertificate {
|
||||
pub name: String,
|
||||
pub certificate_id: String,
|
||||
pub serial_number: Option<String>,
|
||||
pub machine_id: Option<String>,
|
||||
pub cert_content: Option<ByteBuf>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ListCertificatesResponse {
|
||||
pub certificates: Vec<DevelopmentCertificate>,
|
||||
pub result_code: i64,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user