Skip to content

Commit

Permalink
Add topup req constructor (#4983)
Browse files Browse the repository at this point in the history
  • Loading branch information
neacsu committed Oct 18, 2024
1 parent edc2a36 commit e057f67
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions common/authenticator-requests/src/v3/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ impl AuthenticatorRequest {
)
}

pub fn new_topup_request(top_up_message: TopUpMessage, reply_to: Recipient) -> (Self, u64) {
let request_id = generate_random();
(
Self {
protocol: Protocol {
service_provider_type: ServiceProviderType::Authenticator,
version: VERSION,
},
data: AuthenticatorRequestData::TopUpBandwidth(Box::new(top_up_message)),
reply_to,
request_id,
},
request_id,
)
}

pub fn to_bytes(&self) -> Result<Vec<u8>, bincode::Error> {
use bincode::Options;
make_bincode_serializer().serialize(self)
Expand Down

0 comments on commit e057f67

Please sign in to comment.