Documentation / Developers

SDK download & demo app

Download the MimiKey Swift SDK and demo app, run the demo from source on iOS and macOS, and walk through authorize, pick, create, update and revoke screen by screen.

Downloads

FileContentsRequirements
mimikey-swift-sdk-0.1.0.zipThe MimiKeySDK Swift package source and the demo app source in Examples/MimiKeyDemoXcode 15+, iOS 17 / macOS 14
MimiKey-Demo-0.1.0-mac.zipThe prebuilt demo app for MacmacOS 14+, with MimiKey for Mac installed

Both downloads are beta releases (0.1.0). The demo app is for demonstration and integration testing only; use test items.

Note If macOS says it cannot verify the developer when you open the prebuilt demo, right-click the app in Finder and choose Open.

The MimiKey apps are currently in Chinese. In the walkthrough below, on-screen labels are given in Chinese with an English translation.

Add the SDK to your project

  1. Unzip mimikey-swift-sdk-0.1.0.zip to get the MimiKeySDK and Examples folders.
  2. In Xcode, choose File → Add Package Dependencies…, click Add Local… in the lower-left corner, and select the MimiKeySDK folder.
  3. Add the MimiKeySDK product to your app target.

For Info.plist, callbacks and the API, continue with the Swift SDK guide.

Run the demo from source

The demo is a single SwiftUI project for iOS and macOS, described with XcodeGen in Examples/MimiKeyDemo/project.yml. It references the SDK package by relative path, so keep the unzipped folder layout intact.

brew install xcodegen
cd Examples/MimiKeyDemo
xcodegen generate
open MimiKeyDemo.xcodeproj
SettingValue
Bundle IDcom.tminos.mimikey.demo
Redirect URLmimikeydemo://mimikey/callback
LSApplicationQueriesSchemesmimikey
Mac entitlementsApp Sandbox plus outgoing network connections (com.apple.security.network.client)

macOS: select the MimiKeyDemo scheme and My Mac, then run. The project signs locally (ad hoc) by default, so no developer account is needed.

iOS: under Signing & Capabilities for the target, choose your Team (change the bundle ID prefix to your own if it conflicts), then run on a physical device with MimiKey installed. The iOS Simulator usually has no MimiKey, and the demo will report that MimiKey is not installed.

To check that it compiles from the command line:

xcodebuild -project MimiKeyDemo.xcodeproj -scheme MimiKeyDemo \
  -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO build

The demo screen

The demo is a single form with six sections, top to bottom:

