feat(router): Add tokenization support for proxy and update the route for proxy (#8530)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Prasunna Soppa
2025-08-08 18:23:02 +05:30
committed by GitHub
parent ede0b4f74e
commit 767dee9eb0
4 changed files with 94 additions and 78 deletions

View File

@ -1,3 +1,9 @@
use std::borrow::Cow;
use error_stack::ResultExt;
use crate::errors::{CustomResult, ValidationError};
crate::global_id_type!(
GlobalTokenId,
"A global id that can be used to identify a token.
@ -17,6 +23,15 @@ impl GlobalTokenId {
self.0.get_string_repr()
}
///Get GlobalTokenId from a string
pub fn from_string(token_string: &str) -> CustomResult<Self, ValidationError> {
let token = super::GlobalId::from_string(Cow::Owned(token_string.to_string()))
.change_context(ValidationError::IncorrectValueProvided {
field_name: "GlobalTokenId",
})?;
Ok(Self(token))
}
/// Generate a new GlobalTokenId from a cell id
pub fn generate(cell_id: &crate::id_type::CellId) -> Self {
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Token);