# Macos Notarization

> macOS 應用公證指南。當用戶需要打包 macOS 應用、進行公證（notarization）、或建立 DMG 時使用此 skill。包含 API 金鑰資訊和完整的公證流程。

- **Type:** Skill
- **Install:** `agentstack add skill-iml1s-flutter-claude-skills-macos-notarization`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ImL1s](https://agentstack.voostack.com/s/iml1s)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ImL1s](https://github.com/ImL1s)
- **Source:** https://github.com/ImL1s/flutter-claude-skills/tree/main/skills/macos-notarization

## Install

```sh
agentstack add skill-iml1s-flutter-claude-skills-macos-notarization
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# macOS 應用公證指南

## 公證憑證資訊

### Your Project

| 項目 | 值 |
|------|-----|
| **帳號名稱** | `` |
| **Issuer ID** | `` |
| **Key ID** | `` |
| **私鑰位置** | `~/.appstoreconnect/private_keys/AuthKey_.p8` |
| **鑰匙圈憑證名稱** | `` |
| **Team ID** | `` |
| **Bundle ID** | `com.example.yourapp` |

> 在 App Store Connect → Users and Access → Keys 創建 ASC API key 拿到 Issuer/Key ID 和下載 `.p8` 私鑰。

---

## 完整公證流程

### 1. 打包 Release 版本

```bash
cd /path/to/your/macos/app

# 清理並打包
fvm flutter clean && fvm flutter pub get
fvm flutter build macos --release --dart-define=environment=103
```

輸出位置：`build/macos/Build/Products/Release/.app`

### 2. 建立 DMG

**方法一：使用 flutter_distributor**
```bash
fvm dart pub global run flutter_distributor:flutter_distributor release \
  --name prod --jobs macos-dmg-release
```

**方法二：手動建立**
```bash
create-dmg --volname "" \
  --icon-size 140 \
  --icon ".app" 162 269 \
  --app-drop-link 640 269 \
  ".dmg" \
  "build/macos/Build/Products/Release/.app"
```

### 3. 提交公證

```bash
xcrun notarytool submit .dmg \
  --keychain-profile "YOUR_PROFILE_NAME" \
  --wait
```

### 4. 裝訂票據 (Staple)

```bash
xcrun stapler staple .dmg
```

### 5. 驗證

```bash
xcrun stapler validate .dmg
spctl -a -t open --context context:primary-signature -v .dmg
```

---

## 常用指令

### 查看公證歷史
```bash
xcrun notarytool history --keychain-profile "YOUR_PROFILE_NAME"
```

### 查看公證詳情（如果失敗）
```bash
xcrun notarytool log  --keychain-profile "YOUR_PROFILE_NAME"
```

### 重新儲存憑證（如果遺失）
```bash
xcrun notarytool store-credentials "YOUR_PROFILE_NAME" \
  --key ~/.appstoreconnect/private_keys/AuthKey_.p8 \
  --key-id "" \
  --issuer ""
```

---

## 注意事項

1. **.p8 私鑰只能下載一次**，請妥善保管 `~/.appstoreconnect/private_keys/` 目錄
2. **Hardened Runtime** 必須啟用（專案已配置）
3. **簽名身份**必須是 `Developer ID Application`
4. DMG 和 .app 都可以單獨公證，但通常公證 DMG 即可

## Related skills

- **`release-preflight`** → **`release-app`** — use macos-notarization as part of the macOS-specific release workflow. Handle notarization after preflight and before release-app submits.
- **`apple-appstore-manager`** — manage App Store metadata after notarization completes.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ImL1s](https://github.com/ImL1s)
- **Source:** [ImL1s/flutter-claude-skills](https://github.com/ImL1s/flutter-claude-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-iml1s-flutter-claude-skills-macos-notarization
- Seller: https://agentstack.voostack.com/s/iml1s
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
