2022 Privacy & Security
WWDC22 · 9 min · Privacy & Security
What’s new in notarization for Mac apps
Notarization works in tandem with macOS to help people safely download software for their Mac outside of the App Store. Learn about the required transition from altool to notarytool and how the Xcode GUI can help you achieve better overall performance when notarizing your app. We’ll also share information about APIs for interacting with the Notary service from any internet-connected machine.
Watch at developer.apple.com ↗Code shown on screen · 2 snippets
REST API: upload file for notarization
# Upload file for notarization
def upload_file(token, filepath, sha256):
data = { "sha256": sha256, "submissionName": os.path.basename(filepath) }
resp = requests.post(
"https://appstoreconnect.apple.com/notary/v2/submissions",
json=data,
headers={"Authorization": "Bearer " + token})
output = resp.json()
aws_info = output["data"]["attributes"]
submission_id = output["data"]["id"]
client = boto3.client(
"s3",
aws_access_key_id=aws_info["awsAccessKeyId"],
aws_secret_access_key=aws_info["awsSecretAccessKey"],
aws_session_token=aws_info["awsSessionToken"])
client.upload_file(filepath, aws_info["bucket"], aws_info["object"]) REST API: wait for completion
# Wait for completion
def watch_upload(submission_id, token):
while True:
resp = requests.get(
"https://appstoreconnect.apple.com/notary/v2/submissions/" + submission_id,
headers={"Authorization": "Bearer " + token})
output = resp.json()
current_status = output["data"]["attributes"]["status"]
if current_status != "In Progress":
return current_status # For example: Accepted or Invalid
time.sleep(30) # Allow time for submission to progress Resources
Related sessions
-
16 min -
17 min -
6 min -
22 min -
6 min -
34 min