Skip to content

Commit

Permalink
Code dump 2. Need to split commits into a proper history
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Jul 5, 2022
1 parent 63c3d47 commit 30252ca
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 738 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apple-codesign/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ path = "src/main.rs"
anyhow = "1.0"
aws-config = "0.13.0"
aws-sdk-s3 = "0.13.0"
aws-smithy-http = "0.43.0"
base64 = "0.13"
bcder = "0.6"
bitflags = "1.2"
Expand Down
37 changes: 37 additions & 0 deletions apple-codesign/src/app_store_connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,43 @@ pub struct SubmissionLogResponse {
pub meta: Value,
}

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Issue {
pub architecture: String,
pub code: Option<u64>,
pub doc_url: Option<String>,
pub message: String,
pub path: String,
pub severity: String,
}

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TicketContent {
pub arch: String,
pub cdhash: String,
pub digest_algorithm: String,
pub path: String,
}

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NotarizationLogs {
pub archive_filename: String,
#[serde(default)]
pub issues: Vec<Issue>,
pub job_id: String,
pub log_format_version: u64,
pub sha256: String,
pub status: SubmissionResponseStatus,
pub status_code: u64,
pub status_summary: String,
#[serde(default)]
pub ticket_contents: Vec<TicketContent>,
pub upload_date: String,
}

/// A client for App Store Connect API.
///
/// The client isn't generic. Don't get any ideas.
Expand Down
6 changes: 6 additions & 0 deletions apple-codesign/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,10 @@ pub enum AppleCodesignError {

#[error("remote signing error: {0}")]
RemoteSign(#[from] RemoteSignError),

#[error("bytestream creation error: {0}")]
AwsByteStream(#[from] aws_smithy_http::byte_stream::Error),

#[error("s3 upload error: {0}")]
AwsS3Error(#[from] aws_sdk_s3::Error),
}
1 change: 0 additions & 1 deletion apple-codesign/src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use {
item::{ItemClass, ItemSearchOptions, Reference, SearchResult},
key::{Algorithm as KeychainAlgorithm, SecKey},
os::macos::{
encrypt_transform::{Builder as EncryptBuilder, Padding},
item::ItemSearchOptionsExt,
keychain::{SecKeychain, SecPreferencesDomain},
},
Expand Down
31 changes: 2 additions & 29 deletions apple-codesign/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1686,32 +1686,6 @@ fn command_extract(args: &ArgMatches) -> Result<(), AppleCodesignError> {
Ok(())
}

fn command_find_transporter() -> Result<(), AppleCodesignError> {
if let Some(path) = crate::notarization::find_transporter_exe() {
println!("{}", path.display())
} else {
indoc::eprintdoc! {"
Apple Transporter not found.
This executable is needed to perform notarization.
Instructions for installing the application are available at
https://help.apple.com/itc/transporteruserguide/#/apdAbeb95d60
We looked in PATH and in common install locations but could not find
transporter.
To force usage of a specific executable, set the {env}
environment variable to the path of the executable to use.
",
env=crate::notarization::TRANSPORTER_PATH_ENV_VARIABLE
};
std::process::exit(1);
}

Ok(())
}

fn command_generate_certificate_signing_request(
args: &ArgMatches,
) -> Result<(), AppleCodesignError> {
Expand Down Expand Up @@ -1941,12 +1915,12 @@ fn command_notarize(args: &ArgMatches) -> Result<(), AppleCodesignError> {

if staple {
match upload {
crate::notarization::NotarizationUpload::UploadId(_) | crate::notarization::NotarizationUpload::UploadIdNotary(_) => {
crate::notarization::NotarizationUpload::UploadId(_) => {
panic!(
"NotarizationUpload::UploadId should not be returned if we waited successfully"
);
}
crate::notarization::NotarizationUpload::DevIdResponse(_) | crate::notarization::NotarizationUpload::NotaryResponse(_) => {
crate::notarization::NotarizationUpload::NotaryResponse(_) => {
let stapler = crate::stapling::Stapler::new()?;
stapler.staple_path(&path)?;
}
Expand Down Expand Up @@ -2984,7 +2958,6 @@ fn main_impl() -> Result<(), AppleCodesignError> {
Some(("compute-code-hashes", args)) => command_compute_code_hashes(args),
Some(("diff-signatures", args)) => command_diff_signatures(args),
Some(("extract", args)) => command_extract(args),
Some(("find-transporter", _)) => command_find_transporter(),
Some(("generate-certificate-signing-request", args)) => {
command_generate_certificate_signing_request(args)
}
Expand Down
Loading

0 comments on commit 30252ca

Please sign in to comment.