| Crates.io | bark-dev |
| lib.rs | bark-dev |
| version | 0.1.9 |
| created_at | 2025-02-14 04:32:59.100488+00 |
| updated_at | 2025-02-20 06:55:17.936128+00 |
| description | This a library for the bark(receive notify on IOS devices) |
| homepage | |
| repository | https://github.com/66f94eae/bark-dev |
| max_upload_size | |
| id | 1555330 |
| size | 102,170 |
This library is for someone developed in Rust for sending push notifications to iOS devices which has installed the Bark app.
The message is directly sent to APNS server, so it is very fast and safe.
And the message can be sent in encrypted mode, that means APNS can not see the content of the message.
openssl: For cryptographic operations and JWT token generationreqwest: For making HTTP requests to the APNs serverstokio: For asynchronous I/O operationsfirst add dependencies
cargo add bark-dev
let mut bark = bark::Bark::new();
let msg = bark::Message::new("title", "body");
let resp = bark.send(msg);
let devices = [String::from("device_token_get_from_bark_app")];
let send_result = bark.send(&msg, devices);
if let Some(failed_device) = send_result {
println!("Failed to send to device: {}", failed_device);
}
let mut bark = bark::Bark::new();
let mut msg = bark::Message::new("title", "body");
msg.set_enc_type(bark_dev::msg::EncryptType::AES192);
msg.set_mode(bark_dev::msg::EncryptMode::ECB);
msg.set_key("the_key_must_the_same_as_bark_app");
// if you not set iv it will generate a random iv and send it to the server
msg.set_iv("the_iv_must_the_same_as_bark_app");
let resp = bark.send(msg);
let devices = [String::from("device_token_get_from_bark_app")];
let send_result = bark.send(&msg, devices);
if let Some(failed_device) = send_result {
println!("Failed to send to device: {}", failed_device);
}
let mut bark = bark::Bark::new();
let msg = bark::Message::new("title", "body");
let devices = [String::from("device_token_get_from_bark_app")];
let send_result = bark.async_send(&msg, devices).await?;
if let Some(failed_device) = send_result {
println!("Failed to send to device: {}", failed_device);
}