SectionContents
设置 (Settings)服务器 (Server, defaults to https://password.tminos.com), client_id(pmc_…), and the read-only 回调 (Callback) URL
授权 (Authorization)Before authorizing, an 授权 (Authorize) button. Afterwards: grant, 审批钥指纹 (approval-key fingerprint), 库 (vaults), and 撤销授权 (Revoke authorization)
选一个条目 (Pick an item)提示网址(可空)(hint URL, optional) and a 选一个条目 (Pick an item) button. After a pick: title, username, password (toggle with 显示 / 隐藏, Show / Hide), URL, and kind / revision
新建(登录) (Create login)标题 (Title), 网址 (URL), 用户名提示 (Username hint) and a 新建 (Create) button. The password is typed on MimiKey's safety card; the demo never collects it
修改密码(对已选条目) (Change password of the picked item)库 ID (Vault ID), 新密码 (New password) and a 修改密码 (Change password) button
状态 (Status)The result of the last operation

While waiting for MimiKey, an overlay appears in the middle of the window with the waiting message, the expiry time, and two buttons: 重试(再次打开 MimiKey)(Retry — reopen MimiKey) and 取消 (Cancel).

Walkthrough

The steps below use a Mac. On iPhone they are the same, except that MimiKey and the demo switch full screen.

1. Register a public client

  1. Open MimiKey for Mac, sign in, and click 开发者接入 (Developer access) in the sidebar.
  2. Click 新建应用 (New app) and fill in:
    • Name: for example "MimiKey Demo";
    • Type: 公开客户端 · App 内 SDK,无 secret (Public client — in-app SDK, no secret);
    • Platforms: check iOS and macOS;
    • Redirect URL: mimikeydemo://mimikey/callback.
  3. Click 登记 (Register) and copy the client_id (pmc_…) it shows.

2. Fill in settings

Open the demo and paste the client_id into the Settings section. Leave Server at its default to use the production service.

3. Authorize

  1. In the Authorization section, click 授权 (Authorize). The demo shows the overlay "等你在 MimiKey 里确认授权" (waiting for you to confirm in MimiKey) and switches to MimiKey.
  2. If MimiKey is locked, unlock it with Touch ID / Face ID or your master password.
  3. MimiKey shows the consent card: the app name, the four "what it will be able to do" lines, the vaults to grant (your personal vault is checked by default), the approval policy (Ask every time by default) and the approval-key fingerprint.
  4. Click 允许 (Allow). MimiKey opens mimikeydemo://mimikey/callback?mk=authorize&code=…&state=…, and the demo returns to the front and exchanges the code for tokens.

Expected result: Status reads 已授权:grant 1a2b3c4d…,审批钥指纹 … (Authorized: grant …, approval-key fingerprint …). The Authorization section shows the grant, the fingerprint (identical to the one on the consent card) and the granted vault names.

4. Pick an item

  1. In the Pick section, keep or edit the hint URL and click 选一个条目 (Pick an item). The overlay reads "等你在 MimiKey 里选一个条目" (waiting for you to pick an item).
  2. MimiKey shows the pick card, titled "MimiKey Demo 请你选一个条目" (MimiKey Demo wants you to pick an item). Candidates are ordered by the hint URL and searchable; passwords are not shown in the list.
  3. Select an item and click 用这条 (Use this item). MimiKey opens …?mk=request&request_id=…&state=…&status=completed.

Expected result: Status reads 已拿到『Example Bank』(修订 1)(Received "Example Bank", revision 1). The section shows the title, username, a masked password (click 显示 to reveal), the URL and "login / 1". The Vault ID field in the Change password section is filled with the grant's first vault.

5. Create

  1. In the Create section, enter a title, URL and optional username hint, then click 新建 (Create). The overlay reads "等你在 MimiKey 的安全卡里填写并保存" (waiting for you to fill in and save the safety card).
  2. MimiKey shows the safety card: a login edit form prefilled with your title, URL and username, with an empty password. At the bottom you can choose which vault to save to.
  3. Type a password in MimiKey and click 保存并用于本次任务 (Save and use for this task).

Expected result: If you saved into a granted vault, Status reads 已新建并返回『…』 (Created and returned "…") and the Pick section shows the new item. If you chose a vault outside the grant on the card, Status reads 已保存到授权范围之外的库,本次拿不到明文 (Saved to a vault outside the grant; no plaintext for this task).

6. Change the password

  1. Complete step 4 or 5 first, so the Pick section holds a picked item.
  2. Make sure Vault ID is the vault that contains the item, enter a new password, and click 修改密码 (Change password). The overlay reads "等你在 MimiKey 里确认修改" (waiting for you to confirm the change).
  3. MimiKey shows the update card, titled "MimiKey Demo 想修改『…』" (MimiKey Demo wants to change "…"), listing an 原 (old) and 新 (new) row for each field (passwords masked, with 显示 to reveal) and the current revision.
  4. Click 保存修改 (Save changes).

Expected result: Status reads 已修改,新修订 2 (Changed, new revision 2) and the picked item is cleared. The demo never receives the updated plaintext; pick the item again if you need it.

7. Revoke

In the Authorization section, click 撤销授权 (Revoke authorization). The demo calls the revoke endpoint and wipes its keychain.

Expected result: Status reads 已撤销 (Revoked) and the Authorization section returns to its unauthorized state. In MimiKey, the grant no longer appears as active under 第三方授权 (Third-party access).

Callbacks and status

ActionCallback MimiKey opensDemo shows
Authorization succeedsmimikeydemo://mimikey/callback?mk=authorize&code=…&state=…已授权:grant …, 审批钥指纹 …
Authorization declined…?mk=authorize&error=access_denied&state=…Alert: 你在 MimiKey 里拒绝了这次请求。(You declined this request in MimiKey.)
Request completed…?mk=request&request_id=…&state=…&status=completed已拿到 / 已新建 / 已修改 … (Received / Created / Changed …)
Request declined…&status=deniedAlert: 你在 MimiKey 里拒绝了这次请求。
Request expired…&status=expiredAlert: 等待超时,请求已过期。可以重试。(Timed out; the request expired. You can try again.)
You clicked 取消 (Cancel)None授权:已取消 (Authorize: cancelled), and similar

Callbacks carry only IDs and status. The actual result is fetched by the SDK with a signed request and opened with the seal private key on the device.

Troubleshooting

SymptomCauseFix
Alert 请先填写设置 (Fill in settings first)client_id or server is emptyFill in the Settings section
Alert 未安装 MimiKey (MimiKey not installed) with a 去下载 (Download) buttonMimiKey is not on the device (notInstalled), typical on the iOS SimulatorInstall MimiKey, or use a physical device or a Mac
Alert 协议错误:invalid_request (Protocol error: invalid_request)MimiKey rejected the deep link: the client_id does not exist or is disabled, or the registered redirect URL is not mimikeydemo://mimikey/callbackCheck the client_id and redirect URL under Developer access; they must match exactly
Alert 请先在 MimiKey 里登录账号。(Sign in to MimiKey first.)MimiKey is not signed in (notSignedIn)Sign in to MimiKey and try again
The overlay never goes awayYou switched back to the demo without acting in MimiKeyClick Retry to return to the card, or Cancel
Alert 等待超时,请求已过期。可以重试。The request outlived its expiry (10 minutes for picks, 30 minutes for creates and updates)Start again
Alert 你在 MimiKey 里拒绝了这次请求。You declined on the card. An update also ends as declined if the item changed elsewhere while you were reviewing itPick the item again, then retry
Alert 授权已被撤销,请重新授权。(Authorization revoked; authorize again.)The grant was revoked in MimiKey, the token family was invalidated, or the integrator was disabled (revoked)Click Authorize again
Alert 尚未授权,请先点「授权」。(Not authorized yet; click Authorize first.)No grant on this device (notAuthorized)Authorize first
The update card cannot load the itemVault ID does not match the vault that contains the item (possible when several vaults are granted)Decline the change in MimiKey, enter the item's actual vault ID, and retry
Alert 协议错误:… (Protocol error: …)Another server error codeLook it up in Errors

Last updated: 2026-10-23