mirror of
https://github.com/nab138/isideload.git
synced 2026-03-02 14:36:16 +01:00
Impliment provisioning profiles and assigning app groups
This commit is contained in:
@@ -38,4 +38,3 @@ hmac = "0.12.1"
|
||||
cbc = { version = "0.1.2", features = ["std"] }
|
||||
aes = "0.8.4"
|
||||
aes-gcm = "0.10.3"
|
||||
serde_bytes = "0.11.19"
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
use crate::{
|
||||
dev::{
|
||||
developer_session::DeveloperSession,
|
||||
device_type::{DeveloperDeviceType, dev_url},
|
||||
teams::DeveloperTeam,
|
||||
},
|
||||
util::plist::SensitivePlistAttachment,
|
||||
use crate::dev::{
|
||||
app_ids::AppId,
|
||||
developer_session::DeveloperSession,
|
||||
device_type::{DeveloperDeviceType, dev_url},
|
||||
teams::DeveloperTeam,
|
||||
};
|
||||
use plist::{Date, Dictionary, Value};
|
||||
use plist_macro::plist;
|
||||
use rootcause::prelude::*;
|
||||
use serde::Deserialize;
|
||||
@@ -70,6 +67,30 @@ pub trait AppGroupsApi {
|
||||
|
||||
Ok(app_group)
|
||||
}
|
||||
|
||||
async fn assign_app_group(
|
||||
&self,
|
||||
team: &DeveloperTeam,
|
||||
app_group: &AppGroup,
|
||||
app_id: &AppId,
|
||||
device_type: impl Into<Option<DeveloperDeviceType>> + Send,
|
||||
) -> Result<(), Report> {
|
||||
let body = plist!(dict {
|
||||
"teamId": &team.team_id,
|
||||
"applicationGroups": &app_group.application_group,
|
||||
"appIdId": &app_id.app_id_id,
|
||||
});
|
||||
|
||||
self.developer_session()
|
||||
.send_dev_request_no_response(
|
||||
&dev_url("assignApplicationGroupToAppId", device_type),
|
||||
body,
|
||||
)
|
||||
.await
|
||||
.context("Failed to assign developer app group")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl AppGroupsApi for DeveloperSession<'_> {
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{
|
||||
},
|
||||
util::plist::SensitivePlistAttachment,
|
||||
};
|
||||
use plist::{Date, Dictionary, Value};
|
||||
use plist::{Data, Date, Dictionary, Value};
|
||||
use plist_macro::plist;
|
||||
use rootcause::prelude::*;
|
||||
use serde::Deserialize;
|
||||
@@ -29,6 +29,27 @@ pub struct ListAppIdsResponse {
|
||||
pub available_quantity: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Profile {
|
||||
pub encoded_profile: Data,
|
||||
pub filename: String,
|
||||
pub provisioning_profile_id: String,
|
||||
pub name: String,
|
||||
pub status: String,
|
||||
pub r#type: String,
|
||||
pub distribution_method: String,
|
||||
pub pro_pro_platorm: Option<String>,
|
||||
#[serde(rename = "UUID")]
|
||||
pub uuid: String,
|
||||
pub date_expire: Date,
|
||||
pub managing_app: Option<String>,
|
||||
pub app_id_id: String,
|
||||
pub is_template_profile: bool,
|
||||
pub is_team_profile: Option<bool>,
|
||||
pub is_free_provisioning_profile: Option<bool>,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait AppIdsApi {
|
||||
fn developer_session(&self) -> &DeveloperSession<'_>;
|
||||
@@ -89,7 +110,7 @@ pub trait AppIdsApi {
|
||||
&self,
|
||||
team: &DeveloperTeam,
|
||||
app_id: &AppId,
|
||||
features: &Dictionary,
|
||||
features: Dictionary,
|
||||
device_type: impl Into<Option<DeveloperDeviceType>> + Send,
|
||||
) -> Result<AppId, Report> {
|
||||
let mut body = plist!(dict {
|
||||
@@ -126,6 +147,30 @@ pub trait AppIdsApi {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn download_team_provisioning_profile(
|
||||
&self,
|
||||
team: &DeveloperTeam,
|
||||
app_id: &AppId,
|
||||
device_type: impl Into<Option<DeveloperDeviceType>> + Send,
|
||||
) -> Result<Profile, Report> {
|
||||
let body = plist!(dict {
|
||||
"teamId": &team.team_id,
|
||||
"appIdId": &app_id.app_id_id,
|
||||
});
|
||||
|
||||
let response: Profile = self
|
||||
.developer_session()
|
||||
.send_dev_request(
|
||||
&dev_url("downloadTeamProvisioningProfile", device_type),
|
||||
body,
|
||||
"provisioningProfile",
|
||||
)
|
||||
.await
|
||||
.context("Failed to download provisioning profile")?;
|
||||
|
||||
Ok(response)
|
||||
}
|
||||
}
|
||||
|
||||
impl AppIdsApi for DeveloperSession<'_> {
|
||||
|
||||
@@ -3,10 +3,10 @@ use crate::dev::{
|
||||
device_type::{DeveloperDeviceType, dev_url},
|
||||
teams::DeveloperTeam,
|
||||
};
|
||||
use plist::Data;
|
||||
use plist_macro::plist;
|
||||
use rootcause::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use serde_bytes::ByteBuf;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
@@ -16,7 +16,7 @@ pub struct DevelopmentCertificate {
|
||||
pub certificate_id: Option<String>,
|
||||
pub serial_number: Option<String>,
|
||||
pub machine_id: Option<String>,
|
||||
pub cert_content: Option<ByteBuf>,
|
||||
pub cert_content: Option<Data>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
@@ -38,7 +38,7 @@ impl std::fmt::Debug for DevelopmentCertificate {
|
||||
&self
|
||||
.cert_content
|
||||
.as_ref()
|
||||
.map(|c| format!("Some([{} bytes])", c.len()))
|
||||
.map(|c| format!("Some([{} bytes])", c.as_ref().len()))
|
||||
.unwrap_or("None".to_string()),
|
||||
)
|
||||
.finish()
|
||||
|
||||
Reference in New Issue
Block a user