bark-apns
Direct APNs client for sending Bark notifications.
This crate talks to APNs directly with an iOS device token, bypassing the Bark server entirely. Messages can also be sent with Bark-compatible encryption, so notification content stays private while delivery remains fast and direct.
Key Features
- ✨ First-class
serdepayloads: Uses strongly typed payload models andserdeserialization throughout, avoiding brittle hand-built JSON. - 🛡️ Correct Bark encryption semantics: Validates algorithm, mode, key, and IV up front, supports all Bark AES options, and serializes encrypted pushes exactly as Bark expects.
- 🚀 Lean, direct APNs delivery: Sends straight to APNs with no third-party relay or self-hosted backend in the path, keeping delivery fast, simple, and private.
Usage
Send a simple message
use ;
Send a markdown message
use ;
[!NOTE] Bark parses Markdown with Apple's Swift Markdown package and its own renderer. It supports paragraphs, headings, block quotes, bold, italic, strikethrough, inline code, code blocks, links, images, ordered and unordered lists, nested lists, task-list checkboxes, soft breaks, and hard line breaks. In notification banners, Bark uses the rendered plain-text body and collapses repeated blank lines, so styling such as bold, italic, link color, and code font is not preserved there.
Send an encrypted message
use ;
The payload is built with serde, not string concatenation. Encrypted pushes place
Bark request fields in the encrypted ciphertext JSON and leave only ciphertext
and iv in APNs custom user info.
Error Handling
Library APIs return bark_apns::Result<T>, a typed Result<T, bark_apns::Error>.
Applications can still use anyhow::Result at their own boundary:
License
This project is licensed under the MIT license.