Skip to main content

Encrypted Push Notification Client for Bark / Bark加密推送通知客户端

Features / 特性

  • 支持 AES-128/192/256
  • 支持 加密策略(CBC / ECB,可自定义 GCM 等)

Installation / 安装

pip3 install bark-python

或者

git clone https://github.com/horennel/bark-python.git
python3 setup.py install

Usage / 用法示例

不使用加密
from bark_python import BarkClient

client = BarkClient(device_key="your_device_key", api_url="https://api.day.app")

# 发送推送通知
client.send_notification(
    title="🔒 Secure Title",
    body="Hello from encrypted Bark client!",
    sound="shake",
    # ... 可增加bark支持的参数
)
使用加密
from bark_python import BarkClient, CBCStrategy, ECBStrategy

client = BarkClient(device_key="your_device_key", api_url="https://api.day.app")

# 设置加密方式
client.set_encryption(
    key="1234567890abcdef",  # 默认空,AES128[16位]|AES192[24位]|AES256[32位] 字符串
    iv="abcdef1234567890",  # 默认空,CBC和ECB都为16位字符串
    strategy_cls=CBCStrategy,  # 也可以用 ECBStrategy
)

# 发送推送通知
client.send_notification(
    title="🔒 Secure Title",
    body="Hello from encrypted Bark client!",
    sound="shake"
    # ... 可增加bark支持的参数
)
自定义加密策略
from bark_python import BarkClient, EncryptionStrategy

client = BarkClient(device_key="your_device_key", api_url="https://api.day.app")


# 自定义加密策略
class MyNewStrategy(EncryptionStrategy):
    def encrypt(self, key: str, iv: str, data: str, other_params: dict) -> bytes:
        # 返回加密后的bytes数据
        pass


# 设置加密方式
client.set_encryption(
    strategy_cls=MyNewStrategy,  # 使用自定义加密策略
    other_params={"自定义参数": "自定义参数"}  # 可以添加自定义参数,用于自定义加密策略
)

# 发送推送通知
client.send_notification(
    title="🔒 Secure Title",
    body="Hello from encrypted Bark client!",
    sound="shake"
    # ... 可增加bark支持的参数
)

Credits / 致谢

Metadata

Release files for bark-python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bark-python 0.1.0
File Size Uploaded
bark_python-0.1.0.tar.gz 5.3 kB Details

Release files / bark_python-0.1.0.tar.gz

Download URL bark_python-0.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8d1b37d5ee107d2fc2f27c4b16d4ade92946445742be204327457a38f983a61f
BLAKE2b-256 checksum
How to use checksums
19e2ac85636ae5a1d5867c9115f03a178f5cc5dbc1c8931098ddd63d7f8bce08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page