Skip to content

Commit

Permalink
Uplift of #21847 (squashed) to release
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Feb 2, 2024
1 parent aa0b33c commit e466cad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions components/skus/browser/rs/lib/src/sdk/credentials/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ where
let blinded_creds: Vec<BlindedToken> =
match self.client.get_time_limited_v2_creds(&item.id).await? {
Some(item_creds) => {
// overwrite our request id if creds are already present
request_id = match item_creds.request_id {
Some(request_id) => request_id,
// use the item id as the request id if it was not persisted
None => item_id.to_string(),
};

// are we almost expired
let almost_expired = self
.last_matching_time_limited_v2_credential(&item.id)
Expand All @@ -155,6 +148,14 @@ where
match item_creds.state {
CredentialState::GeneratedCredentials
| CredentialState::SubmittedCredentials => {
// overwrite our request id if creds are already present
// that we need to resubmit
request_id = match item_creds.request_id {
Some(request_id) => request_id,
// use the item id as the request id if it was not persisted
None => item_id.to_string(),
};

// we have generated, or performed submission, reuse the
// creds we created for signing.
creds
Expand Down
1 change: 1 addition & 0 deletions components/skus/browser/rs/lib/src/storage/kv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ where
// don't overwrite the existing unblinded_creds, we just want to add the new blinded
// tokens to the item_credentials.creds for signing request
if let Credentials::TimeLimitedV2(item_credentials) = item_credentials {
item_credentials.request_id = Some(request_id.to_string());
item_credentials.creds = creds;
// update state to generated credentials
item_credentials.state = CredentialState::GeneratedCredentials;
Expand Down

0 comments on commit e466cad

Please sign in to comment.