pub struct PaymentEndpointIdentifier(/* private fields */);Expand description
Machine-readable identifier for a Payment Endpoint.
A PaymentEndpointIdentifier is a single, safe path segment stored in an
app-owned endpoint directory. It is validated at construction time to
prevent path injection attacks.
§Allowed characters
ASCII alphanumeric (a-z, A-Z, 0-9), hyphens (-), underscores (_),
and dots (.) — but the value must not consist solely of dots (i.e. "." and
".." are rejected).
§Limits
- Must not be empty.
- Must not exceed 64 characters.
- Must not be a reserved Paykit storage value.
§Examples
let id = PaymentEndpointIdentifier::new("btc-lightning-bolt11").unwrap();
assert_eq!(id.as_str(), "btc-lightning-bolt11");
// Path traversal is rejected:
assert!(PaymentEndpointIdentifier::new("../etc/passwd").is_err());Implementations§
Source§impl PaymentEndpointIdentifier
impl PaymentEndpointIdentifier
Sourcepub fn new(id: impl Into<String>) -> Result<Self>
pub fn new(id: impl Into<String>) -> Result<Self>
Create a new PaymentEndpointIdentifier after validating the identifier.
Returns Err(PaykitError::Validation) if the value is empty, too long,
contains forbidden characters, resembles a path-traversal component,
or collides with a reserved identifier.
Trait Implementations§
Source§impl AsRef<str> for PaymentEndpointIdentifier
impl AsRef<str> for PaymentEndpointIdentifier
Source§impl Clone for PaymentEndpointIdentifier
impl Clone for PaymentEndpointIdentifier
Source§impl Debug for PaymentEndpointIdentifier
impl Debug for PaymentEndpointIdentifier
Source§impl Display for PaymentEndpointIdentifier
impl Display for PaymentEndpointIdentifier
impl Eq for PaymentEndpointIdentifier
Source§impl Hash for PaymentEndpointIdentifier
impl Hash for PaymentEndpointIdentifier
impl StructuralPartialEq for PaymentEndpointIdentifier
Auto Trait Implementations§
impl Freeze for PaymentEndpointIdentifier
impl RefUnwindSafe for PaymentEndpointIdentifier
impl Send for PaymentEndpointIdentifier
impl Sync for PaymentEndpointIdentifier
impl Unpin for PaymentEndpointIdentifier
impl UnsafeUnpin for PaymentEndpointIdentifier
impl UnwindSafe for PaymentEndpointIdentifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.