diff --git a/Cargo.lock b/Cargo.lock index 65d63b79..ad53f58c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "abnf" @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -201,9 +201,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "arrayref" @@ -246,7 +246,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -277,7 +277,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -289,7 +289,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -379,9 +379,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.4" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ "async-lock", "cfg-if", @@ -458,7 +458,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -667,9 +667,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +checksum = "b8ee0c1824c4dea5b5f81736aff91bae041d2c07ee1192bec91054e10e3e601e" dependencies = [ "arrayref", "arrayvec 0.7.6", @@ -756,9 +756,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" [[package]] name = "byteorder" @@ -768,9 +768,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cached" @@ -793,9 +793,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] @@ -811,7 +811,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -831,7 +831,7 @@ dependencies = [ "multibase 0.9.1", "serde", "static-iref", - "thiserror", + "thiserror 1.0.69", "tokio", "toml 0.8.19", "uuid", @@ -840,9 +840,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.31" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "shlex", ] @@ -936,9 +936,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" dependencies = [ "clap_builder", "clap_derive", @@ -950,14 +950,14 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6843ca418f46b4658e03825cb100092697f6b7f94a122281c408cb39f4562f25" dependencies = [ - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" dependencies = [ "anstream", "anstyle", @@ -974,14 +974,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "clear_on_drop" @@ -1080,7 +1080,7 @@ dependencies = [ "serde_bytes", "serde_cbor", "signature", - "thiserror", + "thiserror 1.0.69", "time", ] @@ -1095,7 +1095,7 @@ dependencies = [ "serde_bytes", "serde_cbor", "signature", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1110,9 +1110,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -1173,9 +1173,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" dependencies = [ "csv-core", "itoa", @@ -1225,7 +1225,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1273,7 +1273,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1295,7 +1295,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1387,7 +1387,7 @@ checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1424,7 +1424,7 @@ dependencies = [ "ssi-dids-core", "ssi-jwk 0.3.1", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1446,7 +1446,7 @@ dependencies = [ "ssi-jws", "ssi-jwt", "ssi-verification-methods", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1465,7 +1465,7 @@ dependencies = [ "ssi-jwk 0.3.1", "ssi-verification-methods", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1486,7 +1486,7 @@ dependencies = [ "ssi-jwk 0.3.1", "ssi-multicodec", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1507,7 +1507,7 @@ dependencies = [ "ssi-dids-core", "ssi-jwk 0.3.1", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1529,20 +1529,20 @@ dependencies = [ "ssi-jwk 0.3.1", "ssi-jws", "static-iref", - "thiserror", + "thiserror 1.0.69", "url", ] [[package]] name = "did-web" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f44395292400d7415bbc912e0d4d9fe71cdc306341f3df69c74c457d873f0b6" +checksum = "1982fc4ca703fd18934d9cc2721d13be3c4e0b45abe96fa086cf235b2bdf705c" dependencies = [ "http 0.2.12", "reqwest 0.11.27", "ssi-dids-core", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1574,7 +1574,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1647,7 +1647,7 @@ dependencies = [ "enum-ordinalize 4.3.0", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1699,7 +1699,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1719,7 +1719,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -1763,12 +1763,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1790,9 +1790,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener 5.3.1", "pin-project-lite", @@ -1811,9 +1811,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "ff" @@ -1848,9 +1848,9 @@ checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide 0.8.0", @@ -1973,9 +1973,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f1fa2f9765705486b33fd2acf1577f8ec449c2ba1f318ae5447697b7c08d210" +checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ "fastrand", "futures-core", @@ -1992,7 +1992,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -2123,7 +2123,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2132,17 +2132,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.1.0", - "indexmap 2.6.0", + "http 1.2.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2201,9 +2201,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -2211,12 +2211,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hermit-abi" version = "0.4.0" @@ -2272,9 +2266,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -2299,7 +2293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -2310,7 +2304,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite", ] @@ -2359,15 +2353,15 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", - "http 1.1.0", + "h2 0.4.7", + "http 1.2.0", "http-body 1.0.1", "httparse", "itoa", @@ -2398,15 +2392,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.5.0", + "http 1.2.0", + "hyper 1.5.1", "hyper-util", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", "tower-service", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", ] [[package]] @@ -2430,7 +2424,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-util", "native-tls", "tokio", @@ -2447,9 +2441,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.5.1", "pin-project-lite", "socket2", "tokio", @@ -2480,6 +2474,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2488,12 +2600,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] @@ -2523,12 +2646,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.2", "serde", ] @@ -2579,7 +2702,7 @@ dependencies = [ "serde", "smallvec", "static-regular-grammar", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2631,7 +2754,7 @@ dependencies = [ "sha2 0.10.8", "signature", "ssi-jwk 0.1.2", - "thiserror", + "thiserror 1.0.69", "time", "uuid", "x509-cert 0.2.5", @@ -2666,7 +2789,7 @@ dependencies = [ "sha2 0.10.8", "signature", "ssi-jwk 0.1.2", - "thiserror", + "thiserror 1.0.69", "time", "uuid", "x509-cert 0.1.1", @@ -2695,16 +2818,17 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2726,7 +2850,7 @@ dependencies = [ "json-syntax", "locspan", "rdf-types", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2738,7 +2862,7 @@ dependencies = [ "contextual", "educe 0.4.23", "futures", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "json-ld-context-processing", "json-ld-core", @@ -2748,7 +2872,7 @@ dependencies = [ "langtag", "mown", "rdf-types", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2765,7 +2889,7 @@ dependencies = [ "mown", "owning_ref", "rdf-types", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2779,7 +2903,7 @@ dependencies = [ "educe 0.4.23", "futures", "hashbrown 0.13.2", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "json-ld-syntax", "json-syntax", @@ -2797,7 +2921,7 @@ dependencies = [ "serde", "smallvec", "static-iref", - "thiserror", + "thiserror 1.0.69", "utf8-decode", ] @@ -2810,7 +2934,7 @@ dependencies = [ "contextual", "educe 0.4.23", "futures", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "json-ld-context-processing", "json-ld-core", @@ -2819,7 +2943,7 @@ dependencies = [ "langtag", "mown", "rdf-types", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2828,13 +2952,13 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fe6e8a89c6aff8c955a6b9128be4da54f1d64b9564bcd647995610c657e2a4e" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "json-ld-core", "json-syntax", "linked-data", "rdf-types", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -2848,7 +2972,7 @@ dependencies = [ "decoded-char", "educe 0.4.23", "hashbrown 0.13.2", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "json-syntax", "langtag", @@ -2856,7 +2980,7 @@ dependencies = [ "rdf-types", "serde", "smallvec", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2983,7 +3107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ecb4c689a30e48ebeaa14237f34037e300dd072e6ad21a9ec72e810ff3c6600" dependencies = [ "static-regular-grammar", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3070,9 +3194,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.161" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libipld" @@ -3091,7 +3215,7 @@ dependencies = [ "log", "multihash", "parking_lot", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3102,7 +3226,7 @@ checksum = "8dd1ab68c9d26f20c7d0dfea6eecbae8c00359875210001b33ca27d4a02f3d09" dependencies = [ "byteorder", "libipld-core", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3115,7 +3239,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -3130,7 +3254,7 @@ dependencies = [ "multibase 0.9.1", "multihash", "serde", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3174,7 +3298,7 @@ dependencies = [ "rdf-types", "serde", "static-iref", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -3189,8 +3313,8 @@ dependencies = [ "proc-macro2", "quote", "static-iref", - "syn 2.0.86", - "thiserror", + "syn 2.0.90", + "thiserror 1.0.69", ] [[package]] @@ -3199,6 +3323,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "litrs" version = "0.4.1" @@ -3294,11 +3424,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "wasi", "windows-sys 0.52.0", @@ -3334,7 +3463,7 @@ dependencies = [ "signature", "ssi", "ssi-contexts", - "thiserror", + "thiserror 1.0.69", "time", "time-macros", "tokio", @@ -3405,7 +3534,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure", + "synstructure 0.12.6", ] [[package]] @@ -3558,14 +3687,14 @@ dependencies = [ "base64 0.22.1", "chrono", "getrandom", - "http 1.1.0", + "http 1.2.0", "rand", "reqwest 0.12.9", "serde", "serde_json", "serde_path_to_error", "sha2 0.10.8", - "thiserror", + "thiserror 1.0.69", "url", ] @@ -3581,7 +3710,7 @@ dependencies = [ [[package]] name = "oid4vci" version = "0.1.0" -source = "git+https://github.com/spruceid/oid4vci-rs?rev=d95fe3a#d95fe3aa1ffe59156803ab39c024e8c506c9eee1" +source = "git+https://github.com/spruceid/oid4vci-rs?rev=3717043#3717043909b7ef766b340a58306d2325e61216df" dependencies = [ "anyhow", "async-signature", @@ -3597,10 +3726,8 @@ dependencies = [ "serde_urlencoded", "serde_with 3.11.0", "sha2 0.10.8", - "ssi-claims 0.1.1", - "ssi-dids-core", - "ssi-jwk 0.3.1", - "thiserror", + "ssi", + "thiserror 1.0.69", "time", "tracing", "url", @@ -3621,12 +3748,12 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openid4vp" version = "0.1.0" -source = "git+https://github.com/spruceid/openid4vp?rev=ad3974c#ad3974c5d19c94ecefb4b83427886ff1c480c194" +source = "git+https://github.com/spruceid/openid4vp?rev=347814f#347814fb7f21fcc75885a61c0e170fd63face08f" dependencies = [ "anyhow", "async-trait", "base64 0.21.7", - "http 1.1.0", + "http 1.2.0", "json-syntax", "jsonschema", "openid4vp-frontend", @@ -3638,7 +3765,7 @@ dependencies = [ "serde_json_path", "serde_urlencoded", "ssi", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "url", @@ -3649,7 +3776,7 @@ dependencies = [ [[package]] name = "openid4vp-frontend" version = "0.1.0" -source = "git+https://github.com/spruceid/openid4vp?rev=ad3974c#ad3974c5d19c94ecefb4b83427886ff1c480c194" +source = "git+https://github.com/spruceid/openid4vp?rev=347814f#347814fb7f21fcc75885a61c0e170fd63face08f" dependencies = [ "serde", "serde_json", @@ -3678,7 +3805,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -3689,9 +3816,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.4.0+3.4.0" +version = "300.4.1+3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a709e02f2b4aca747929cca5ed248880847c650233cf8b8cdc48f40aaf4898a6" +checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" dependencies = [ "cc", ] @@ -3720,9 +3847,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "4.4.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e7ccb95e240b7c9506a3d544f10d935e142cc90b0a1d56954fb44d89ad6b97" +checksum = "c65ee1f9701bf938026630b455d5315f490640234259037edb259798b3bcf85e" dependencies = [ "num-traits", "rand", @@ -3805,7 +3932,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf1bdcc492c285a50bed60860dfa00b50baf1f60c73c7d6b435b01a2a11fd6ff" dependencies = [ - "thiserror", + "thiserror 1.0.69", "utf8-decode", ] @@ -3865,7 +3992,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -3937,13 +4064,13 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "polling" -version = "3.7.3" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", - "hermit-abi 0.4.0", + "hermit-abi", "pin-project-lite", "rustix", "tracing", @@ -4012,7 +4139,7 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ - "thiserror", + "thiserror 1.0.69", "toml 0.5.11", ] @@ -4051,53 +4178,56 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.16", + "rustls 0.23.19", "socket2", - "thiserror", + "thiserror 2.0.4", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom", "rand", "ring", "rustc-hash", - "rustls 0.23.16", + "rustls 0.23.19", + "rustls-pki-types", "slab", - "thiserror", + "thiserror 2.0.4", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e346e016eacfff12233c243718197ca12f148c84e1e84268a896699b41c71780" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ "cfg_aliases", "libc", @@ -4189,14 +4319,14 @@ checksum = "2b8d685353ee1b343c708b6be7751d98a7df8e1d0caaeee67c754318854c01d5" dependencies = [ "contextual", "educe 0.5.11", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "langtag", "raw-btree", "replace_with", "slab", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -4222,9 +4352,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -4305,11 +4435,11 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.4.6", - "http 1.1.0", + "h2 0.4.7", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.5.1", "hyper-rustls 0.27.3", "hyper-tls 0.6.0", "hyper-util", @@ -4322,13 +4452,13 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 1.0.2", "system-configuration 0.6.1", "tokio", "tokio-native-tls", @@ -4338,7 +4468,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.6", + "webpki-roots 0.26.7", "windows-registry", ] @@ -4350,10 +4480,10 @@ checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", - "http 1.1.0", + "http 1.2.0", "reqwest 0.12.9", "serde", - "thiserror", + "thiserror 1.0.69", "tower-service", ] @@ -4439,7 +4569,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.86", + "syn 2.0.90", "unicode-ident", ] @@ -4451,9 +4581,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" @@ -4475,9 +4605,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ "bitflags 2.6.0", "errno", @@ -4500,9 +4630,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "once_cell", "ring", @@ -4535,6 +4665,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -4577,9 +4710,9 @@ checksum = "700de91d5fd6091442d00fdd9ee790af6d4f0f480562b0f5a1e8f59e90aafe73" [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] @@ -4607,7 +4740,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -4650,9 +4783,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -4660,9 +4793,9 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" +checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" [[package]] name = "semver" @@ -4675,9 +4808,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -4712,13 +4845,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -4734,9 +4867,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -4746,55 +4879,52 @@ dependencies = [ [[package]] name = "serde_json_path" -version = "0.6.7" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bc0207b6351893eafa1e39aa9aea452abb6425ca7b02dd64faf29109e7a33ba" +checksum = "e176fbf9bd62f75c2d8be33207fa13af2f800a506635e89759e46f934c520f4d" dependencies = [ "inventory", "nom", - "once_cell", "regex", "serde", "serde_json", "serde_json_path_core", "serde_json_path_macros", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "serde_json_path_core" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d64fe53ce1aaa31bea2b2b46d3b6ab6a37e61854bedcbd9f174e188f3f7d79" +checksum = "ea3bfd54a421bec8328aefede43ac9f18c8c7ded3b2afc8addd44b4813d99fd0" dependencies = [ "inventory", - "once_cell", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "serde_json_path_macros" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a31e8177a443fd3e94917f12946ae7891dfb656e6d4c5e79b8c5d202fbcb723" +checksum = "ee05bac728cc5232af5c23896b34fbdd17cf0bb0c113440588aeeb1b57c6ba1f" dependencies = [ "inventory", - "once_cell", "serde_json_path_core", "serde_json_path_macros_internal", ] [[package]] name = "serde_json_path_macros_internal" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75dde5a1d2ed78dfc411fc45592f72d3694436524d3353683ecb3d22009731dc" +checksum = "aafbefbe175fa9bf03ca83ef89beecff7d2a95aaacd5732325b90ac8c3bd7b90" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -4865,7 +4995,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -4894,7 +5024,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -4906,7 +5036,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -4987,7 +5117,7 @@ dependencies = [ "chrono", "num-bigint", "num-traits", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5039,9 +5169,9 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -5095,13 +5225,13 @@ dependencies = [ [[package]] name = "ssi" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf6c9acc113fab505c72e63aa389c686ed8106c53622a0d1d0a1953296850ba" +checksum = "48ce557ccec13330c9ba2cab173acf63f6393ec14fffd3312666c8eea16c45b4" dependencies = [ "document-features", "ssi-caips", - "ssi-claims 0.2.0", + "ssi-claims", "ssi-core", "ssi-crypto 0.2.1", "ssi-dids", @@ -5130,43 +5260,10 @@ dependencies = [ "linked-data", "serde", "ssi-jwk 0.3.1", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] -[[package]] -name = "ssi-claims" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c88a68e774d47601b3f7d6cc50cb3177c7a08b73f8469458b53af12847cb4c75" -dependencies = [ - "educe 0.4.23", - "iref", - "json-syntax", - "linked-data", - "locspan", - "pin-project", - "rdf-types", - "serde", - "serde_json", - "ssi-claims-core", - "ssi-core", - "ssi-cose", - "ssi-crypto 0.2.1", - "ssi-data-integrity", - "ssi-dids-core", - "ssi-json-ld", - "ssi-jwk 0.3.1", - "ssi-jws", - "ssi-jwt", - "ssi-sd-jwt", - "ssi-security", - "ssi-vc 0.3.1", - "ssi-vc-jose-cose 0.1.1", - "ssi-verification-methods", - "thiserror", -] - [[package]] name = "ssi-claims" version = "0.2.0" @@ -5195,10 +5292,10 @@ dependencies = [ "ssi-jwt", "ssi-sd-jwt", "ssi-security", - "ssi-vc 0.4.0", - "ssi-vc-jose-cose 0.2.0", + "ssi-vc", + "ssi-vc-jose-cose", "ssi-verification-methods", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5214,7 +5311,7 @@ dependencies = [ "ssi-crypto 0.2.1", "ssi-eip712", "ssi-json-ld", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5232,7 +5329,7 @@ dependencies = [ "async-trait", "pin-project", "serde", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5246,7 +5343,7 @@ dependencies = [ "serde", "ssi-claims-core", "ssi-crypto 0.2.1", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5261,7 +5358,7 @@ dependencies = [ "keccak-hash", "ripemd160", "sha2 0.10.8", - "thiserror", + "thiserror 1.0.69", "zeroize", ] @@ -5288,7 +5385,7 @@ dependencies = [ "serde", "sha2 0.10.8", "static-iref", - "thiserror", + "thiserror 1.0.69", "zeroize", ] @@ -5318,7 +5415,7 @@ dependencies = [ "ssi-rdf", "ssi-security", "ssi-verification-methods", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5353,7 +5450,7 @@ dependencies = [ "ssi-security", "ssi-verification-methods", "static-iref", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -5404,7 +5501,7 @@ dependencies = [ "ssi-security", "ssi-verification-methods", "static-iref", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -5427,7 +5524,7 @@ dependencies = [ "ssi-core", "ssi-json-ld", "ssi-rdf", - "thiserror", + "thiserror 1.0.69", "uuid", ] @@ -5446,7 +5543,7 @@ dependencies = [ "did-web", "ssi-dids-core", "ssi-jwk 0.3.1", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5471,7 +5568,7 @@ dependencies = [ "ssi-jws", "ssi-verification-methods-core", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5481,7 +5578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54107b8d19db3e8c7e65d04910a118172d636ecd1819f4691fa6c0b2428d62bc" dependencies = [ "hex", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "json-syntax", "keccak-hash", @@ -5490,7 +5587,7 @@ dependencies = [ "serde", "serde_jcs", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5514,7 +5611,7 @@ dependencies = [ "ssi-crypto 0.2.1", "ssi-rdf", "static-iref", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -5539,7 +5636,7 @@ dependencies = [ "serde", "simple_asn1", "ssi-crypto 0.1.1", - "thiserror", + "thiserror 1.0.69", "unsigned-varint", "zeroize", ] @@ -5574,7 +5671,7 @@ dependencies = [ "ssi-claims-core", "ssi-crypto 0.2.1", "ssi-multicodec", - "thiserror", + "thiserror 1.0.69", "zeroize", ] @@ -5604,7 +5701,7 @@ dependencies = [ "ssi-core", "ssi-crypto 0.2.1", "ssi-jwk 0.3.1", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5618,7 +5715,7 @@ dependencies = [ "hashbrown 0.14.5", "iref", "json-syntax", - "ordered-float 4.4.0", + "ordered-float 4.5.0", "serde", "serde_json", "serde_with 2.3.3", @@ -5628,7 +5725,7 @@ dependencies = [ "ssi-crypto 0.2.1", "ssi-jwk 0.3.1", "ssi-jws", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5642,7 +5739,7 @@ dependencies = [ "k256", "p256", "p384", - "thiserror", + "thiserror 1.0.69", "unsigned-varint", ] @@ -5653,7 +5750,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a07a869c976c5c84c1fb605a95a153da92a3a0472f4233ea776282f27ef15b11" dependencies = [ "combination", - "indexmap 2.6.0", + "indexmap 2.7.0", "iref", "linked-data", "rdf-types", @@ -5668,7 +5765,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77e27d19b7993dc4d0b23bcdbf9978cebbed7d5b7fa19cabde55aa9a0c72c58f" dependencies = [ "base64 0.22.1", - "indexmap 2.6.0", + "indexmap 2.7.0", "rand", "serde", "serde_json", @@ -5678,7 +5775,7 @@ dependencies = [ "ssi-jwk 0.3.1", "ssi-jws", "ssi-jwt", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5703,7 +5800,7 @@ checksum = "e302e0f598849ba1feddc493bfd610e513a32688ce7cf03da2a73a461f948ce8" dependencies = [ "sshkeys", "ssi-jwk 0.3.1", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5728,9 +5825,9 @@ dependencies = [ "ssi-jwk 0.3.1", "ssi-jws", "ssi-jwt", - "ssi-vc 0.4.0", + "ssi-vc", "ssi-verification-methods", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -5757,38 +5854,7 @@ dependencies = [ "ssi-jws", "ssi-jwt", "ssi-verification-methods", - "thiserror", -] - -[[package]] -name = "ssi-vc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c5b03ae806ad98c7f2681ad09a5e90a58a57f2486e1250762200c8267e20b24" -dependencies = [ - "base64 0.22.1", - "bitvec 0.20.4", - "chrono", - "educe 0.4.23", - "flate2", - "iref", - "json-syntax", - "linked-data", - "rdf-types", - "reqwest 0.11.27", - "serde", - "serde_json", - "ssi-claims-core", - "ssi-core", - "ssi-data-integrity", - "ssi-dids-core", - "ssi-json-ld", - "ssi-jwt", - "ssi-rdf", - "ssi-verification-methods", - "static-iref", - "thiserror", - "xsd-types", + "thiserror 1.0.69", ] [[package]] @@ -5818,28 +5884,7 @@ dependencies = [ "ssi-rdf", "ssi-verification-methods", "static-iref", - "thiserror", - "xsd-types", -] - -[[package]] -name = "ssi-vc-jose-cose" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17246ad15799958df36da01b214eb6dcfce7793a20ba410ac67e30f416f962fa" -dependencies = [ - "base64 0.22.1", - "ciborium", - "serde", - "serde_json", - "ssi-claims-core", - "ssi-cose", - "ssi-json-ld", - "ssi-jws", - "ssi-jwt", - "ssi-sd-jwt", - "ssi-vc 0.3.1", - "thiserror", + "thiserror 1.0.69", "xsd-types", ] @@ -5859,8 +5904,8 @@ dependencies = [ "ssi-jws", "ssi-jwt", "ssi-sd-jwt", - "ssi-vc 0.4.0", - "thiserror", + "ssi-vc", + "thiserror 1.0.69", "xsd-types", ] @@ -5901,7 +5946,7 @@ dependencies = [ "ssi-security", "ssi-verification-methods-core", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5926,7 +5971,7 @@ dependencies = [ "ssi-jwk 0.3.1", "ssi-jws", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5941,7 +5986,7 @@ dependencies = [ "rdf-types", "serde", "serde_json", - "ssi-claims 0.2.0", + "ssi-claims", "ssi-core", "ssi-dids-core", "ssi-eip712", @@ -5950,7 +5995,7 @@ dependencies = [ "ssi-rdf", "ssi-verification-methods", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5967,7 +6012,7 @@ checksum = "3cc4068497ae43896d41174586dcdc2153a1af2c82856fb308bfaaddc28e5549" dependencies = [ "iref", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -5986,8 +6031,8 @@ dependencies = [ "quote", "serde", "sha2 0.10.8", - "syn 2.0.86", - "thiserror", + "syn 2.0.90", + "thiserror 1.0.69", ] [[package]] @@ -6027,9 +6072,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.86" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -6044,9 +6089,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -6063,6 +6108,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -6113,9 +6169,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -6135,29 +6191,49 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +dependencies = [ + "thiserror-impl 2.0.4", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", ] [[package]] name = "thiserror-impl" -version = "1.0.66" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -6176,9 +6252,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -6193,6 +6269,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -6226,14 +6312,14 @@ checksum = "8d9ef545650e79f30233c0003bcc2504d7efac6dad25fca40744de773fe2049c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] name = "tokio" -version = "1.41.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -6255,7 +6341,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] @@ -6284,16 +6370,16 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.16", + "rustls 0.23.19", "rustls-pki-types", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -6338,7 +6424,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -6353,9 +6439,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -6364,20 +6450,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", ] @@ -6421,26 +6507,11 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-xid" @@ -6450,9 +6521,9 @@ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "uniffi" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ce6280c581045879e11b400bae14686a819df22b97171215d15549efa04ddb" +checksum = "4cb08c58c7ed7033150132febe696bef553f891b1ede57424b40d87a89e3c170" dependencies = [ "anyhow", "camino", @@ -6466,9 +6537,9 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9f25730c9db2e878521d606f54e921edb719cdd94d735e7f97705d6796d024" +checksum = "cade167af943e189a55020eda2c314681e223f1e42aca7c4e52614c2b627698f" dependencies = [ "anyhow", "askama", @@ -6490,9 +6561,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88dba57ac699bd8ec53d6a352c8dd0e479b33f698c5659831bb1e4ce468c07bd" +checksum = "4c7cf32576e08104b7dc2a6a5d815f37616e66c6866c2a639fe16e6d2286b75b" dependencies = [ "anyhow", "camino", @@ -6501,19 +6572,19 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" +checksum = "802d2051a700e3ec894c79f80d2705b69d85844dafbbe5d1a92776f8f48b563a" dependencies = [ "quote", - "syn 2.0.86", + "syn 2.0.90", ] [[package]] name = "uniffi_core" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61049e4db6212d0ede80982adf0e1d6fa224e6118387324c5cfbe3083dfb2252" +checksum = "bc7687007d2546c454d8ae609b105daceb88175477dac280707ad6d95bcd6f1f" dependencies = [ "anyhow", "async-compat", @@ -6526,9 +6597,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40fd2249e0c5dcbd2bfa3c263db1ec981f7273dca7f4132bf06a272359a586c" +checksum = "12c65a5b12ec544ef136693af8759fb9d11aefce740fb76916721e876639033b" dependencies = [ "bincode", "camino", @@ -6537,16 +6608,16 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.86", + "syn 2.0.90", "toml 0.5.11", "uniffi_meta", ] [[package]] name = "uniffi_meta" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ad57039b4fafdbf77428d74fff40e0908e5a1731e023c19cfe538f6d4a8ed6" +checksum = "4a74ed96c26882dac1ca9b93ca23c827e284bacbd7ec23c6f0b0372f747d59e4" dependencies = [ "anyhow", "bytes", @@ -6556,9 +6627,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fa171d4d258dc51bbd01893cc9608c1b62273d2f9ea55fb64f639e77824567" +checksum = "6a6f984f0781f892cc864a62c3a5c60361b1ccbd68e538e6c9fbced5d82268ac" dependencies = [ "anyhow", "camino", @@ -6569,9 +6640,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.28.2" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52299e247419e7e2934bef2f94d7cccb0e6566f3248b1d48b160d8f369a2668" +checksum = "037820a4cfc4422db1eaa82f291a3863c92c7d1789dc513489c36223f9b4cdfc" dependencies = [ "anyhow", "textwrap", @@ -6604,9 +6675,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -6620,12 +6691,24 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf8-decode" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca61eb27fa339aa08826a29f03e87b99b4d8f0fc2255306fd266bb1b6a9de498" +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -6676,7 +6759,7 @@ dependencies = [ "sha2 0.10.8", "ssi", "static-iref", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -6696,9 +6779,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -6707,36 +6790,37 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6744,28 +6828,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -6779,9 +6873,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -7001,6 +7095,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.2.0" @@ -7058,7 +7164,31 @@ dependencies = [ "serde", "static-iref", "static-regular-grammar", - "thiserror", + "thiserror 1.0.69", +] + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure 0.13.1", ] [[package]] @@ -7079,7 +7209,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure 0.13.1", ] [[package]] @@ -7099,5 +7250,27 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.86", + "syn 2.0.90", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", ] diff --git a/Cargo.toml b/Cargo.toml index 21b22d60..4f0920ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,9 +20,9 @@ cose-rs = { git = "https://github.com/spruceid/cose-rs", rev = "0018c9b", featur "time", ] } isomdl = { git = "https://github.com/spruceid/isomdl", rev = "1f4f762" } -oid4vci = { git = "https://github.com/spruceid/oid4vci-rs", rev = "d95fe3a" } -openid4vp = { git = "https://github.com/spruceid/openid4vp", rev = "ad3974c" } -ssi = { version = "0.10", features = ["secp256r1", "secp384r1"] } +oid4vci = { git = "https://github.com/spruceid/oid4vci-rs", rev = "3717043" } +openid4vp = { git = "https://github.com/spruceid/openid4vp", rev = "347814f" } +ssi = { version = "0.10.1", features = ["secp256r1", "secp384r1"] } async-trait = "0.1" base64 = "0.22.0" diff --git a/MobileSdkRs/Sources/MobileSdkRs/mobile_sdk_rs.swift b/MobileSdkRs/Sources/MobileSdkRs/mobile_sdk_rs.swift index 50e6c8f3..3e33c01e 100644 --- a/MobileSdkRs/Sources/MobileSdkRs/mobile_sdk_rs.swift +++ b/MobileSdkRs/Sources/MobileSdkRs/mobile_sdk_rs.swift @@ -1281,11 +1281,11 @@ open class Holder: /** * Uses VDC collection to retrieve the credentials for a given presentation definition. */ -public convenience init(vdcCollection: VdcCollection, trustedDids: [String])async throws { +public convenience init(vdcCollection: VdcCollection, trustedDids: [String], signer: PresentationSigner)async throws { let pointer = try await uniffiRustCallAsync( rustFutureFunc: { - uniffi_mobile_sdk_rs_fn_constructor_holder_new(FfiConverterTypeVdcCollection.lower(vdcCollection),FfiConverterSequenceString.lower(trustedDids) + uniffi_mobile_sdk_rs_fn_constructor_holder_new(FfiConverterTypeVdcCollection.lower(vdcCollection),FfiConverterSequenceString.lower(trustedDids),FfiConverterCallbackInterfacePresentationSigner.lower(signer) ) }, pollFunc: ffi_mobile_sdk_rs_rust_future_poll_pointer, @@ -1315,11 +1315,11 @@ public convenience init(vdcCollection: VdcCollection, trustedDids: [String])asyn * This constructor will use the provided credentials for the presentation, * instead of searching for credentials in the VDC collection. */ -public static func newWithCredentials(providedCredentials: [ParsedCredential], trustedDids: [String])async throws -> Holder { +public static func newWithCredentials(providedCredentials: [ParsedCredential], trustedDids: [String], signer: PresentationSigner)async throws -> Holder { return try await uniffiRustCallAsync( rustFutureFunc: { - uniffi_mobile_sdk_rs_fn_constructor_holder_new_with_credentials(FfiConverterSequenceTypeParsedCredential.lower(providedCredentials),FfiConverterSequenceString.lower(trustedDids) + uniffi_mobile_sdk_rs_fn_constructor_holder_new_with_credentials(FfiConverterSequenceTypeParsedCredential.lower(providedCredentials),FfiConverterSequenceString.lower(trustedDids),FfiConverterCallbackInterfacePresentationSigner.lower(signer) ) }, pollFunc: ffi_mobile_sdk_rs_rust_future_poll_pointer, @@ -3166,6 +3166,14 @@ open class ParsedCredential: } +public static func newFromJson(jsonString: String)throws -> ParsedCredential { + return try FfiConverterTypeParsedCredential.lift(try rustCallWithError(FfiConverterTypeCredentialDecodingError.lift) { + uniffi_mobile_sdk_rs_fn_constructor_parsedcredential_new_from_json( + FfiConverterString.lower(jsonString),$0 + ) +}) +} + /** * Construct a new `jwt_vc_json` credential. */ @@ -3377,7 +3385,7 @@ public protocol PermissionRequestProtocol : AnyObject { /** * Construct a new permission response for the given credential. */ - func createPermissionResponse(selectedCredentials: [ParsedCredential]) -> PermissionResponse + func createPermissionResponse(selectedCredentials: [ParsedCredential]) async throws -> PermissionResponse /** * Return the filtered list of credentials that matched @@ -3443,12 +3451,21 @@ open class PermissionRequest: /** * Construct a new permission response for the given credential. */ -open func createPermissionResponse(selectedCredentials: [ParsedCredential]) -> PermissionResponse { - return try! FfiConverterTypePermissionResponse.lift(try! rustCall() { - uniffi_mobile_sdk_rs_fn_method_permissionrequest_create_permission_response(self.uniffiClonePointer(), - FfiConverterSequenceTypeParsedCredential.lower(selectedCredentials),$0 - ) -}) +open func createPermissionResponse(selectedCredentials: [ParsedCredential])async throws -> PermissionResponse { + return + try await uniffiRustCallAsync( + rustFutureFunc: { + uniffi_mobile_sdk_rs_fn_method_permissionrequest_create_permission_response( + self.uniffiClonePointer(), + FfiConverterSequenceTypeParsedCredential.lower(selectedCredentials) + ) + }, + pollFunc: ffi_mobile_sdk_rs_rust_future_poll_pointer, + completeFunc: ffi_mobile_sdk_rs_rust_future_complete_pointer, + freeFunc: ffi_mobile_sdk_rs_rust_future_free_pointer, + liftFunc: FfiConverterTypePermissionResponse.lift, + errorHandler: FfiConverterTypeOID4VPError.lift + ) } /** @@ -3543,6 +3560,11 @@ public func FfiConverterTypePermissionRequest_lower(_ value: PermissionRequest) */ public protocol PermissionResponseProtocol : AnyObject { + /** + * Return the selected credentials for the permission response. + */ + func selectedCredentials() -> [ParsedCredential] + } /** @@ -3594,6 +3616,16 @@ open class PermissionResponse: + /** + * Return the selected credentials for the permission response. + */ +open func selectedCredentials() -> [ParsedCredential] { + return try! FfiConverterSequenceTypeParsedCredential.lift(try! rustCall() { + uniffi_mobile_sdk_rs_fn_method_permissionresponse_selected_credentials(self.uniffiClonePointer(),$0 + ) +}) +} + } @@ -5871,6 +5903,8 @@ public enum CredentialEncodingError { ) case VpToken(String ) + case Presentation(PresentationError + ) } @@ -5896,6 +5930,9 @@ public struct FfiConverterTypeCredentialEncodingError: FfiConverterRustBuffer { case 4: return .VpToken( try FfiConverterString.read(from: &buf) ) + case 5: return .Presentation( + try FfiConverterTypePresentationError.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -5927,6 +5964,11 @@ public struct FfiConverterTypeCredentialEncodingError: FfiConverterRustBuffer { writeInt(&buf, Int32(4)) FfiConverterString.write(v1, into: &buf) + + case let .Presentation(v1): + writeInt(&buf, Int32(5)) + FfiConverterTypePresentationError.write(v1, into: &buf) + } } } @@ -7077,10 +7119,6 @@ public enum Oid4vpError { ) case DidKeyGenerateUrl(String ) - case CredentialEncodingError(String - ) - case CredentialDecodingError(String - ) case JsonSyntaxParse(String ) case VdcCollection(VdcCollectionError @@ -7103,7 +7141,15 @@ public enum Oid4vpError { case RequestSignerNotFound case MetadataInitialization(String ) - case PermissionResponse(PermissionResponseError + case PermissionRequest(PermissionRequestError + ) + case Presentation(PresentationError + ) + case CredentialEncoding(CredentialEncodingError + ) + case JsonPathParse(String + ) + case EmptyCredentialSubject(String ) } @@ -7148,45 +7194,51 @@ public struct FfiConverterTypeOID4VPError: FfiConverterRustBuffer { case 10: return .DidKeyGenerateUrl( try FfiConverterString.read(from: &buf) ) - case 11: return .CredentialEncodingError( + case 11: return .JsonSyntaxParse( try FfiConverterString.read(from: &buf) ) - case 12: return .CredentialDecodingError( - try FfiConverterString.read(from: &buf) + case 12: return .VdcCollection( + try FfiConverterTypeVdcCollectionError.read(from: &buf) ) - case 13: return .JsonSyntaxParse( + case 13: return .HttpClientInitialization( try FfiConverterString.read(from: &buf) ) - case 14: return .VdcCollection( - try FfiConverterTypeVdcCollectionError.read(from: &buf) - ) - case 15: return .HttpClientInitialization( + case 14: return .SigningAlgorithmNotFound( try FfiConverterString.read(from: &buf) ) - case 16: return .SigningAlgorithmNotFound( + case 15: return .InvalidClientIdScheme( try FfiConverterString.read(from: &buf) ) - case 17: return .InvalidClientIdScheme( + case 16: return .InputDescriptorNotFound + case 17: return .VpTokenParse( try FfiConverterString.read(from: &buf) ) - case 18: return .InputDescriptorNotFound - case 19: return .VpTokenParse( + case 18: return .VpTokenCreate( try FfiConverterString.read(from: &buf) ) - case 20: return .VpTokenCreate( + case 19: return .JwkParse( try FfiConverterString.read(from: &buf) ) - case 21: return .JwkParse( + case 20: return .VdcCollectionNotInitialized + case 21: return .AuthorizationRequestNotFound + case 22: return .RequestSignerNotFound + case 23: return .MetadataInitialization( try FfiConverterString.read(from: &buf) ) - case 22: return .VdcCollectionNotInitialized - case 23: return .AuthorizationRequestNotFound - case 24: return .RequestSignerNotFound - case 25: return .MetadataInitialization( + case 24: return .PermissionRequest( + try FfiConverterTypePermissionRequestError.read(from: &buf) + ) + case 25: return .Presentation( + try FfiConverterTypePresentationError.read(from: &buf) + ) + case 26: return .CredentialEncoding( + try FfiConverterTypeCredentialEncodingError.read(from: &buf) + ) + case 27: return .JsonPathParse( try FfiConverterString.read(from: &buf) ) - case 26: return .PermissionResponse( - try FfiConverterTypePermissionResponseError.read(from: &buf) + case 28: return .EmptyCredentialSubject( + try FfiConverterString.read(from: &buf) ) default: throw UniffiInternalError.unexpectedEnumCase @@ -7250,80 +7302,90 @@ public struct FfiConverterTypeOID4VPError: FfiConverterRustBuffer { FfiConverterString.write(v1, into: &buf) - case let .CredentialEncodingError(v1): - writeInt(&buf, Int32(11)) - FfiConverterString.write(v1, into: &buf) - - - case let .CredentialDecodingError(v1): - writeInt(&buf, Int32(12)) - FfiConverterString.write(v1, into: &buf) - - case let .JsonSyntaxParse(v1): - writeInt(&buf, Int32(13)) + writeInt(&buf, Int32(11)) FfiConverterString.write(v1, into: &buf) case let .VdcCollection(v1): - writeInt(&buf, Int32(14)) + writeInt(&buf, Int32(12)) FfiConverterTypeVdcCollectionError.write(v1, into: &buf) case let .HttpClientInitialization(v1): - writeInt(&buf, Int32(15)) + writeInt(&buf, Int32(13)) FfiConverterString.write(v1, into: &buf) case let .SigningAlgorithmNotFound(v1): - writeInt(&buf, Int32(16)) + writeInt(&buf, Int32(14)) FfiConverterString.write(v1, into: &buf) case let .InvalidClientIdScheme(v1): - writeInt(&buf, Int32(17)) + writeInt(&buf, Int32(15)) FfiConverterString.write(v1, into: &buf) case .InputDescriptorNotFound: - writeInt(&buf, Int32(18)) + writeInt(&buf, Int32(16)) case let .VpTokenParse(v1): - writeInt(&buf, Int32(19)) + writeInt(&buf, Int32(17)) FfiConverterString.write(v1, into: &buf) case let .VpTokenCreate(v1): - writeInt(&buf, Int32(20)) + writeInt(&buf, Int32(18)) FfiConverterString.write(v1, into: &buf) case let .JwkParse(v1): - writeInt(&buf, Int32(21)) + writeInt(&buf, Int32(19)) FfiConverterString.write(v1, into: &buf) case .VdcCollectionNotInitialized: - writeInt(&buf, Int32(22)) + writeInt(&buf, Int32(20)) case .AuthorizationRequestNotFound: - writeInt(&buf, Int32(23)) + writeInt(&buf, Int32(21)) case .RequestSignerNotFound: - writeInt(&buf, Int32(24)) + writeInt(&buf, Int32(22)) case let .MetadataInitialization(v1): - writeInt(&buf, Int32(25)) + writeInt(&buf, Int32(23)) FfiConverterString.write(v1, into: &buf) - case let .PermissionResponse(v1): + case let .PermissionRequest(v1): + writeInt(&buf, Int32(24)) + FfiConverterTypePermissionRequestError.write(v1, into: &buf) + + + case let .Presentation(v1): + writeInt(&buf, Int32(25)) + FfiConverterTypePresentationError.write(v1, into: &buf) + + + case let .CredentialEncoding(v1): writeInt(&buf, Int32(26)) - FfiConverterTypePermissionResponseError.write(v1, into: &buf) + FfiConverterTypeCredentialEncodingError.write(v1, into: &buf) + + + case let .JsonPathParse(v1): + writeInt(&buf, Int32(27)) + FfiConverterString.write(v1, into: &buf) + + + case let .EmptyCredentialSubject(v1): + writeInt(&buf, Int32(28)) + FfiConverterString.write(v1, into: &buf) } } @@ -7620,10 +7682,6 @@ public enum PermissionRequestError { * Permission denied for requested presentation. */ case PermissionDenied - /** - * RwLock error - */ - case RwLockError /** * Credential not found for input descriptor id. */ @@ -7647,6 +7705,16 @@ public enum PermissionRequestError { */ case CredentialPresentation(String ) + case RwLock(String + ) + case PresentationSigning(String + ) + case CryptographicSuite(String + ) + case VerificationMethod(String + ) + case Presentation(PresentationError + ) } @@ -7661,20 +7729,34 @@ public struct FfiConverterTypePermissionRequestError: FfiConverterRustBuffer { case 1: return .PermissionDenied - case 2: return .RwLockError - case 3: return .CredentialNotFound( + case 2: return .CredentialNotFound( try FfiConverterString.read(from: &buf) ) - case 4: return .InputDescriptorNotFound( + case 3: return .InputDescriptorNotFound( try FfiConverterString.read(from: &buf) ) - case 5: return .InvalidSelectedCredential( + case 4: return .InvalidSelectedCredential( try FfiConverterString.read(from: &buf), try FfiConverterString.read(from: &buf) ) - case 6: return .CredentialPresentation( + case 5: return .CredentialPresentation( + try FfiConverterString.read(from: &buf) + ) + case 6: return .RwLock( + try FfiConverterString.read(from: &buf) + ) + case 7: return .PresentationSigning( try FfiConverterString.read(from: &buf) ) + case 8: return .CryptographicSuite( + try FfiConverterString.read(from: &buf) + ) + case 9: return .VerificationMethod( + try FfiConverterString.read(from: &buf) + ) + case 10: return .Presentation( + try FfiConverterTypePresentationError.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -7691,100 +7773,59 @@ public struct FfiConverterTypePermissionRequestError: FfiConverterRustBuffer { writeInt(&buf, Int32(1)) - case .RwLockError: - writeInt(&buf, Int32(2)) - - case let .CredentialNotFound(v1): - writeInt(&buf, Int32(3)) + writeInt(&buf, Int32(2)) FfiConverterString.write(v1, into: &buf) case let .InputDescriptorNotFound(v1): - writeInt(&buf, Int32(4)) + writeInt(&buf, Int32(3)) FfiConverterString.write(v1, into: &buf) case let .InvalidSelectedCredential(v1,v2): - writeInt(&buf, Int32(5)) + writeInt(&buf, Int32(4)) FfiConverterString.write(v1, into: &buf) FfiConverterString.write(v2, into: &buf) case let .CredentialPresentation(v1): - writeInt(&buf, Int32(6)) + writeInt(&buf, Int32(5)) FfiConverterString.write(v1, into: &buf) - } - } -} - - -extension PermissionRequestError: Equatable, Hashable {} - -extension PermissionRequestError: Foundation.LocalizedError { - public var errorDescription: String? { - String(reflecting: self) - } -} - - -public enum PermissionResponseError { - - - - case JsonPathParse(String - ) - case CredentialEncoding(CredentialEncodingError - ) -} - - -public struct FfiConverterTypePermissionResponseError: FfiConverterRustBuffer { - typealias SwiftType = PermissionResponseError - - public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PermissionResponseError { - let variant: Int32 = try readInt(&buf) - switch variant { - - - - case 1: return .JsonPathParse( - try FfiConverterString.read(from: &buf) - ) - case 2: return .CredentialEncoding( - try FfiConverterTypeCredentialEncodingError.read(from: &buf) - ) - - default: throw UniffiInternalError.unexpectedEnumCase - } - } - - public static func write(_ value: PermissionResponseError, into buf: inout [UInt8]) { - switch value { - + case let .RwLock(v1): + writeInt(&buf, Int32(6)) + FfiConverterString.write(v1, into: &buf) + - + case let .PresentationSigning(v1): + writeInt(&buf, Int32(7)) + FfiConverterString.write(v1, into: &buf) + + case let .CryptographicSuite(v1): + writeInt(&buf, Int32(8)) + FfiConverterString.write(v1, into: &buf) + - case let .JsonPathParse(v1): - writeInt(&buf, Int32(1)) + case let .VerificationMethod(v1): + writeInt(&buf, Int32(9)) FfiConverterString.write(v1, into: &buf) - case let .CredentialEncoding(v1): - writeInt(&buf, Int32(2)) - FfiConverterTypeCredentialEncodingError.write(v1, into: &buf) + case let .Presentation(v1): + writeInt(&buf, Int32(10)) + FfiConverterTypePresentationError.write(v1, into: &buf) } } } -extension PermissionResponseError: Equatable, Hashable {} +extension PermissionRequestError: Equatable, Hashable {} -extension PermissionResponseError: Foundation.LocalizedError { +extension PermissionRequestError: Foundation.LocalizedError { public var errorDescription: String? { String(reflecting: self) } @@ -7875,6 +7916,88 @@ extension PopError: Foundation.LocalizedError { } +public enum PresentationError { + + + + case Signing(String + ) + case CryptographicSuite(String + ) + case VerificationMethod(String + ) + case Jwk(String + ) +} + + +public struct FfiConverterTypePresentationError: FfiConverterRustBuffer { + typealias SwiftType = PresentationError + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PresentationError { + let variant: Int32 = try readInt(&buf) + switch variant { + + + + + case 1: return .Signing( + try FfiConverterString.read(from: &buf) + ) + case 2: return .CryptographicSuite( + try FfiConverterString.read(from: &buf) + ) + case 3: return .VerificationMethod( + try FfiConverterString.read(from: &buf) + ) + case 4: return .Jwk( + try FfiConverterString.read(from: &buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + public static func write(_ value: PresentationError, into buf: inout [UInt8]) { + switch value { + + + + + + case let .Signing(v1): + writeInt(&buf, Int32(1)) + FfiConverterString.write(v1, into: &buf) + + + case let .CryptographicSuite(v1): + writeInt(&buf, Int32(2)) + FfiConverterString.write(v1, into: &buf) + + + case let .VerificationMethod(v1): + writeInt(&buf, Int32(3)) + FfiConverterString.write(v1, into: &buf) + + + case let .Jwk(v1): + writeInt(&buf, Int32(4)) + FfiConverterString.write(v1, into: &buf) + + } + } +} + + +extension PresentationError: Equatable, Hashable {} + +extension PresentationError: Foundation.LocalizedError { + public var errorDescription: String? { + String(reflecting: self) + } +} + + public enum RequestError { @@ -8744,6 +8867,288 @@ extension VerificationResult: Equatable, Hashable {} + + + +/** + * The `PresentationSigner` foreign callback interface to be implemented + * by the host environment, e.g. Kotlin or Swift. + * + * Signing is handled after the authorization request is reviewed and authorized + * and the credentials for presentation have been selected. + * + * The payload for signing is determined by the credential format and the encoding + * type of the `vp_token`. + * + * For example, in the case of `JwtVc` credential format, + * the signing payload consists of the JWT header and payload (JWS). + */ +public protocol PresentationSigner : AnyObject { + + /** + * Sign the payload with the private key and return the signature. + * + * The signing algorithm must match the `cryptosuite()` method result. + */ + func sign(payload: Data) async throws -> Data + + /** + * Return the algorithm used for signing the vp token. + * + * E.g., "ES256" + */ + func algorithm() -> Algorithm + + /** + * Return the verification method associated with the signing key. + */ + func verificationMethod() async -> String + + /** + * Return the `DID` of the signing key. + */ + func did() -> String + + /** + * Data Integrity Cryptographic Suite of the Signer. + * + * This corresponds to the `proof_type` in the + * authorization request corresponding to the + * format of the verifiable presentation, e.g, + * `ldp_vp`, `jwt_vp`. + * + * + * E.g., JsonWebSignature2020, ecdsa-rdfc-2019 + */ + func cryptosuite() -> CryptosuiteString + + /** + * Return the public JWK of the signing key. + * as a String-encoded JSON + */ + func jwk() -> String + +} + + + +// Put the implementation in a struct so we don't pollute the top-level namespace +fileprivate struct UniffiCallbackInterfacePresentationSigner { + + // Create the VTable using a series of closures. + // Swift automatically converts these into C callback functions. + static var vtable: UniffiVTableCallbackInterfacePresentationSigner = UniffiVTableCallbackInterfacePresentationSigner( + sign: { ( + uniffiHandle: UInt64, + payload: RustBuffer, + uniffiFutureCallback: @escaping UniffiForeignFutureCompleteRustBuffer, + uniffiCallbackData: UInt64, + uniffiOutReturn: UnsafeMutablePointer + ) in + let makeCall = { + () async throws -> Data in + guard let uniffiObj = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.get(handle: uniffiHandle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return try await uniffiObj.sign( + payload: try FfiConverterData.lift(payload) + ) + } + + let uniffiHandleSuccess = { (returnValue: Data) in + uniffiFutureCallback( + uniffiCallbackData, + UniffiForeignFutureStructRustBuffer( + returnValue: FfiConverterData.lower(returnValue), + callStatus: RustCallStatus() + ) + ) + } + let uniffiHandleError = { (statusCode, errorBuf) in + uniffiFutureCallback( + uniffiCallbackData, + UniffiForeignFutureStructRustBuffer( + returnValue: RustBuffer.empty(), + callStatus: RustCallStatus(code: statusCode, errorBuf: errorBuf) + ) + ) + } + let uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( + makeCall: makeCall, + handleSuccess: uniffiHandleSuccess, + handleError: uniffiHandleError, + lowerError: FfiConverterTypePresentationError.lower + ) + uniffiOutReturn.pointee = uniffiForeignFuture + }, + algorithm: { ( + uniffiHandle: UInt64, + uniffiOutReturn: UnsafeMutablePointer, + uniffiCallStatus: UnsafeMutablePointer + ) in + let makeCall = { + () throws -> Algorithm in + guard let uniffiObj = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.get(handle: uniffiHandle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return uniffiObj.algorithm( + ) + } + + + let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeAlgorithm.lower($0) } + uniffiTraitInterfaceCall( + callStatus: uniffiCallStatus, + makeCall: makeCall, + writeReturn: writeReturn + ) + }, + verificationMethod: { ( + uniffiHandle: UInt64, + uniffiFutureCallback: @escaping UniffiForeignFutureCompleteRustBuffer, + uniffiCallbackData: UInt64, + uniffiOutReturn: UnsafeMutablePointer + ) in + let makeCall = { + () async throws -> String in + guard let uniffiObj = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.get(handle: uniffiHandle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return await uniffiObj.verificationMethod( + ) + } + + let uniffiHandleSuccess = { (returnValue: String) in + uniffiFutureCallback( + uniffiCallbackData, + UniffiForeignFutureStructRustBuffer( + returnValue: FfiConverterString.lower(returnValue), + callStatus: RustCallStatus() + ) + ) + } + let uniffiHandleError = { (statusCode, errorBuf) in + uniffiFutureCallback( + uniffiCallbackData, + UniffiForeignFutureStructRustBuffer( + returnValue: RustBuffer.empty(), + callStatus: RustCallStatus(code: statusCode, errorBuf: errorBuf) + ) + ) + } + let uniffiForeignFuture = uniffiTraitInterfaceCallAsync( + makeCall: makeCall, + handleSuccess: uniffiHandleSuccess, + handleError: uniffiHandleError + ) + uniffiOutReturn.pointee = uniffiForeignFuture + }, + did: { ( + uniffiHandle: UInt64, + uniffiOutReturn: UnsafeMutablePointer, + uniffiCallStatus: UnsafeMutablePointer + ) in + let makeCall = { + () throws -> String in + guard let uniffiObj = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.get(handle: uniffiHandle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return uniffiObj.did( + ) + } + + + let writeReturn = { uniffiOutReturn.pointee = FfiConverterString.lower($0) } + uniffiTraitInterfaceCall( + callStatus: uniffiCallStatus, + makeCall: makeCall, + writeReturn: writeReturn + ) + }, + cryptosuite: { ( + uniffiHandle: UInt64, + uniffiOutReturn: UnsafeMutablePointer, + uniffiCallStatus: UnsafeMutablePointer + ) in + let makeCall = { + () throws -> CryptosuiteString in + guard let uniffiObj = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.get(handle: uniffiHandle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return uniffiObj.cryptosuite( + ) + } + + + let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeCryptosuiteString.lower($0) } + uniffiTraitInterfaceCall( + callStatus: uniffiCallStatus, + makeCall: makeCall, + writeReturn: writeReturn + ) + }, + jwk: { ( + uniffiHandle: UInt64, + uniffiOutReturn: UnsafeMutablePointer, + uniffiCallStatus: UnsafeMutablePointer + ) in + let makeCall = { + () throws -> String in + guard let uniffiObj = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.get(handle: uniffiHandle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return uniffiObj.jwk( + ) + } + + + let writeReturn = { uniffiOutReturn.pointee = FfiConverterString.lower($0) } + uniffiTraitInterfaceCall( + callStatus: uniffiCallStatus, + makeCall: makeCall, + writeReturn: writeReturn + ) + }, + uniffiFree: { (uniffiHandle: UInt64) -> () in + let result = try? FfiConverterCallbackInterfacePresentationSigner.handleMap.remove(handle: uniffiHandle) + if result == nil { + print("Uniffi callback interface PresentationSigner: handle missing in uniffiFree") + } + } + ) +} + +private func uniffiCallbackInitPresentationSigner() { + uniffi_mobile_sdk_rs_fn_init_callback_vtable_presentationsigner(&UniffiCallbackInterfacePresentationSigner.vtable) +} + +// FfiConverter protocol for callback interfaces +fileprivate struct FfiConverterCallbackInterfacePresentationSigner { + fileprivate static var handleMap = UniffiHandleMap() +} + +extension FfiConverterCallbackInterfacePresentationSigner : FfiConverter { + typealias SwiftType = PresentationSigner + typealias FfiType = UInt64 + + public static func lift(_ handle: UInt64) throws -> SwiftType { + try handleMap.get(handle: handle) + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { + let handle: UInt64 = try readInt(&buf) + return try lift(handle) + } + + public static func lower(_ v: SwiftType) -> UInt64 { + return handleMap.insert(obj: v) + } + + public static func write(_ v: SwiftType, into buf: inout [UInt8]) { + writeInt(&buf, lower(v)) + } +} + fileprivate struct FfiConverterOptionInt64: FfiConverterRustBuffer { typealias SwiftType = Int64? @@ -9444,6 +9849,40 @@ fileprivate struct FfiConverterDictionaryTypeNamespaceSequenceTypeElement: FfiCo } +/** + * Typealias from the type name used in the UDL file to the builtin type. This + * is needed because the UDL type name is used in function/method signatures. + */ +public typealias Algorithm = String +public struct FfiConverterTypeAlgorithm: FfiConverter { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Algorithm { + return try FfiConverterString.read(from: &buf) + } + + public static func write(_ value: Algorithm, into buf: inout [UInt8]) { + return FfiConverterString.write(value, into: &buf) + } + + public static func lift(_ value: RustBuffer) throws -> Algorithm { + return try FfiConverterString.lift(value) + } + + public static func lower(_ value: Algorithm) -> RustBuffer { + return FfiConverterString.lower(value) + } +} + + +public func FfiConverterTypeAlgorithm_lift(_ value: RustBuffer) throws -> Algorithm { + return try FfiConverterTypeAlgorithm.lift(value) +} + +public func FfiConverterTypeAlgorithm_lower(_ value: Algorithm) -> RustBuffer { + return FfiConverterTypeAlgorithm.lower(value) +} + + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -9478,6 +9917,40 @@ public func FfiConverterTypeCredentialType_lower(_ value: CredentialType) -> Rus +/** + * Typealias from the type name used in the UDL file to the builtin type. This + * is needed because the UDL type name is used in function/method signatures. + */ +public typealias CryptosuiteString = String +public struct FfiConverterTypeCryptosuiteString: FfiConverter { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CryptosuiteString { + return try FfiConverterString.read(from: &buf) + } + + public static func write(_ value: CryptosuiteString, into buf: inout [UInt8]) { + return FfiConverterString.write(value, into: &buf) + } + + public static func lift(_ value: RustBuffer) throws -> CryptosuiteString { + return try FfiConverterString.lift(value) + } + + public static func lower(_ value: CryptosuiteString) -> RustBuffer { + return FfiConverterString.lower(value) + } +} + + +public func FfiConverterTypeCryptosuiteString_lift(_ value: RustBuffer) throws -> CryptosuiteString { + return try FfiConverterTypeCryptosuiteString.lift(value) +} + +public func FfiConverterTypeCryptosuiteString_lower(_ value: CryptosuiteString) -> RustBuffer { + return FfiConverterTypeCryptosuiteString.lower(value) +} + + + /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -10249,7 +10722,7 @@ private var initializationResult: InitializationResult = { if (uniffi_mobile_sdk_rs_checksum_method_parsedcredential_type() != 60750) { return InitializationResult.apiChecksumMismatch } - if (uniffi_mobile_sdk_rs_checksum_method_permissionrequest_create_permission_response() != 23487) { + if (uniffi_mobile_sdk_rs_checksum_method_permissionrequest_create_permission_response() != 16918) { return InitializationResult.apiChecksumMismatch } if (uniffi_mobile_sdk_rs_checksum_method_permissionrequest_credentials() != 38374) { @@ -10261,6 +10734,9 @@ private var initializationResult: InitializationResult = { if (uniffi_mobile_sdk_rs_checksum_method_permissionrequest_requested_fields() != 48174) { return InitializationResult.apiChecksumMismatch } + if (uniffi_mobile_sdk_rs_checksum_method_permissionresponse_selected_credentials() != 47291) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_mobile_sdk_rs_checksum_method_requestedfield_name() != 19474) { return InitializationResult.apiChecksumMismatch } @@ -10324,10 +10800,10 @@ private var initializationResult: InitializationResult = { if (uniffi_mobile_sdk_rs_checksum_constructor_delegatedverifier_new_client() != 15415) { return InitializationResult.apiChecksumMismatch } - if (uniffi_mobile_sdk_rs_checksum_constructor_holder_new() != 41846) { + if (uniffi_mobile_sdk_rs_checksum_constructor_holder_new() != 7151) { return InitializationResult.apiChecksumMismatch } - if (uniffi_mobile_sdk_rs_checksum_constructor_holder_new_with_credentials() != 3358) { + if (uniffi_mobile_sdk_rs_checksum_constructor_holder_new_with_credentials() != 8617) { return InitializationResult.apiChecksumMismatch } if (uniffi_mobile_sdk_rs_checksum_constructor_ihttpclient_new_async() != 55307) { @@ -10372,6 +10848,9 @@ private var initializationResult: InitializationResult = { if (uniffi_mobile_sdk_rs_checksum_constructor_oid4vci_new_with_sync_client() != 31928) { return InitializationResult.apiChecksumMismatch } + if (uniffi_mobile_sdk_rs_checksum_constructor_parsedcredential_new_from_json() != 1837) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_mobile_sdk_rs_checksum_constructor_parsedcredential_new_jwt_vc_json() != 56340) { return InitializationResult.apiChecksumMismatch } @@ -10399,10 +10878,29 @@ private var initializationResult: InitializationResult = { if (uniffi_mobile_sdk_rs_checksum_constructor_vdccollection_new() != 31236) { return InitializationResult.apiChecksumMismatch } + if (uniffi_mobile_sdk_rs_checksum_method_presentationsigner_sign() != 27180) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_mobile_sdk_rs_checksum_method_presentationsigner_algorithm() != 48923) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_mobile_sdk_rs_checksum_method_presentationsigner_verification_method() != 21787) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_mobile_sdk_rs_checksum_method_presentationsigner_did() != 14569) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_mobile_sdk_rs_checksum_method_presentationsigner_cryptosuite() != 63070) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_mobile_sdk_rs_checksum_method_presentationsigner_jwk() != 12828) { + return InitializationResult.apiChecksumMismatch + } uniffiCallbackInitAsyncHttpClient() uniffiCallbackInitStorageManagerInterface() uniffiCallbackInitSyncHttpClient() + uniffiCallbackInitPresentationSigner() return InitializationResult.ok }() diff --git a/src/common.rs b/src/common.rs index e31503e0..9a04e078 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,6 +1,7 @@ use crate::UniffiCustomTypeConverter; use serde::{Deserialize, Serialize}; +use ssi::{claims::data_integrity::CryptosuiteString, crypto::Algorithm}; pub use url::Url; pub use uuid::Uuid; @@ -85,3 +86,36 @@ uniffi::custom_newtype!(Value, Vec); #[derive(Debug, PartialEq)] pub struct Value(pub Vec); + +uniffi::custom_type!(Algorithm, String); +impl UniffiCustomTypeConverter for Algorithm { + type Builtin = String; + + fn into_custom(alg: Self::Builtin) -> uniffi::Result { + // NOTE: `Algorithm` lacks a `From<&str>` implementation, but implements + // deserialize trait to use `serde_json::from_str` to parse the string. + // + // TODO: provide a `From<&str>` implementation for `Algorithm` in the `ssi` crate. + serde_json::from_str(&alg).map_err(|e| { + uniffi::deps::anyhow::anyhow!("failed to serialize algorithm value: {e:?}") + }) + } + + fn from_custom(alg: Self) -> Self::Builtin { + alg.to_string() + } +} + +uniffi::custom_type!(CryptosuiteString, String); +impl UniffiCustomTypeConverter for CryptosuiteString { + type Builtin = String; + + fn into_custom(suite: Self::Builtin) -> uniffi::Result { + Self::new(suite) + .map_err(|e| uniffi::deps::anyhow::anyhow!("failed to create cryptosuite: {e:?}")) + } + + fn from_custom(suite: Self) -> Self::Builtin { + suite.to_string() + } +} diff --git a/src/credential/json_vc.rs b/src/credential/json_vc.rs index 3ca2b52a..73ec0d3c 100644 --- a/src/credential/json_vc.rs +++ b/src/credential/json_vc.rs @@ -1,16 +1,54 @@ -use super::{Credential, CredentialFormat, VcdmVersion}; -use crate::{oid4vp::permission_request::RequestedField, CredentialType, KeyAlias}; +use super::{Credential, CredentialEncodingError, CredentialFormat, VcdmVersion}; +use crate::{ + oid4vp::{ + error::OID4VPError, + presentation::{CredentialPresentation, PresentationOptions}, + }, + CredentialType, KeyAlias, +}; use std::sync::Arc; -use openid4vp::core::presentation_definition::PresentationDefinition; +use openid4vp::{ + core::{ + credential_format::ClaimFormatDesignation, presentation_submission::DescriptorMap, + response::parameters::VpTokenItem, + }, + JsonPath, +}; use serde_json::Value as Json; use ssi::{ - claims::vc::{v1::Credential as _, v2::Credential as _}, - prelude::AnyJsonCredential, + claims::vc::{ + syntax::{IdOr, NonEmptyObject, NonEmptyVec}, + v1::{Credential as _, JsonPresentation as JsonPresentationV1}, + v2::{ + syntax::JsonPresentation as JsonPresentationV2, Credential as _, + JsonCredential as JsonCredentialV2, + }, + }, + json_ld::iref::UriBuf, + prelude::{AnyJsonCredential, AnyJsonPresentation}, }; use uuid::Uuid; +#[derive(Debug, uniffi::Error, thiserror::Error)] +pub enum JsonVcInitError { + #[error("failed to decode a W3C VCDM (v1 or v2) Credential from JSON")] + CredentialDecoding, + #[error("failed to encode the credential as a UTF-8 string")] + CredentialStringEncoding, + #[error("failed to decode JSON from bytes")] + JsonBytesDecoding, + #[error("failed to decode JSON from a UTF-8 string")] + JsonStringDecoding, +} + +#[derive(Debug, uniffi::Error, thiserror::Error)] +pub enum JsonVcEncodingError { + #[error("failed to encode JSON as bytes")] + JsonBytesEncoding, +} + #[derive(uniffi::Object, Debug, Clone)] /// A verifiable credential secured as JSON. pub struct JsonVc { @@ -118,38 +156,89 @@ impl JsonVc { })) } - /// Check if the credential satisfies a presentation definition. - pub fn check_presentation_definition(&self, definition: &PresentationDefinition) -> bool { - // If the credential does not match the definition requested format, - // then return false. - if !definition.format().is_empty() - && !definition.contains_format(CredentialFormat::LdpVc.to_string().as_str()) - { - return false; + pub fn format() -> CredentialFormat { + CredentialFormat::LdpVc + } +} + +impl CredentialPresentation for JsonVc { + type Credential = Json; + type CredentialFormat = ClaimFormatDesignation; + type PresentationFormat = ClaimFormatDesignation; + + fn credential(&self) -> &Self::Credential { + &self.raw + } + + fn presentation_format(&self) -> Self::PresentationFormat { + ClaimFormatDesignation::LdpVp + } + + fn credential_format(&self) -> Self::CredentialFormat { + ClaimFormatDesignation::LdpVc + } + + fn create_descriptor_map( + &self, + input_descriptor_id: impl Into, + index: Option, + ) -> Result { + let path = match index { + Some(idx) => format!("$.verifiableCredential[{idx}]"), + None => "$.verifiableCredential".into(), } + .parse() + .map_err(|e| OID4VPError::JsonPathParse(format!("{e:?}")))?; + + let id = input_descriptor_id.into(); - // Check the JSON-encoded credential against the definition. - definition.is_credential_match(&self.raw) + Ok( + DescriptorMap::new(id.clone(), self.presentation_format(), JsonPath::default()) + .set_path_nested(DescriptorMap::new(id, self.credential_format(), path)), + ) } - /// Returns the requested fields given a presentation definition. - pub fn requested_fields( + /// Return the credential as a VpToken + async fn as_vp_token_item<'a>( &self, - definition: &PresentationDefinition, - ) -> Vec> { - let Ok(json) = serde_json::to_value(&self.parsed) else { - // NOTE: if we cannot convert the credential to a JSON value, then we cannot - // check the presentation definition, so we return false. - log::debug!("credential could not be converted to JSON: {self:?}"); - return Vec::new(); + options: &'a PresentationOptions<'a>, + ) -> Result { + let id = UriBuf::new(format!("urn:uuid:{}", Uuid::new_v4()).as_bytes().to_vec()) + .map_err(|e| CredentialEncodingError::VpToken(format!("Error parsing ID: {e:?}")))?; + + // Check the signer supports the requested vp format crypto suite. + options.supports_security_method(ClaimFormatDesignation::LdpVp)?; + + let unsigned_presentation = match self.parsed.clone() { + AnyJsonCredential::V1(cred_v1) => { + let holder_id: UriBuf = options.signer.did().parse().map_err(|e| { + CredentialEncodingError::VpToken(format!("Error parsing DID: {e:?}")) + })?; + + let unsigned_presentation_v1 = + JsonPresentationV1::new(Some(id.clone()), Some(holder_id), vec![cred_v1]); + + AnyJsonPresentation::V1(unsigned_presentation_v1) + } + AnyJsonCredential::V2(cred_v2) => { + // Convert inner type of `Object` -> `NonEmptyObject`. + let cred_v2 = try_map_subjects(cred_v2, NonEmptyObject::try_from_object) + .map_err(|e| OID4VPError::EmptyCredentialSubject(format!("{e:?}")))?; + + let holder_id = IdOr::Id(options.signer.did().parse().map_err(|e| { + CredentialEncodingError::VpToken(format!("Error parsing DID: {e:?}")) + })?); + + let unsigned_presentation_v2 = + JsonPresentationV2::new(Some(id), vec![holder_id], vec![cred_v2]); + + AnyJsonPresentation::V2(unsigned_presentation_v2) + } }; - definition - .requested_fields(&json) - .into_iter() - .map(Into::into) - .map(Arc::new) - .collect() + let signed_presentation = options.sign_presentation(unsigned_presentation).await?; + + Ok(VpTokenItem::from(signed_presentation)) } } @@ -161,20 +250,34 @@ impl TryFrom for Arc { } } -#[derive(Debug, uniffi::Error, thiserror::Error)] -pub enum JsonVcInitError { - #[error("failed to decode a W3C VCDM (v1 or v2) Credential from JSON")] - CredentialDecoding, - #[error("failed to encode the credential as a UTF-8 string")] - CredentialStringEncoding, - #[error("failed to decode JSON from bytes")] - JsonBytesDecoding, - #[error("failed to decode JSON from a UTF-8 string")] - JsonStringDecoding, -} - -#[derive(Debug, uniffi::Error, thiserror::Error)] -pub enum JsonVcEncodingError { - #[error("failed to encode JSON as bytes")] - JsonBytesEncoding, +// NOTE: This is an temporary solution to convert an inner type of a credential, +// i.e. `Object` -> `NonEmptyObject`. +// +// This should be removed once fixed in ssi crate. +fn try_map_subjects( + cred: JsonCredentialV2, + f: impl FnMut(T) -> Result, +) -> Result, OID4VPError> { + Ok(JsonCredentialV2 { + context: cred.context, + id: cred.id, + types: cred.types, + credential_subjects: NonEmptyVec::try_from_vec( + cred.credential_subjects + .into_iter() + .map(f) + .collect::>() + .map_err(|e| OID4VPError::EmptyCredentialSubject(format!("{e:?}")))?, + ) + .map_err(|e| OID4VPError::EmptyCredentialSubject(format!("{e:?}")))?, + issuer: cred.issuer, + valid_from: cred.valid_from, + valid_until: cred.valid_until, + credential_status: cred.credential_status, + terms_of_use: cred.terms_of_use, + evidence: cred.evidence, + credential_schema: cred.credential_schema, + refresh_services: cred.refresh_services, + extra_properties: cred.extra_properties, + }) } diff --git a/src/credential/jwt_vc.rs b/src/credential/jwt_vc.rs index 60b65ef2..628185f7 100644 --- a/src/credential/jwt_vc.rs +++ b/src/credential/jwt_vc.rs @@ -1,14 +1,22 @@ -use super::{Credential, CredentialFormat, VcdmVersion}; -use crate::{oid4vp::permission_request::RequestedField, CredentialType, KeyAlias}; +use super::{Credential, CredentialEncodingError, CredentialFormat, VcdmVersion}; +use crate::{ + oid4vp::{ + error::OID4VPError, + presentation::{CredentialPresentation, PresentationOptions}, + }, + CredentialType, KeyAlias, +}; use std::sync::Arc; use base64::prelude::*; use openid4vp::core::{ - presentation_definition::PresentationDefinition, response::parameters::VpTokenItem, + credential_format::ClaimFormatDesignation, presentation_submission::DescriptorMap, + response::parameters::VpTokenItem, }; use ssi::{ claims::{ + jws::Header, jwt::IntoDecodedJwt, vc::v1::{Credential as _, JsonCredential, JsonPresentation}, JwsString, @@ -153,65 +161,120 @@ impl JwtVc { &self.credential } - /// Check if the credential satisfies a presentation definition. - pub fn check_presentation_definition(&self, definition: &PresentationDefinition) -> bool { - // If the credential does not match the definition requested format, - // then return false. - if !definition.format().is_empty() - && !definition.contains_format(CredentialFormat::JwtVcJson.to_string().as_str()) - { - return false; - } + pub fn format() -> CredentialFormat { + CredentialFormat::JwtVcJson + } +} - let Ok(json) = serde_json::to_value(&self.credential) else { - // NOTE: if we cannot convert the credential to a JSON value, then we cannot - // check the presentation definition, so we return false. - // - tracing::debug!( - "failed to convert credential '{}' to json, so continuing to the next credential", - self.id() - ); - return false; - }; +impl CredentialPresentation for JwtVc { + type Credential = JsonCredential; + type CredentialFormat = ClaimFormatDesignation; + type PresentationFormat = ClaimFormatDesignation; - // Check the JSON-encoded credential against the definition. - definition.is_credential_match(&json) + fn credential(&self) -> &Self::Credential { + &self.credential } - /// Returns the requested fields given a presentation definition. - pub fn requested_fields( - &self, - definition: &PresentationDefinition, - ) -> Vec> { - let Ok(json) = serde_json::to_value(&self.credential) else { - // NOTE: if we cannot convert the credential to a JSON value, then we cannot - // check the presentation definition, so we return false. - log::debug!("credential could not be converted to JSON: {self:?}"); - return Vec::new(); - }; + fn presentation_format(&self) -> Self::PresentationFormat { + ClaimFormatDesignation::JwtVp + } - definition - .requested_fields(&json) - .into_iter() - .map(Into::into) - .map(Arc::new) - .collect() + fn credential_format(&self) -> Self::CredentialFormat { + ClaimFormatDesignation::JwtVcJson } /// Return the credential as a VpToken - pub fn as_vp_token(&self) -> VpTokenItem { + async fn as_vp_token_item<'a>( + &self, + options: &'a PresentationOptions<'a>, + ) -> Result { let id = UriBuf::new(format!("urn:uuid:{}", Uuid::new_v4()).as_bytes().to_vec()).ok(); + let vm = options.verification_method_id().await?; + let holder_id = options.signer.did().parse().ok(); - // TODO: determine how the holder ID should be set. - let holder_id = None; + // NOTE: JwtVc types are ALWAYS VCDM 1.1, + // therefore using the v1::syntax::JsonPresentation type. + let vp = JsonPresentation::new(id, holder_id, vec![self.credential.clone()]); - // NOTE: JwtVc types are ALWAYS VCDM 1.1, therefore using the v1::syntax::JsonPresentation - // type. - VpTokenItem::from(JsonPresentation::new( - id, - holder_id, - vec![self.credential.clone()], - )) + let iat = time::OffsetDateTime::now_utc().unix_timestamp(); + let exp = iat + 3600; + + let iss = options.issuer(); + let aud = options.audience(); + let nonce = options.nonce(); + let subject = options.subject(); + + let key_id = Some(vm.to_string()); + let algorithm = serde_json::from_str::(&options.signer.cryptosuite()) + .map_err(|e| { + CredentialEncodingError::VpToken(format!("Invalid Signing Algorithm: {e:?}")) + })?; + + let header = Header { + // NOTE: The algorithm should match the signing + // algorithm of the key used to sign the vp token. + algorithm, + key_id, + ..Default::default() + }; + + let header_b64: String = serde_json::to_vec(&header) + .map(|b| BASE64_URL_SAFE_NO_PAD.encode(b)) + .map_err(|e| CredentialEncodingError::VpToken(format!("{e:?}")))?; + + let claims = serde_json::json!({ + "iat": iat, + "exp": exp, + "iss": iss, + "sub": subject, + "aud": aud, + "nonce": nonce, + "vp": vp, + }); + + println!("Claims: {claims:?}"); + + let body_b64 = serde_json::to_vec(&claims) + .map(|b| BASE64_URL_SAFE_NO_PAD.encode(b)) + .map_err(|e| CredentialEncodingError::VpToken(format!("{e:?}")))?; + + let unsigned_vp_token_jwt = format!("{header_b64}.{body_b64}"); + + // Sign the `vp_token` if a `signer` is provided in the `VpTokenOptions`. + let signature = options + .signer + .sign(unsigned_vp_token_jwt.as_bytes().to_vec()) + .await + .map_err(|e| CredentialEncodingError::VpToken(format!("{e:?}")))?; + + let signature_b64 = BASE64_URL_SAFE_NO_PAD.encode(&signature); + + Ok(VpTokenItem::String(format!( + "{unsigned_vp_token_jwt}.{signature_b64}" + ))) + } + + fn create_descriptor_map( + &self, + input_descriptor_id: impl Into, + index: Option, + ) -> Result { + let path = match index { + Some(idx) => format!("$.verifiableCredential[{idx}]"), + None => "$.verifiableCredential".into(), + } + .parse() + .map_err(|e| OID4VPError::JsonPathParse(format!("{e:?}")))?; + + let id = input_descriptor_id.into(); + let vp_path = "$.vp" + .parse() + .map_err(|e| OID4VPError::JsonPathParse(format!("{e:?}")))?; + + Ok( + DescriptorMap::new(id.clone(), self.presentation_format(), vp_path) + .set_path_nested(DescriptorMap::new(id, self.credential_format(), path)), + ) } } diff --git a/src/credential/mod.rs b/src/credential/mod.rs index 1080ce2d..6ac767ac 100644 --- a/src/credential/mod.rs +++ b/src/credential/mod.rs @@ -5,12 +5,20 @@ pub mod vcdm2_sd_jwt; use std::sync::Arc; -use crate::{oid4vp::permission_request::RequestedField, CredentialType, KeyAlias, Uuid}; +use crate::{ + oid4vp::{ + error::OID4VPError, + permission_request::RequestedField, + presentation::{CredentialPresentation, PresentationError, PresentationOptions}, + }, + CredentialType, KeyAlias, Uuid, +}; use json_vc::{JsonVc, JsonVcEncodingError, JsonVcInitError}; use jwt_vc::{JwtVc, JwtVcInitError}; use mdoc::{Mdoc, MdocEncodingError, MdocInitError}; use openid4vp::core::{ - presentation_definition::PresentationDefinition, response::parameters::VpTokenItem, + presentation_definition::PresentationDefinition, presentation_submission::DescriptorMap, + response::parameters::VpTokenItem, }; use serde::{Deserialize, Serialize}; use vcdm2_sd_jwt::{SdJwtError, VCDM2SdJwt}; @@ -59,6 +67,13 @@ pub(crate) enum ParsedCredentialInner { #[uniffi::export] impl ParsedCredential { + #[uniffi::constructor] + pub fn new_from_json(json_string: String) -> Result, CredentialDecodingError> { + let credential: Credential = serde_json::from_str(&json_string) + .map_err(|e| CredentialDecodingError::Serialization(format!("{e:?}")))?; + credential.try_into_parsed() + } + #[uniffi::constructor] /// Construct a new `mso_mdoc` credential. pub fn new_mso_mdoc(mdoc: Arc) -> Arc { @@ -228,13 +243,17 @@ impl ParsedCredential { // Intneral Parsed Credential methods impl ParsedCredential { /// Check if the credential satisfies a presentation definition. - pub fn check_presentation_definition(&self, definition: &PresentationDefinition) -> bool { + pub fn satisfies_presentation_definition(&self, definition: &PresentationDefinition) -> bool { match &self.inner { - ParsedCredentialInner::JwtVcJson(vc) => vc.check_presentation_definition(definition), - ParsedCredentialInner::JwtVcJsonLd(vc) => vc.check_presentation_definition(definition), - ParsedCredentialInner::LdpVc(vc) => vc.check_presentation_definition(definition), + ParsedCredentialInner::JwtVcJson(vc) => { + vc.satisfies_presentation_definition(definition) + } + ParsedCredentialInner::JwtVcJsonLd(vc) => { + vc.satisfies_presentation_definition(definition) + } + ParsedCredentialInner::LdpVc(vc) => vc.satisfies_presentation_definition(definition), ParsedCredentialInner::VCDM2SdJwt(sd_jwt) => { - sd_jwt.check_presentation_definition(definition) + sd_jwt.satisfies_presentation_definition(definition) } ParsedCredentialInner::MsoMdoc(_mdoc) => false, } @@ -256,15 +275,46 @@ impl ParsedCredential { } } - /// Return a VP Token for the credential. - pub fn as_vp_token(&self) -> Result { + /// Return a VP Token from the credential, given provided + /// options for constructing the VP Token. + pub async fn as_vp_token<'a>( + &self, + options: &'a PresentationOptions<'a>, + ) -> Result { match &self.inner { - ParsedCredentialInner::VCDM2SdJwt(sd_jwt) => Ok(sd_jwt.as_vp_token()), - ParsedCredentialInner::JwtVcJson(vc) => Ok(vc.as_vp_token()), + ParsedCredentialInner::VCDM2SdJwt(sd_jwt) => sd_jwt.as_vp_token_item(options).await, + ParsedCredentialInner::JwtVcJson(vc) => vc.as_vp_token_item(options).await, + ParsedCredentialInner::LdpVc(vc) => vc.as_vp_token_item(options).await, _ => Err(CredentialEncodingError::VpToken(format!( "Credential encoding for VP Token is not implemented for {:?}.", self.inner, - ))), + )) + .into()), + } + } + + /// Return the descriptor map with the associated format type of the inner credential. + pub fn create_descriptor_map( + self: &Arc, + input_descriptor_id: impl Into, + index: Option, + ) -> Result { + match &self.inner { + ParsedCredentialInner::VCDM2SdJwt(sd_jwt) => { + sd_jwt.create_descriptor_map(input_descriptor_id, index) + } + ParsedCredentialInner::JwtVcJson(vc) => { + vc.create_descriptor_map(input_descriptor_id, index) + } + ParsedCredentialInner::JwtVcJsonLd(vc) => { + vc.create_descriptor_map(input_descriptor_id, index) + } + ParsedCredentialInner::LdpVc(vc) => { + vc.create_descriptor_map(input_descriptor_id, index) + } + ParsedCredentialInner::MsoMdoc(_mdoc) => { + unimplemented!("Mdoc create descriptor map not implemented") + } } } } @@ -308,6 +358,8 @@ pub enum CredentialEncodingError { SdJwt(#[from] SdJwtError), #[error("VP Token encoding error: {0}")] VpToken(String), + #[error(transparent)] + Presentation(#[from] PresentationError), } #[derive(Debug, uniffi::Error, thiserror::Error)] diff --git a/src/credential/vcdm2_sd_jwt.rs b/src/credential/vcdm2_sd_jwt.rs index 76a2417f..30303060 100644 --- a/src/credential/vcdm2_sd_jwt.rs +++ b/src/credential/vcdm2_sd_jwt.rs @@ -1,10 +1,17 @@ use super::{Credential, CredentialFormat, ParsedCredential, ParsedCredentialInner}; -use crate::{oid4vp::permission_request::RequestedField, CredentialType, KeyAlias}; +use crate::{ + oid4vp::{ + error::OID4VPError, + presentation::{CredentialPresentation, PresentationOptions}, + }, + CredentialType, KeyAlias, +}; use std::sync::Arc; use openid4vp::core::{ - presentation_definition::PresentationDefinition, response::parameters::VpTokenItem, + credential_format::ClaimFormatDesignation, presentation_submission::DescriptorMap, + response::parameters::VpTokenItem, }; use ssi::{ claims::{ @@ -14,7 +21,6 @@ use ssi::{ }, prelude::AnyJsonCredential, }; -use uniffi::deps::log; use uuid::Uuid; #[derive(Debug, uniffi::Object)] @@ -49,64 +55,8 @@ impl VCDM2SdJwt { }) } - /// Check if the credential satisfies a presentation definition. - pub fn check_presentation_definition(&self, definition: &PresentationDefinition) -> bool { - // If the credential does not match the definition requested format, - // then return false. - if !definition.format().is_empty() - && !definition.contains_format(CredentialFormat::VCDM2SdJwt.to_string().as_str()) - { - println!( - "Credential does not match the requested format: {:?}.", - definition.format() - ); - - return false; - } - - let Ok(json) = serde_json::to_value(&self.credential) else { - // NOTE: if we cannot convert the credential to a JSON value, then we cannot - // check the presentation definition, so we return false. - // - // TODO: add logging to indicate that the credential could not be converted to JSON. - return false; - }; - - // Check the JSON-encoded credential against the definition. - definition.is_credential_match(&json) - } - - /// Return the requested fields for the SD-JWT credential. - pub fn requested_fields( - &self, - definition: &PresentationDefinition, - ) -> Vec> { - let Ok(json) = serde_json::to_value(&self.credential) else { - // NOTE: if we cannot convert the credential to a JSON value, then we cannot - // check the presentation definition, so we return false. - log::debug!("credential could not be converted to JSON: {self:?}"); - return Vec::new(); - }; - - definition - .requested_fields(&json) - .into_iter() - .map(Into::into) - .map(Arc::new) - .collect() - } - - /// Return the credential as a VpToken - pub fn as_vp_token(&self) -> VpTokenItem { - // TODO: need to provide the "filtered" (disclosed) fields of the - // credential to be encoded into the VpToken. - // - // Currently, this is encoding the entire revealed SD-JWT, - // without the selection of individual disclosed fields. - // - // We need to selectively disclosed fields. - let compact: &str = self.inner.as_ref(); - VpTokenItem::String(compact.to_string()) + fn format() -> CredentialFormat { + CredentialFormat::VCDM2SdJwt } } @@ -162,6 +112,59 @@ impl VCDM2SdJwt { } } +impl CredentialPresentation for VCDM2SdJwt { + type Credential = ssi::claims::vc::v2::SpecializedJsonCredential; + type CredentialFormat = ClaimFormatDesignation; + type PresentationFormat = ClaimFormatDesignation; + + fn credential(&self) -> &Self::Credential { + &self.credential + } + + fn presentation_format(&self) -> Self::PresentationFormat { + ClaimFormatDesignation::Other(Self::format().to_string()) + } + + fn credential_format(&self) -> Self::CredentialFormat { + ClaimFormatDesignation::Other(Self::format().to_string()) + } + + /// Return the credential as a VpToken + async fn as_vp_token_item<'a>( + &self, + _options: &'a PresentationOptions<'a>, + ) -> Result { + // TODO: need to provide the "filtered" (disclosed) fields of the + // credential to be encoded into the VpToken. + // + // Currently, this is encoding the entire revealed SD-JWT, + // without the selection of individual disclosed fields. + // + // We need to selectively disclosed fields. + let compact: &str = self.inner.as_ref(); + Ok(VpTokenItem::String(compact.to_string())) + } + + fn create_descriptor_map( + &self, + input_descriptor_id: impl Into, + index: Option, + ) -> Result { + let path = match index { + Some(i) => format!("$[{i}]"), + None => "$".into(), + } + .parse() + .map_err(|e| OID4VPError::JsonPathParse(format!("{e:?}")))?; + + Ok(DescriptorMap::new( + input_descriptor_id, + self.credential_format(), + path, + )) + } +} + impl From for ParsedCredential { fn from(value: VCDM2SdJwt) -> Self { ParsedCredential { diff --git a/src/oid4vci/http_client.rs b/src/oid4vci/http_client.rs index e4eaadf4..2699b70f 100644 --- a/src/oid4vci/http_client.rs +++ b/src/oid4vci/http_client.rs @@ -150,7 +150,7 @@ pub trait AsyncHttpClient: Send + Sync { async fn http_client(&self, request: HttpRequest) -> Result; } -impl<'a, 'c> ExtAsyncHttpClient<'c> for IArc { +impl<'c> ExtAsyncHttpClient<'c> for IArc { type Error = HttpClientError; type Future = Pin> + Send + 'c>>; diff --git a/src/oid4vp/error.rs b/src/oid4vp/error.rs index eb27bb0c..77545830 100644 --- a/src/oid4vp/error.rs +++ b/src/oid4vp/error.rs @@ -1,6 +1,8 @@ // use super::request_signer::RequestSignerError; -use super::permission_request::PermissionResponseError; +use crate::credential::CredentialEncodingError; + +use super::{permission_request::PermissionRequestError, presentation::PresentationError}; /// The [OID4VPError] enum represents the errors that can occur /// when using the oid4vp foreign library. @@ -26,10 +28,6 @@ pub enum OID4VPError { InvalidDIDUrl(String), #[error("Failed to generate DID key URL: {0}")] DIDKeyGenerateUrl(String), - #[error("Failed to encode credential: {0}")] - CredentialEncodingError(String), - #[error("Failed to decode credential: {0}")] - CredentialDecodingError(String), #[error("Failed to parse JSON syntax: {0}")] JsonSyntaxParse(String), #[error(transparent)] @@ -57,7 +55,15 @@ pub enum OID4VPError { #[error("Failed to initialize metadata: {0}")] MetadataInitialization(String), #[error(transparent)] - PermissionResponse(#[from] PermissionResponseError), + PermissionRequest(#[from] PermissionRequestError), + #[error(transparent)] + Presentation(#[from] PresentationError), + #[error(transparent)] + CredentialEncoding(#[from] CredentialEncodingError), + #[error("Failed to parse JsonPath: {0}")] + JsonPathParse(String), + #[error("Empty Credential Subject. Failed to convert `Object` to `NonEmptyObject`: {0}")] + EmptyCredentialSubject(String), } // Handle unexpected errors when calling a foreign callback diff --git a/src/oid4vp/holder.rs b/src/oid4vp/holder.rs index 67e9a78b..849af7e7 100644 --- a/src/oid4vp/holder.rs +++ b/src/oid4vp/holder.rs @@ -1,5 +1,6 @@ use super::error::OID4VPError; use super::permission_request::*; +use super::presentation::PresentationSigner; use crate::common::*; use crate::credential::*; use crate::vdc_collection::VdcCollection; @@ -46,6 +47,9 @@ pub struct Holder { /// Provide optional credentials to the holder instance. pub(crate) provided_credentials: Option>>, + + /// Foreign Interface for the [PresentationSigner] + pub(crate) signer: Arc>, } #[uniffi::export(async_runtime = "tokio")] @@ -55,6 +59,7 @@ impl Holder { pub async fn new( vdc_collection: Arc, trusted_dids: Vec, + signer: Box, ) -> Result, OID4VPError> { let client = openid4vp::core::util::ReqwestClient::new() .map_err(|e| OID4VPError::HttpClientInitialization(format!("{e:?}")))?; @@ -65,6 +70,7 @@ impl Holder { metadata: Self::metadata()?, trusted_dids, provided_credentials: None, + signer: Arc::new(signer), })) } @@ -77,6 +83,7 @@ impl Holder { pub async fn new_with_credentials( provided_credentials: Vec>, trusted_dids: Vec, + signer: Box, ) -> Result, OID4VPError> { let client = openid4vp::core::util::ReqwestClient::new() .map_err(|e| OID4VPError::HttpClientInitialization(format!("{e:?}")))?; @@ -87,6 +94,7 @@ impl Holder { metadata: Self::metadata()?, trusted_dids, provided_credentials: Some(provided_credentials), + signer: Arc::new(signer), })) } @@ -100,11 +108,15 @@ impl Holder { url: Url, // Callback here to allow for review of untrusted DIDs. ) -> Result, OID4VPError> { + uniffi::deps::log::debug!("Url: {url:?}"); + let request = self .validate_request(url) .await .map_err(|e| OID4VPError::RequestValidation(format!("{e:?}")))?; + println!("Authorization Request: {request:?}"); + match request.response_mode() { ResponseMode::DirectPost | ResponseMode::DirectPostJwt => { self.permission_request(request).await @@ -144,7 +156,7 @@ impl Holder { metadata // Insert support for the DID client ID scheme. - .add_client_id_schemes_supported(ClientIdScheme::Did) + .add_client_id_schemes_supported(&[ClientIdScheme::Did]) .map_err(|e| OID4VPError::MetadataInitialization(format!("{e:?}")))?; Ok(metadata) @@ -175,7 +187,7 @@ impl Holder { } .into_iter() .filter_map( - |cred| match cred.check_presentation_definition(definition) { + |cred| match cred.satisfies_presentation_definition(definition) { true => Some(cred), false => None, }, @@ -205,13 +217,15 @@ impl Holder { presentation_definition.clone(), credentials.clone(), request, + self.signer.clone(), )) } } #[async_trait::async_trait] impl RequestVerifier for Holder { - /// Performs verification on Authorization Request Objects when `client_id_scheme` is `did`. + /// Performs verification on Authorization Request Objects + /// when `client_id_scheme` is `did`. async fn did( &self, decoded_request: &AuthorizationRequestObject, @@ -252,10 +266,58 @@ impl OID4VPWallet for Holder { } #[cfg(test)] -mod tests { +pub(crate) mod tests { + use crate::{ + did::DidMethod, + oid4vp::presentation::{PresentationError, PresentationSigner}, + }; + use super::*; + use ssi::{ + claims::{data_integrity::CryptosuiteString, jws::JwsSigner}, + crypto::Algorithm, + JWK, + }; use vcdm2_sd_jwt::VCDM2SdJwt; + #[derive(Debug)] + pub(crate) struct KeySigner { + pub(crate) jwk: JWK, + } + + #[async_trait::async_trait] + impl PresentationSigner for KeySigner { + async fn sign(&self, payload: Vec) -> Result, PresentationError> { + let sig = self + .jwk + .sign(payload) + .await + .expect("failed to sign Jws Payload"); + + Ok(sig.as_bytes().to_vec()) + } + + fn algorithm(&self) -> Algorithm { + self.jwk.algorithm.map(Algorithm::from).unwrap() + } + + async fn verification_method(&self) -> String { + DidMethod::Jwk.vm_from_jwk(&self.jwk()).await.unwrap() + } + + fn did(&self) -> String { + DidMethod::Jwk.did_from_jwk(&self.jwk()).unwrap() + } + + fn cryptosuite(&self) -> CryptosuiteString { + CryptosuiteString::new("ecdsa-rdfc-2019".to_string()).unwrap() + } + + fn jwk(&self) -> String { + serde_json::to_string(&self.jwk).unwrap() + } + } + // NOTE: This test requires the `companion` service to be running and // available at localhost:3000. // @@ -267,6 +329,8 @@ mod tests { let sd_jwt = VCDM2SdJwt::new_from_compact_sd_jwt(example_sd_jwt.into())?; let credential = ParsedCredential::new_sd_jwt(sd_jwt); + let jwk = JWK::generate_p256(); + let key_signer = KeySigner { jwk }; let initiate_api = "http://localhost:3000/api/oid4vp/initiate"; // Make a request to the OID4VP initiate API. @@ -288,6 +352,7 @@ mod tests { let holder = Holder::new_with_credentials( vec![credential], vec!["did:web:localhost%3A3000:oid4vp:client".into()], + Box::new(key_signer), ) .await?; @@ -306,15 +371,12 @@ mod tests { } // NOTE: passing `parsed_credentials` as `selected_credentials`. - let response = permission_request.create_permission_response(parsed_credentials); + let response = permission_request + .create_permission_response(parsed_credentials) + .await?; holder.submit_permission_response(response).await?; Ok(()) } - - #[tokio::test] - async fn test_vehicle_title() -> Result<(), Box> { - Ok(()) - } } diff --git a/src/oid4vp/mod.rs b/src/oid4vp/mod.rs index 29109948..d93d29a8 100644 --- a/src/oid4vp/mod.rs +++ b/src/oid4vp/mod.rs @@ -1,4 +1,5 @@ pub mod error; pub mod holder; pub mod permission_request; +pub mod presentation; pub mod verifier; diff --git a/src/oid4vp/permission_request.rs b/src/oid4vp/permission_request.rs index e7b690bd..684dfc37 100644 --- a/src/oid4vp/permission_request.rs +++ b/src/oid4vp/permission_request.rs @@ -1,16 +1,18 @@ -use openid4vp::core::authorization_request::AuthorizationRequestObject; -use openid4vp::core::presentation_definition::PresentationDefinition; -use openid4vp::core::presentation_submission::{DescriptorMap, PresentationSubmission}; -use openid4vp::core::response::parameters::{VpToken, VpTokenItem}; -use openid4vp::core::response::{AuthorizationResponse, UnencodedAuthorizationResponse}; - +use super::error::OID4VPError; +use super::presentation::{PresentationError, PresentationOptions, PresentationSigner}; use crate::common::*; -use crate::credential::{Credential, CredentialEncodingError, ParsedCredential}; +use crate::credential::{Credential, ParsedCredential}; use std::collections::HashMap; use std::fmt::Debug; use std::sync::{Arc, RwLock}; +use openid4vp::core::authorization_request::AuthorizationRequestObject; +use openid4vp::core::presentation_definition::PresentationDefinition; +use openid4vp::core::presentation_submission::{DescriptorMap, PresentationSubmission}; +use openid4vp::core::response::parameters::VpToken; +use openid4vp::core::response::{AuthorizationResponse, UnencodedAuthorizationResponse}; + /// Type alias for mapping input descriptor ids to matching credentials /// stored in the VDC collection. This mapping is used to provide a /// shared state between native code and the rust code, to select @@ -29,10 +31,6 @@ pub enum PermissionRequestError { #[error("Permission denied for requested presentation.")] PermissionDenied, - /// RwLock error - #[error("RwLock error.")] - RwLockError, - /// Credential not found for input descriptor id. #[error("Credential not found for input descriptor id: {0}")] CredentialNotFound(String), @@ -51,14 +49,21 @@ pub enum PermissionRequestError { /// failed to present the credential. #[error("Credential Presentation Error: {0}")] CredentialPresentation(String), -} -#[derive(uniffi::Error, thiserror::Error, Debug)] -pub enum PermissionResponseError { - #[error("Failed to parse JsonPath: {0}")] - JsonPathParse(String), + #[error("Failed to obtain permission request read/write lock: {0}")] + RwLock(String), + + #[error("Failed to cryptographically sign verifiable presentation: {0}")] + PresentationSigning(String), + + #[error("Invalid or Missing Cryptographic Suite: {0}")] + CryptographicSuite(String), + + #[error("Invalid Verification Method Identifier: {0}")] + VerificationMethod(String), + #[error(transparent)] - CredentialEncoding(#[from] CredentialEncodingError), + Presentation(#[from] PresentationError), } #[derive(Debug, uniffi::Object)] @@ -76,7 +81,7 @@ pub struct RequestedField { pub(crate) raw_fields: Vec, } -impl<'a> From> for RequestedField { +impl From> for RequestedField { fn from(value: openid4vp::core::input_descriptor::RequestedField) -> Self { Self { id: value.id, @@ -140,9 +145,10 @@ impl RequestedField { #[derive(Debug, Clone, uniffi::Object)] pub struct PermissionRequest { - definition: PresentationDefinition, - credentials: Vec>, - request: AuthorizationRequestObject, + pub(crate) definition: PresentationDefinition, + pub(crate) credentials: Vec>, + pub(crate) request: AuthorizationRequestObject, + pub(crate) signer: Arc>, } impl PermissionRequest { @@ -150,16 +156,18 @@ impl PermissionRequest { definition: PresentationDefinition, credentials: Vec>, request: AuthorizationRequestObject, + signer: Arc>, ) -> Arc { Arc::new(Self { definition, credentials, request, + signer, }) } } -#[uniffi::export] +#[uniffi::export(async_runtime = "tokio")] impl PermissionRequest { /// Return the filtered list of credentials that matched /// the presentation definition. @@ -175,15 +183,37 @@ impl PermissionRequest { } /// Construct a new permission response for the given credential. - pub fn create_permission_response( + pub async fn create_permission_response( &self, selected_credentials: Vec>, - ) -> Arc { - Arc::new(PermissionResponse { + ) -> Result, OID4VPError> { + // Ensure that the selected credentials are not empty. + if selected_credentials.is_empty() { + return Err(PermissionRequestError::InvalidSelectedCredential( + "No selected credentials".to_string(), + self.definition.credential_types_hint().join(", "), + ) + .into()); + } + + // Set options for constructing a verifiable presentation. + let options = PresentationOptions::new(&self.request, self.signer.clone()); + + let token_items = futures::future::try_join_all( + selected_credentials + .iter() + .map(|cred| cred.as_vp_token(&options)), + ) + .await?; + + let vp_token = VpToken(token_items); + + Ok(Arc::new(PermissionResponse { selected_credentials, presentation_definition: self.definition.clone(), authorization_request: self.request.clone(), - }) + vp_token, + })) } /// Return the purpose of the presentation request. @@ -200,19 +230,26 @@ impl PermissionRequest { /// explicitly setting the permission to true or false, based on the holder's decision. #[derive(Debug, Clone, uniffi::Object)] pub struct PermissionResponse { + // TODO: provide an optional internal mapping of `JsonPointer`s + // for selective disclosure that are selected as part of the requested fields. pub selected_credentials: Vec>, pub presentation_definition: PresentationDefinition, pub authorization_request: AuthorizationRequestObject, - // TODO: provide an optional internal mapping of `JsonPointer`s - // for selective disclosure that are selected as part of the requested fields. + pub vp_token: VpToken, +} + +#[uniffi::export] +impl PermissionResponse { + /// Return the selected credentials for the permission response. + pub fn selected_credentials(&self) -> Vec> { + self.selected_credentials.clone() + } } impl PermissionResponse { // Construct a DescriptorMap for the presentation submission based on the // credentials returned from the VDC collection. - pub fn create_descriptor_map(&self) -> Result, PermissionResponseError> { - let is_singular = self.selected_credentials.len() == 1; - + pub fn create_descriptor_map(&self) -> Result, OID4VPError> { self.presentation_definition .input_descriptors() // TODO: It is possible for an input descriptor to have multiple credentials, @@ -228,48 +265,23 @@ impl PermissionResponse { .zip(self.selected_credentials.iter()) .enumerate() .map(|(idx, (descriptor, cred))| { - let vc_path = if is_singular { - "$".to_string() - } else { - format!("$[{idx}]") - } - .parse() - .map_err(|e| PermissionResponseError::JsonPathParse(format!("{e:?}")))?; - - Ok(DescriptorMap::new( - descriptor.id.to_string(), - cred.format().to_string().as_str(), - vc_path, - )) + cred.create_descriptor_map(descriptor.id.clone(), Some(idx)) }) .collect() } - /// Create a VP token based on the selected credentials returned in the permission response. - pub fn create_vp_token(&self) -> Result { - let tokens = self - .selected_credentials - .iter() - .map(|cred| cred.as_vp_token()) - .collect::, CredentialEncodingError>>()?; - - Ok(VpToken(tokens)) - } - /// Return the authorization response object. - pub fn authorization_response(&self) -> Result { + pub fn authorization_response(&self) -> Result { Ok(AuthorizationResponse::Unencoded( UnencodedAuthorizationResponse { - vp_token: self.create_vp_token()?, + vp_token: self.vp_token.clone(), presentation_submission: self.create_presentation_submission()?, }, )) } /// Create a presentation submission based on the selected credentials returned in the permission response. - pub fn create_presentation_submission( - &self, - ) -> Result { + fn create_presentation_submission(&self) -> Result { Ok(PresentationSubmission::new( uuid::Uuid::new_v4(), self.presentation_definition.id().clone(), diff --git a/src/oid4vp/presentation.rs b/src/oid4vp/presentation.rs new file mode 100644 index 00000000..f06e9e9b --- /dev/null +++ b/src/oid4vp/presentation.rs @@ -0,0 +1,347 @@ +use super::{error::OID4VPError, permission_request::RequestedField}; + +use std::{ops::Deref, str::FromStr, sync::Arc}; + +use openid4vp::core::{ + authorization_request::AuthorizationRequestObject, credential_format::ClaimFormatDesignation, + presentation_definition::PresentationDefinition, presentation_submission::DescriptorMap, + response::parameters::VpTokenItem, +}; +use serde::Serialize; +use ssi::{ + claims::{ + data_integrity::{ + suites::JsonWebSignature2020, AnyInputSuiteOptions, AnyProtocol, CryptosuiteString, + }, + MessageSignatureError, + }, + crypto::{Algorithm, AlgorithmInstance}, + dids::{VerificationMethodDIDResolver, DIDJWK}, + json_ld::IriBuf, + prelude::{AnyJsonPresentation, AnySuite, CryptographicSuite, DataIntegrity, ProofOptions}, + verification_methods::{protocol::WithProtocol, MessageSigner, ProofPurpose}, + xsd::DateTimeStamp, + JWK, +}; +use uniffi::deps::log; + +#[derive(Debug, uniffi::Error, thiserror::Error)] +pub enum PresentationError { + #[error("Error signing presentation: {0}")] + Signing(String), + + #[error("Invalid or Missing Cryptographic Suite: {0}")] + CryptographicSuite(String), + + #[error("Invalid Verification Method Identifier: {0}")] + VerificationMethod(String), + + #[error("Failed to parse public JsonWebKey: {0}")] + JWK(String), +} +/// Credential Presentation trait defines the set of standard methods +/// each credential format must implement. +pub trait CredentialPresentation { + /// Presentation format is the expected format of the presentation. + /// + /// For example, JwtVp, LdpVp, etc. + type PresentationFormat: Into + std::fmt::Debug; + + /// Credential format is the format of the credential itself. + type CredentialFormat: Into + std::fmt::Debug; + + /// Credential value is the actual credential. + type Credential: Serialize; + + /// Return the credential format designation. + fn credential_format(&self) -> Self::CredentialFormat; + + /// Return the presentation format designation. + fn presentation_format(&self) -> Self::PresentationFormat; + + /// Return the credential + fn credential(&self) -> &Self::Credential; + + /// Method to check whether a credential satisfies a given + /// reference to a presentation definition. + fn satisfies_presentation_definition( + &self, + presentation_definition: &PresentationDefinition, + ) -> bool { + // If the credential does not match the definition requested format, + // then return false. + if !presentation_definition.format().is_empty() + && !presentation_definition.contains_format(self.credential_format()) + && !presentation_definition.contains_format(self.presentation_format()) + { + log::debug!( + "Credential does not match the presentation definition requested format: {:?}.", + presentation_definition.format() + ); + + return false; + } + + let Ok(json) = serde_json::to_value(self.credential()) else { + // NOTE: Instead of erroring here, we return false, which will + // indicate that the credential does not satisfy the presentation + // and the verifier can continue to the next credential. + // + // Still, we log an `error` here to alert that we were unable to serialize + // the value to JSON, which for the implementation of this trait should + // be a rare occurrence (ideally, never). + log::error!( + "Failed to serialize credential format, {:?}, into JSON.", + self.credential_format() + ); + return false; + }; + + // Check the JSON-encoded credential against the definition. + presentation_definition.is_credential_match(&json) + } + + /// Return the requested fields from the credential matching + /// the presentation definition. + fn requested_fields( + &self, + presentation_definition: &PresentationDefinition, + ) -> Vec> { + // Default implementation + let Ok(json) = serde_json::to_value(self.credential()) else { + // NOTE: if we cannot convert the credential to a JSON value, then we cannot + // check the presentation definition, so we return false to allow for + // the holder to continue to the next credential. + log::error!( + "credential could not be converted to JSON: {:?}", + self.credential_format() + ); + return Vec::new(); + }; + + presentation_definition + .requested_fields(&json) + .into_iter() + .map(Into::into) + .map(Arc::new) + .collect() + } + + /// Create a descriptor map for the credential, + /// provided an input descriptor id and an index + /// of where the credential is located in the + /// presentation submission. + fn create_descriptor_map( + &self, + input_descriptor_id: impl Into, + index: Option, + ) -> Result; + + /// Return the credential as a verifiable presentation token item. + #[allow(async_fn_in_trait)] + async fn as_vp_token_item<'a>( + &self, + options: &'a PresentationOptions<'a>, + ) -> Result; +} + +/// The `PresentationSigner` foreign callback interface to be implemented +/// by the host environment, e.g. Kotlin or Swift. +/// +/// Signing is handled after the authorization request is reviewed and authorized +/// and the credentials for presentation have been selected. +/// +/// The payload for signing is determined by the credential format and the encoding +/// type of the `vp_token`. +/// +/// For example, in the case of `JwtVc` credential format, +/// the signing payload consists of the JWT header and payload (JWS). +#[uniffi::export(callback_interface)] +#[async_trait::async_trait] +pub trait PresentationSigner: Send + Sync + std::fmt::Debug { + /// Sign the payload with the private key and return the signature. + /// + /// The signing algorithm must match the `cryptosuite()` method result. + async fn sign(&self, payload: Vec) -> Result, PresentationError>; + + /// Return the algorithm used for signing the vp token. + /// + /// E.g., "ES256" + fn algorithm(&self) -> Algorithm; + + /// Return the verification method associated with the signing key. + async fn verification_method(&self) -> String; + + /// Return the `DID` of the signing key. + fn did(&self) -> String; + + /// Data Integrity Cryptographic Suite of the Signer. + /// + /// This corresponds to the `proof_type` in the + /// authorization request corresponding to the + /// format of the verifiable presentation, e.g, + /// `ldp_vp`, `jwt_vp`. + /// + /// + /// E.g., JsonWebSignature2020, ecdsa-rdfc-2019 + fn cryptosuite(&self) -> CryptosuiteString; + + /// Return the public JWK of the signing key. + /// as a String-encoded JSON + fn jwk(&self) -> String; +} + +/// Internal options for constructing a VP Token, and optionally signing it. +/// +/// PresentationOptions provides a means to pass metadata about the verifiable presentation +/// claims in the `vp_token` parameter. +#[derive(Clone)] +pub struct PresentationOptions<'a> { + /// Borrowed reference to the authorization request object. + pub(crate) request: &'a AuthorizationRequestObject, + /// Signing callback interface that can be used to sign the `vp_token`. + pub(crate) signer: Arc>, +} + +impl<'a> MessageSigner> for PresentationOptions<'a> { + #[allow(async_fn_in_trait)] + async fn sign( + self, + // NOTE: The `protocol` parameter is not used in this implementation, but it would + // be preferrable to have a `suite` parameter that would be used here instead. + // + // For example, `WithSuite` could accept a `AnySuite` type. This might already + // exist? But, I tried to change `AnyProtocol` to `AnySuite` to match against + // the [PresentationSigner::cryptosuite] method, but alas, this does not work + // with the `sign` method. + // + // TODO: Determine if there is a way to provide a `suite` parameter here. + WithProtocol(alg, _protocol): WithProtocol, + message: &[u8], + ) -> Result, MessageSignatureError> { + if !self.signer.algorithm().is_compatible_with(alg.algorithm()) { + return Err(MessageSignatureError::UnsupportedAlgorithm( + self.signer.algorithm().to_string(), + )); + } + + let signature = self + .signer + .sign(message.to_vec()) + .await + .map_err(|e| MessageSignatureError::signature_failed(format!("{e:?}")))?; + + Ok(signature) + } +} + +impl<'a, M> ssi::verification_methods::Signer for PresentationOptions<'a> +where + M: ssi::verification_methods::VerificationMethod, +{ + type MessageSigner = Self; + + #[allow(async_fn_in_trait)] + async fn for_method( + &self, + method: std::borrow::Cow<'_, M>, + ) -> Result, ssi::claims::SignatureError> { + Ok(method + .controller() + .filter(|ctrl| **ctrl == self.signer.did()) + .map(|_| self.clone())) + } +} + +impl<'a> PresentationOptions<'a> { + pub(crate) fn new( + request: &'a AuthorizationRequestObject, + signer: Arc>, + ) -> Self { + Self { request, signer } + } + + pub async fn verification_method_id(&self) -> Result { + self.signer + .verification_method() + .await + .parse() + .map_err(|e| PresentationError::VerificationMethod(format!("{e:?}"))) + } + + pub fn audience(&self) -> &String { + &self.request.client_id().0 + } + + pub fn nonce(&self) -> &String { + self.request.nonce().deref() + } + + pub fn issuer(&self) -> String { + self.signer.did() + } + + pub fn subject(&self) -> String { + self.signer.did() + } + + pub fn jwk(&self) -> Result { + JWK::from_str(&self.signer.jwk()).map_err(|e| PresentationError::JWK(format!("{e:?}"))) + } + + /// Validate the signing cryptosuite against the supported request algorithms. + pub fn supports_security_method( + &self, + format: impl Into, + ) -> Result<(), PresentationError> { + let format = format.into(); + let suite = self.signer.cryptosuite(); + + // Retrieve the vp_formats from the authorization request object. + let vp_formats = self + .request + .vp_formats() + .map_err(|e| PresentationError::CryptographicSuite(format!("{e:?}")))?; + + if !vp_formats.supports_security_method(&format, &suite.to_string()) { + let err_msg = format!("Cryptographic Suite not supported for this request format: {format:?} and suite: {suite:?}. Supported Cryptographic Suites: {vp_formats:?}"); + return Err(PresentationError::CryptographicSuite(err_msg)); + } + + Ok(()) + } + + /// Sign a JSON presentation type for a v1 OR v2 credential. + pub async fn sign_presentation( + &self, + // NOTE: the presentation is `unsecured` at this point. + presentation: AnyJsonPresentation, + ) -> Result, PresentationError> { + let resolver = VerificationMethodDIDResolver::new(DIDJWK); + + let proof_options = ProofOptions::new( + DateTimeStamp::now(), + self.verification_method_id().await?.into(), + ProofPurpose::Authentication, + AnyInputSuiteOptions { + public_key_jwk: self.jwk().map(Box::new).ok(), + ..Default::default() + }, + ); + + let suite = self.signer.cryptosuite(); + + // Use the cryptosuite-specific signing method to sign the presentation. + match suite.as_ref() { + "ecdsa-rdfc-2019" => AnySuite::EcdsaRdfc2019 + .sign(presentation, resolver, self, proof_options) + .await + .map_err(|e| PresentationError::Signing(format!("{e:?}"))), + JsonWebSignature2020::NAME => AnySuite::JsonWebSignature2020 + .sign(presentation, resolver, self, proof_options) + .await + .map_err(|e| PresentationError::Signing(format!("{e:?}"))), + _ => Err(PresentationError::CryptographicSuite(suite.to_string())), + } + } +} diff --git a/src/oid4vp/verifier.rs b/src/oid4vp/verifier.rs index 9fb6445a..43593049 100644 --- a/src/oid4vp/verifier.rs +++ b/src/oid4vp/verifier.rs @@ -115,9 +115,12 @@ impl DelegatedVerifier { #[cfg(test)] mod tests { + use ssi::JWK; + use super::*; use crate::credential::vcdm2_sd_jwt::VCDM2SdJwt; use crate::credential::*; + use crate::oid4vp::holder::tests::KeySigner; use crate::oid4vp::holder::*; // NOTE: This requires an instance of credible to be accessible @@ -127,6 +130,10 @@ mod tests { #[tokio::test] #[ignore] async fn test_delegated_verification() -> Result<(), Oid4vpVerifierError> { + let jwk = JWK::generate_p256(); + + let key_signer = KeySigner { jwk }; + let verifier = DelegatedVerifier::new_client(BASE_URL.parse().expect("Failed to parse Base URL")) .await @@ -150,9 +157,10 @@ mod tests { let trusted_dids = vec!["did:web:localhost%3A3003:colofwd_signer_service".to_string()]; - let holder = Holder::new_with_credentials(vec![credential], trusted_dids) - .await - .expect("failed to create oid4vp holder"); + let holder = + Holder::new_with_credentials(vec![credential], trusted_dids, Box::new(key_signer)) + .await + .expect("failed to create oid4vp holder"); let url = format!("openid4vp://?{auth_query}") .parse() @@ -167,7 +175,10 @@ mod tests { println!("Credential: {:?}", c); }); - let response = request.create_permission_response(request.credentials()); + let response = request + .create_permission_response(request.credentials()) + .await + .expect("failed to create permission response"); let url = holder.submit_permission_response(response).await; @@ -183,7 +194,6 @@ mod tests { assert!(oid4vp.is_some()); println!("Presentation: {:?}", oid4vp); - Ok(()) } } diff --git a/src/verifier/crypto.rs b/src/verifier/crypto.rs index c3da8c28..1ba2bca4 100644 --- a/src/verifier/crypto.rs +++ b/src/verifier/crypto.rs @@ -54,13 +54,13 @@ impl TryFrom<&[u8]> for CoseP256Signature { } } -impl<'a> cose_rs::algorithm::SignatureAlgorithm for CoseP256Verifier<'a> { +impl cose_rs::algorithm::SignatureAlgorithm for CoseP256Verifier<'_> { fn algorithm(&self) -> cose_rs::algorithm::Algorithm { cose_rs::algorithm::Algorithm::ES256 } } -impl<'a> signature::Verifier for CoseP256Verifier<'a> { +impl signature::Verifier for CoseP256Verifier<'_> { fn verify(&self, msg: &[u8], signature: &CoseP256Signature) -> Result<(), signature::Error> { // Construct DER signature. let mut seq: asn1::SequenceOf = asn1::SequenceOf::new();