Skip to content

Commit aeec285

Browse files
committed
Merge branch 'quentin/deprecateOldOidcFlow' into 'master'
chore(core): deprecate old OIDC flow See merge request TankerHQ/sdk-rust!183
2 parents f8528b6 + f2d5c8a commit aeec285

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/core.rs

+8
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,19 @@ impl Core {
8181
}
8282

8383
/// Creates a nonce to use during Oidc authorization code flow
84+
#[deprecated(
85+
since = "4.2.0",
86+
note = "The entire OIDC flow has been reworked, this function has been deprecated as a result"
87+
)]
8488
pub async fn create_oidc_nonce(&self) -> Result<String, Error> {
8589
unsafe { CTankerLib::get().create_oidc_nonce(self.ctanker).await }
8690
}
8791

8892
/// Set the nonce to use for Oidc verification
93+
#[deprecated(
94+
since = "4.2.0",
95+
note = "The entire OIDC flow has been reworked, this function has been deprecated as a result"
96+
)]
8997
pub async fn set_oidc_test_nonce(&self, nonce: &str) -> Result<(), Error> {
9098
unsafe {
9199
CTankerLib::get()

src/verification.rs

+5
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ pub enum Verification {
219219
Passphrase(String),
220220
VerificationKey(String),
221221
#[allow(clippy::upper_case_acronyms)]
222+
#[deprecated(
223+
since = "4.2.0",
224+
note = "The entire OIDC flow has been reworked, this verification method has been deprecated as a result, use Verification::OIDCAuthorizationCode instead"
225+
)]
222226
OIDCIDToken(String),
223227
PhoneNumber {
224228
phone_number: String,
@@ -249,6 +253,7 @@ impl Verification {
249253
CVerificationWrapper::with_passphrase(passphrase)
250254
}
251255
Verification::VerificationKey(key) => CVerificationWrapper::with_verification_key(key),
256+
#[allow(deprecated)]
252257
Verification::OIDCIDToken(token) => CVerificationWrapper::with_oidc_id_token(token),
253258
Verification::PhoneNumber {
254259
phone_number,

tests/verify_tests.rs

+13
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,22 @@ async fn unlock_with_oidc_id_token() -> Result<(), Box<dyn std::error::Error>> {
177177

178178
let tanker = Core::new(app.make_options()).await?;
179179
tanker.start(&martine_identity).await?;
180+
#[allow(deprecated)]
180181
let verif = Verification::OIDCIDToken(oidc_token);
181182

183+
#[allow(deprecated)]
182184
let nonce = tanker.create_oidc_nonce().await?;
185+
#[allow(deprecated)]
183186
tanker.set_oidc_test_nonce(&nonce).await?;
184187
tanker
185188
.register_identity(&verif, &VerificationOptions::new())
186189
.await?;
187190
tanker.stop().await?;
188191

189192
let tanker = Core::new(app.make_options()).await?;
193+
#[allow(deprecated)]
190194
let nonce = tanker.create_oidc_nonce().await?;
195+
#[allow(deprecated)]
191196
tanker.set_oidc_test_nonce(&nonce).await?;
192197
tanker.start(&martine_identity).await?;
193198
assert_eq!(tanker.status(), Status::IdentityVerificationNeeded);
@@ -553,9 +558,12 @@ async fn verify_identity_fail_with_preverified_oidc() -> Result<(), Box<dyn std:
553558

554559
let tanker = Core::new(app.make_options()).await?;
555560
assert_eq!(tanker.start(id).await?, Status::IdentityRegistrationNeeded);
561+
#[allow(deprecated)]
556562
let nonce = tanker.create_oidc_nonce().await?;
563+
#[allow(deprecated)]
557564
tanker.set_oidc_test_nonce(&nonce).await?;
558565

566+
#[allow(deprecated)]
559567
let verif = Verification::OIDCIDToken(id_token);
560568
tanker
561569
.register_identity(&verif, &VerificationOptions::new())
@@ -718,6 +726,7 @@ async fn set_verification_method_with_preverified_oidc() -> Result<(), Box<dyn s
718726
*methods,
719727
[
720728
VerificationMethod::Passphrase,
729+
#[allow(deprecated)]
721730
VerificationMethod::OIDCIDToken {
722731
provider_id: oidc_provider.id,
723732
provider_display_name: oidc_provider.display_name
@@ -729,8 +738,11 @@ async fn set_verification_method_with_preverified_oidc() -> Result<(), Box<dyn s
729738

730739
let tanker = Core::new(app.make_options()).await?;
731740
tanker.start(id).await?;
741+
#[allow(deprecated)]
732742
let nonce = tanker.create_oidc_nonce().await?;
743+
#[allow(deprecated)]
733744
tanker.set_oidc_test_nonce(&nonce).await?;
745+
#[allow(deprecated)]
734746
let verif = Verification::OIDCIDToken(id_token);
735747
tanker
736748
.verify_identity(&verif, &VerificationOptions::new())
@@ -774,6 +786,7 @@ async fn set_verification_method_with_oidc_authorization_code(
774786
methods,
775787
&[
776788
VerificationMethod::Passphrase,
789+
#[allow(deprecated)]
777790
VerificationMethod::OIDCIDToken {
778791
provider_id: oidc_provider.id.clone(),
779792
provider_display_name: oidc_provider.display_name

0 commit comments

Comments
 (0)