1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Shared protocol-facing types used by Shardline clients, storage adapters, and the
//! HTTP server.
//!
//! This crate keeps the wire-level contracts small and explicit:
//!
//! - [`ShardlineHash`] stores validated 32-byte hashes and canonical lowercase
//! hexadecimal text.
//! - [`ByteRange`] and [`ChunkRange`] validate range boundaries before they reach
//! storage code.
//! - [`TokenSigner`] signs and verifies scoped bearer tokens without exposing
//! secret material in debug output.
//! - [`RepositoryScope`] ties provider-issued tokens to one repository and,
//! optionally, one revision.
//!
//! # Example
//!
//! ```
//! use shardline_protocol::{
//! RepositoryProvider, RepositoryScope, TokenClaims, TokenScope, TokenSigner,
//! };
//!
//! let repository =
//! RepositoryScope::new(RepositoryProvider::GitHub, "acme", "assets", Some("main"))?;
//! let claims = TokenClaims::new(
//! "shardline",
//! "alice",
//! TokenScope::Read,
//! repository,
//! 1_700_000_600,
//! )?;
//!
//! let signer = TokenSigner::new(b"development-only-signing-key-32bytes")?;
//! let token = signer.sign(&claims)?;
//! let verified = signer.verify_at(&token, 1_700_000_000)?;
//!
//! assert_eq!(verified.subject(), "alice");
//! assert_eq!(verified.repository().owner(), "acme");
//! assert!(verified.scope().allows_read());
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
pub use ;
pub use ;
pub use ;
pub use parse_bool;
pub use unix_now_seconds_lossy;
pub use ;