wepub_core/lib.rs
1//! Asynchronous client library for publishing browser extensions to web stores.
2//!
3//! `wepub-core` is the engine behind the [`wepub`][wepub-bin] command-line
4//! tool. It exposes one client type per supported store and a single
5//! [`publish`][publish-fn] verb that handles upload, validation polling and
6//! version submission end-to-end.
7//!
8//! Currently supported stores:
9//!
10//! - **Firefox AMO** via [`firefox::FirefoxStore`]. Uses an HS256 JWT
11//! credential pair.
12//! - **Chrome Web Store** via [`chrome::ChromeStore`]. Uses an OAuth refresh
13//! token (or a pre-fetched access token).
14//!
15//! Both stores share the [`WepubError`] error type and the [`Result`] alias.
16//!
17//! # Example
18//!
19//! ```no_run
20//! # async fn run() -> wepub_core::Result<()> {
21//! use wepub_core::firefox::{FirefoxPublishOptions, FirefoxStore};
22//!
23//! let store = FirefoxStore::from_jwt_credentials(
24//! "myaddon@example.com".into(),
25//! "user:12345:6789".into(),
26//! "jwt-secret".into(),
27//! )?;
28//! let zip = std::fs::read("./addon.zip")?;
29//! store.publish(zip, FirefoxPublishOptions::default()).await?;
30//! # Ok(())
31//! # }
32//! ```
33//!
34//! [wepub-bin]: https://crates.io/crates/wepub
35//! [publish-fn]: firefox::FirefoxStore::publish
36
37#![warn(missing_docs)]
38
39mod error;
40mod http;
41
42pub mod chrome;
43pub mod firefox;
44
45pub use error::{Result, WepubError};