diff --git a/poetry.lock b/poetry.lock index f06188d..ebcd11e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -771,7 +771,7 @@ reference = "gitlab" [[package]] name = "tankerci" -version = "2022.4.4131" +version = "2022.4.4142" description = "Tanker CI library" category = "main" optional = false @@ -842,7 +842,7 @@ reference = "gitlab" [[package]] name = "tqdm" -version = "4.63.1" +version = "4.64.0" description = "Fast, Extensible Progress Meter" category = "main" optional = false @@ -854,6 +854,7 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} [package.extras] dev = ["py-make (>=0.1.0)", "twine", "wheel"] notebook = ["ipywidgets (>=6)"] +slack = ["slack-sdk"] telegram = ["requests"] [package.source] @@ -920,15 +921,15 @@ reference = "gitlab" [[package]] name = "zipp" -version = "3.7.0" +version = "3.8.0" description = "Backport of pathlib-compatible object wrapper for zip files" category = "dev" optional = false python-versions = ">=3.7" [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] +docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"] [package.source] type = "legacy" @@ -1286,8 +1287,8 @@ tabulate = [ {file = "tabulate-0.8.9.tar.gz", hash = "sha256:eb1d13f25760052e8931f2ef80aaf6045a6cceb47514db8beab24cded16f13a7"}, ] tankerci = [ - {file = "tankerci-2022.4.4131-py3-none-any.whl", hash = "sha256:9519cdd703c4b4b535821f3d96b402b6add911bb7dfbd09021f6019d213989f9"}, - {file = "tankerci-2022.4.4131.tar.gz", hash = "sha256:7f6cdb2d0b52ed91ea42b014b4ba794d9cccb1e8dab37cb8e5da1da8e927fe4d"}, + {file = "tankerci-2022.4.4142-py3-none-any.whl", hash = "sha256:0108efc9f1c24d840b4da87894856ab58331084cbebeddb8ee18de7b24abb38e"}, + {file = "tankerci-2022.4.4142.tar.gz", hash = "sha256:cb972630fec6c07ccec5a73ab30b922f07600767937ab6c4dcd31d94ae3be290"}, ] tbump = [ {file = "tbump-6.3.1-py3-none-any.whl", hash = "sha256:60a8b0e36654c705a359b0a1af289eff2397d4482a348219e150ee1169d63c7f"}, @@ -1302,8 +1303,8 @@ tomlkit = [ {file = "tomlkit-0.5.11.tar.gz", hash = "sha256:f044eda25647882e5ef22b43a1688fb6ab12af2fc50e8456cdfc751c873101cf"}, ] tqdm = [ - {file = "tqdm-4.63.1-py2.py3-none-any.whl", hash = "sha256:6461b009d6792008d0000e1b0c7ca50195ec78c0e808a3a6b668a56a3236c3a5"}, - {file = "tqdm-4.63.1.tar.gz", hash = "sha256:4230a49119a416c88cc47d0d2d32d5d90f1a282d5e497d49801950704e49863d"}, + {file = "tqdm-4.64.0-py2.py3-none-any.whl", hash = "sha256:74a2cdefe14d11442cedf3ba4e21a3b84ff9a2dbdc6cfae2c34addb2a14a5ea6"}, + {file = "tqdm-4.64.0.tar.gz", hash = "sha256:40be55d30e200777a307a7585aee69e4eabb46b4ec6a4b4a5f2d9f11e7d5408d"}, ] typed-ast = [ {file = "typed_ast-1.5.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:183b183b7771a508395d2cbffd6db67d6ad52958a5fdc99f450d954003900266"}, @@ -1344,6 +1345,6 @@ urllib3 = [ {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, ] zipp = [ - {file = "zipp-3.7.0-py3-none-any.whl", hash = "sha256:b47250dd24f92b7dd6a0a8fc5244da14608f3ca90a5efcd37a3b1642fac9a375"}, - {file = "zipp-3.7.0.tar.gz", hash = "sha256:9f50f446828eb9d45b267433fd3e9da8d801f614129124863f9c51ebceafb87d"}, + {file = "zipp-3.8.0-py3-none-any.whl", hash = "sha256:c4f6e5bbf48e74f7a38e7cc5b0480ff42b0ae5178957d564d18932525d5cf099"}, + {file = "zipp-3.8.0.tar.gz", hash = "sha256:56bf8aadb83c24db6c4b577e13de374ccfb67da2078beba1d037c17980bf43ad"}, ] diff --git a/tanker-bindings/src/androidTest/kotlin/io/tanker/api/Unlock.kt b/tanker-bindings/src/androidTest/kotlin/io/tanker/api/Unlock.kt index 0f28734..ae1f746 100644 --- a/tanker-bindings/src/androidTest/kotlin/io/tanker/api/Unlock.kt +++ b/tanker-bindings/src/androidTest/kotlin/io/tanker/api/Unlock.kt @@ -227,12 +227,16 @@ class UnlockTests : TankerSpec() { val oidcIdToken = jsonResponse.get("id_token").asText() // Check that we can use our ID token as a verification method + val nonce = tanker1.createOidcNonce().get() tanker1.start(martineIdentity).get() + tanker1._setOidcTestNonce(nonce).get() tanker1.registerIdentity(OIDCIDTokenVerification(oidcIdToken)).get() tanker1.stop().get() tanker2.start(martineIdentity).get() + val nonce2 = tanker2.createOidcNonce().get() assertThat(tanker2.getStatus()).isEqualTo(Status.IDENTITY_VERIFICATION_NEEDED) + tanker2._setOidcTestNonce(nonce2).get() tanker2.verifyIdentity(OIDCIDTokenVerification(oidcIdToken)).get() assertThat(tanker2.getStatus()).isEqualTo(Status.READY) diff --git a/tanker-bindings/src/main/kotlin/io/tanker/api/Tanker.kt b/tanker-bindings/src/main/kotlin/io/tanker/api/Tanker.kt index 8ff1f94..adacc75 100644 --- a/tanker-bindings/src/main/kotlin/io/tanker/api/Tanker.kt +++ b/tanker-bindings/src/main/kotlin/io/tanker/api/Tanker.kt @@ -163,6 +163,26 @@ class Tanker(tankerOptions: TankerOptions) { return TankerFuture(futurePtr, Unit::class.java, keepAlive = this) } + /** + * Create an Oidc nonce + */ + fun createOidcNonce(): TankerFuture { + val fut = TankerFuture(lib.tanker_create_oidc_nonce(tanker), Pointer::class.java, keepAlive = this) + return fut.then(TankerCallback { + val ptr = it.get() + val str = ptr.getString(0) + lib.tanker_free_buffer(ptr) + str + }) + } + + /** + * Set the Oidc nonce to use during the next verification + */ + fun _setOidcTestNonce(nonce: String): TankerFuture { + return TankerFuture(lib.tanker_set_oidc_test_nonce(tanker, nonce), Pointer::class.java, keepAlive = this) + } + /** * Attaches a provisional identity to the current user. * @return A future that resolves when the claim is successful diff --git a/tanker-bindings/src/main/kotlin/io/tanker/bindings/TankerLib.kt b/tanker-bindings/src/main/kotlin/io/tanker/bindings/TankerLib.kt index 35a3a85..e45c75c 100644 --- a/tanker-bindings/src/main/kotlin/io/tanker/bindings/TankerLib.kt +++ b/tanker-bindings/src/main/kotlin/io/tanker/bindings/TankerLib.kt @@ -94,6 +94,9 @@ interface TankerLib : AsyncLib, DatastoreLib, Library { fun tanker_device_id(tanker: SessionPointer): ExpectedPointer fun tanker_get_device_list(tanker: SessionPointer): FuturePointer + fun tanker_create_oidc_nonce(tanker: SessionPointer): FuturePointer + fun tanker_set_oidc_test_nonce(tanker: SessionPointer, nonce: String): FuturePointer + fun tanker_attach_provisional_identity(tanker: SessionPointer, provisionalIdentity: String): FuturePointer fun tanker_verify_provisional_identity(tanker: SessionPointer, verification: TankerVerification): FuturePointer