From 9fed68f44cfc4346e8fa313770d66281810dd9e0 Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 13:14:50 +0200 Subject: [PATCH 01/24] update deps to git links to webauthn branches --- Cargo.lock | 485 +++++++++++++++++++++++++++++++---------- kepler-core/Cargo.toml | 2 +- lib/Cargo.toml | 25 ++- 3 files changed, 390 insertions(+), 122 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9408240b..b133d6b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -732,6 +732,12 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bigdecimal" version = "0.3.1" @@ -1058,6 +1064,32 @@ dependencies = [ "either", ] +[[package]] +name = "cacaos" +version = "0.5.0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/webauthn#ec7517b3c07403def693f8a6c9f458223310117a" +dependencies = [ + "async-trait", + "hex", + "http", + "iri-string", + "libipld 0.16.0", + "multidid", + "serde", + "serde_json", + "siwe", + "siwe-recap 0.2.0", + "ssi-dids", + "ssi-jwk", + "ssi-jwt", + "ssi-ucan", + "thiserror", + "time 0.3.23", + "ucan-capabilities-object", + "url", + "varsig", +] + [[package]] name = "cacaos" version = "0.5.1" @@ -1068,7 +1100,7 @@ dependencies = [ "hex", "http", "iri-string", - "libipld", + "libipld 0.14.0", "serde", "serde_with 2.3.3", "siwe", @@ -1152,6 +1184,33 @@ dependencies = [ "winapi", ] +[[package]] +name = "ciborium" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" + +[[package]] +name = "ciborium-ll" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "cid" version = "0.8.6" @@ -1166,6 +1225,20 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "cid" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd94671561e36e4e7de75f753f577edafb0e7c05d6e4547229fdf7938fbcd2c3" +dependencies = [ + "core2", + "multibase 0.9.1", + "multihash 0.18.1", + "serde", + "serde_bytes", + "unsigned-varint", +] + [[package]] name = "cipher" version = "0.4.4" @@ -1282,6 +1355,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "coset" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c765a4e852cef25c69a48e9fcd60995a7fecabf0134a0021e7181452c4a60f95" +dependencies = [ + "ciborium", + "ciborium-io", +] + [[package]] name = "cpufeatures" version = "0.2.9" @@ -1760,8 +1843,7 @@ dependencies = [ [[package]] name = "did-ethr" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d22b1adcd156bf1041f87f80cd027bf6f82a34849bada30d59b869e831df19d" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "chrono", @@ -1777,8 +1859,7 @@ dependencies = [ [[package]] name = "did-method-key" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543b322ff52ab4892f4fd30ceb8fa1007aca4e3c5e89ad55793036846f0cc74e" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "multibase 0.8.0", @@ -1793,8 +1874,7 @@ dependencies = [ [[package]] name = "did-onion" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e1ba10a5415931c5d436a6343bbd72673a42284a16d4acd501fbfb9d882db5" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "http", @@ -1807,11 +1887,10 @@ dependencies = [ [[package]] name = "did-pkh" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074c4ae82880d60a25048cd3bf2e8aaaa881922d7c73fbb9ec29fc67fa0d33e4" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", - "bech32", + "bech32 0.8.1", "bs58 0.4.0", "chrono", "iref", @@ -1827,8 +1906,7 @@ dependencies = [ [[package]] name = "did-tz" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562670fedf756b20c047dcf4ef88d020c5c86c2115f954fb3aef072952015ba4" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "anyhow", "async-trait", @@ -1847,9 +1925,8 @@ dependencies = [ [[package]] name = "did-web" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e239187ee5cf6b778c75252ad22bb8289508dcaf05a7c718222a3093460ca0d2" +version = "0.2.1" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "http", @@ -1861,8 +1938,7 @@ dependencies = [ [[package]] name = "did-webkey" version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88fb811ef9b08a872eac80c1d1bcb0cabf4cd6a205d75971d8864f06ea2a9c2a" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "anyhow", "async-trait", @@ -2492,6 +2568,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + [[package]] name = "hashbrown" version = "0.11.2" @@ -3134,7 +3216,7 @@ dependencies = [ "sea-orm", "sea-orm-migration", "serde", - "serde_ipld_dagcbor", + "serde_ipld_dagcbor 0.3.0", "serde_json", "ssi", "thiserror", @@ -3147,7 +3229,7 @@ version = "0.2.0" dependencies = [ "async-trait", "base64 0.13.1", - "cacaos", + "cacaos 0.5.0", "did-ethr", "did-method-key", "did-onion", @@ -3157,11 +3239,12 @@ dependencies = [ "did-webkey", "iri-string", "lazy_static", - "libipld", + "libipld 0.16.0", "serde", + "serde_ipld_dagcbor 0.4.1", "serde_json", "serde_with 1.14.0", - "siwe-recap", + "siwe-recap 0.2.0", "ssi", "thiserror", "tokio", @@ -3315,17 +3398,33 @@ dependencies = [ "async-trait", "cached", "fnv", - "libipld-cbor", - "libipld-cbor-derive", - "libipld-core", - "libipld-json", - "libipld-macro", + "libipld-cbor 0.14.0", + "libipld-cbor-derive 0.14.0", + "libipld-core 0.14.0", + "libipld-macro 0.14.0", "log", "multihash 0.16.3", "parking_lot 0.12.1", "thiserror", ] +[[package]] +name = "libipld" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1ccd6b8ffb3afee7081fcaec00e1b099fd1c7ccf35ba5729d88538fcc3b4599" +dependencies = [ + "fnv", + "libipld-cbor 0.16.0", + "libipld-cbor-derive 0.16.0", + "libipld-core 0.16.0", + "libipld-json", + "libipld-macro 0.16.0", + "log", + "multihash 0.18.1", + "thiserror", +] + [[package]] name = "libipld-cbor" version = "0.14.0" @@ -3333,7 +3432,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd1ab68c9d26f20c7d0dfea6eecbae8c00359875210001b33ca27d4a02f3d09" dependencies = [ "byteorder", - "libipld-core", + "libipld-core 0.14.0", + "thiserror", +] + +[[package]] +name = "libipld-cbor" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77d98c9d1747aa5eef1cf099cd648c3fd2d235249f5fed07522aaebc348e423b" +dependencies = [ + "byteorder", + "libipld-core 0.16.0", "thiserror", ] @@ -3350,6 +3460,19 @@ dependencies = [ "synstructure", ] +[[package]] +name = "libipld-cbor-derive" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5ba3a729b72973e456a1812b0afe2e176a376c1836cc1528e9fc98ae8cb838" +dependencies = [ + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + [[package]] name = "libipld-core" version = "0.14.0" @@ -3357,22 +3480,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d44790246ec6b7314cba745992c23d479d018073e66d49ae40ae1b64e5dd8eb5" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "core2", "multibase 0.9.1", "multihash 0.16.3", + "thiserror", +] + +[[package]] +name = "libipld-core" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5acd707e8d8b092e967b2af978ed84709eaded82b75effe6cb6f6cc797ef8158" +dependencies = [ + "anyhow", + "cid 0.10.1", + "core2", + "multibase 0.9.1", + "multihash 0.18.1", "serde", "thiserror", ] [[package]] name = "libipld-json" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18aa481a87f084d98473dd9ece253a9569c762b75f6bbba8217d54e48c9d63b3" +checksum = "25856def940047b07b25c33d4e66d248597049ab0202085215dc4dca0487731c" dependencies = [ - "libipld-core", - "multihash 0.16.3", + "libipld-core 0.16.0", + "multihash 0.18.1", "serde", "serde_json", ] @@ -3383,7 +3520,16 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852c011562ae5059b67c3a917f9f5945af5a68df8e39ede4444fff33274d25e2" dependencies = [ - "libipld-core", + "libipld-core 0.14.0", +] + +[[package]] +name = "libipld-macro" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71171c54214f866ae6722f3027f81dff0931e600e5a61e6b1b6a49ca0b5ed4ae" +dependencies = [ + "libipld-core 0.16.0", ] [[package]] @@ -3710,11 +3856,40 @@ dependencies = [ "data-encoding-macro", ] +[[package]] +name = "multidid" +version = "0.1.0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/webauthn#ec7517b3c07403def693f8a6c9f458223310117a" +dependencies = [ + "bech32 0.9.1", + "bs58 0.5.0", + "hex", + "iri-string", + "serde", + "sha3", + "thiserror", + "unsigned-varint", +] + [[package]] name = "multihash" version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" +dependencies = [ + "blake3", + "core2", + "multihash-derive", + "serde", + "serde-big-array", + "unsigned-varint", +] + +[[package]] +name = "multihash" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" dependencies = [ "blake2b_simd 1.0.1", "blake2s_simd", @@ -3886,6 +4061,26 @@ dependencies = [ "libc", ] +[[package]] +name = "nutype" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "060a7fdadbae85c7063375e8fb9dd88c9ac336a22d1f0eb2fefd53dbf98edcb5" +dependencies = [ + "nutype_macros", +] + +[[package]] +name = "nutype_macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0d2e869a6039d8b1d10f8a478f76538958808fbf95dae367875ee9635430b9" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "object" version = "0.31.1" @@ -4156,6 +4351,23 @@ dependencies = [ "windows-targets 0.48.1", ] +[[package]] +name = "passkey-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d50824f04736455af2ce22124c2a621475f1f1b1f261c05dc0f0730aea87e2" +dependencies = [ + "bitflags 1.3.2", + "ciborium", + "coset", + "data-encoding", + "rand 0.8.5", + "serde", + "sha2 0.10.7", + "strum", + "typeshare", +] + [[package]] name = "paste" version = "1.0.14" @@ -5485,7 +5697,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2433e94ffb5977e67afbd75733abd6ada1c4f497125894a8c89b3fdc5fd6a058" dependencies = [ "cbor4ii", - "cid", + "cid 0.8.6", + "scopeguard", + "serde", +] + +[[package]] +name = "serde_ipld_dagcbor" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74e4c1e1617be5feb2f03f629f8097f76b51373785a83a875453c2b04c880f4e" +dependencies = [ + "cbor4ii", + "cid 0.10.1", "scopeguard", "serde", ] @@ -5738,6 +5962,24 @@ dependencies = [ "thiserror", ] +[[package]] +name = "siwe-recap" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054c5aea5227ca44212d3029576602ebefce5179d584bdfcc842997c73cc40d9" +dependencies = [ + "base64 0.12.3", + "cid 0.10.1", + "iri-string", + "serde", + "serde_jcs", + "serde_json", + "serde_with 2.3.3", + "siwe", + "thiserror", + "ucan-capabilities-object", +] + [[package]] name = "slab" version = "0.4.8" @@ -5947,9 +6189,8 @@ dependencies = [ [[package]] name = "ssi" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a74add6dcfc3599495a73e953a7126ea19e9a0fc81860f5d593cabf1322cdf9" +version = "0.7.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "ssi-caips", "ssi-core", @@ -5959,7 +6200,7 @@ dependencies = [ "ssi-jwk", "ssi-jws", "ssi-jwt", - "ssi-ldp 0.2.1", + "ssi-ldp", "ssi-ssh", "ssi-tzkey", "ssi-ucan", @@ -5970,8 +6211,7 @@ dependencies = [ [[package]] name = "ssi-caips" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2c479690955bebece0279a5b1ab9d7d584402caed9f56ecec346d0bc63661f" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "bs58 0.4.0", "ssi-jwk", @@ -5981,14 +6221,12 @@ dependencies = [ [[package]] name = "ssi-contexts" version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3009b82cbae3d88a76f15460fb5fb3f30a1673eb0359ac6917ffaa3c57f7164" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" [[package]] name = "ssi-core" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e43f42016b80dc3e5eae8f7d2b22db3debbfe97b38e4fa449433497b3513048" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "serde", @@ -5998,8 +6236,7 @@ dependencies = [ [[package]] name = "ssi-crypto" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f41a12b15af9dce950a24a3295a2540be3b8500467621e31a97ddbe7618a5c8" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "bs58 0.4.0", "digest 0.9.0", @@ -6014,8 +6251,7 @@ dependencies = [ [[package]] name = "ssi-dids" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e3c375b0fb2129c691e65e776c9105290ade34b56f39755f4f9c40ba98e41c" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "anyhow", "async-trait", @@ -6041,8 +6277,7 @@ dependencies = [ [[package]] name = "ssi-json-ld" version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50912984a4f415dd419853d461938b2daaa428dcafb8a5dfcde8dc07371371da" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-std", "combination", @@ -6063,8 +6298,7 @@ dependencies = [ [[package]] name = "ssi-jwk" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3c376df0c00621f6d8de45249e901cf2b3868bef84cf785fbcbce62842d815" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "base64 0.12.3", "blake2b_simd 0.5.11", @@ -6092,8 +6326,7 @@ dependencies = [ [[package]] name = "ssi-jws" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9e36ec8624a4f81f21b0e407f1c2209c2cd89c0ff3c27b928999682b2e8912" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "base64 0.12.3", "blake2", @@ -6114,8 +6347,7 @@ dependencies = [ [[package]] name = "ssi-jwt" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46522391b37f4b749911bb29b3960a7e2e0b9936c7debf52035f431480b40123" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "chrono", "serde", @@ -6128,9 +6360,8 @@ dependencies = [ [[package]] name = "ssi-ldp" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de930bb18e3ed3c1f7b0a2b2b4fdba2887dffff34bb5f44b9967a983fea2d60c" +version = "0.3.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "bs58 0.4.0", @@ -6149,39 +6380,6 @@ dependencies = [ "serde", "serde_jcs", "serde_json", - "ssi-caips", - "ssi-contexts", - "ssi-core", - "ssi-crypto", - "ssi-dids", - "ssi-json-ld", - "ssi-jwk", - "ssi-jws", - "ssi-tzkey", - "static-iref", - "thiserror", -] - -[[package]] -name = "ssi-ldp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb057ad335a08d78deca3a7cf8f8393087ca99d64c038e97ff844ea66fbd475" -dependencies = [ - "async-trait", - "bs58 0.4.0", - "chrono", - "grdf", - "hex", - "iref", - "json-syntax", - "lazy_static", - "locspan", - "multibase 0.8.0", - "rdf-types", - "serde", - "serde_jcs", - "serde_json", "sha2 0.10.7", "ssi-caips", "ssi-contexts", @@ -6191,6 +6389,7 @@ dependencies = [ "ssi-json-ld", "ssi-jwk", "ssi-jws", + "ssi-tzkey", "static-iref", "thiserror", ] @@ -6198,8 +6397,7 @@ dependencies = [ [[package]] name = "ssi-ssh" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22967c7882e2457a2813badebf613a1b6ea3240f77ccac5c7c03858806d56618" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "sshkeys", "ssi-jwk", @@ -6209,8 +6407,7 @@ dependencies = [ [[package]] name = "ssi-tzkey" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b57d919e20d214253a9a8dbc5f3b08ff555364934d99a09c828becab27a823" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "bs58 0.4.0", "ed25519-dalek 1.0.1", @@ -6221,59 +6418,59 @@ dependencies = [ [[package]] name = "ssi-ucan" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0982f62c7860922026a9d9edc6c604de79693ee4c5c6bd65be11e2ff66b1df09" +version = "0.2.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "base64 0.12.3", "chrono", - "libipld", + "libipld 0.16.0", "serde", "serde_json", "serde_with 1.14.0", "ssi-caips", "ssi-core", + "ssi-crypto", "ssi-dids", "ssi-jwk", "ssi-jws", "ssi-jwt", "thiserror", + "ucan-capabilities-object", + "varsig", ] [[package]] name = "ssi-vc" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7a9a9dc254d976962fea4501ed40097b8a7c23c15f076a7f46fa97ed886bc7" +version = "0.2.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "base64 0.12.3", "bitvec 0.20.4", - "cacaos", + "cacaos 0.5.1", "chrono", "flate2", "iref", - "libipld", + "libipld 0.14.0", "multihash 0.16.3", "reqwest", "serde", "serde_json", - "siwe-recap", + "siwe-recap 0.1.0", "ssi-core", "ssi-dids", "ssi-json-ld", "ssi-jwk", "ssi-jws", "ssi-jwt", - "ssi-ldp 0.2.1", + "ssi-ldp", "thiserror", ] [[package]] name = "ssi-zcap-ld" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8380152589e8876e91bb765ce1b363909bc071788c1550bfdb730152c5b7afe" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" dependencies = [ "async-trait", "iref", @@ -6283,7 +6480,7 @@ dependencies = [ "ssi-dids", "ssi-json-ld", "ssi-jwk", - "ssi-ldp 0.3.0", + "ssi-ldp", "thiserror", ] @@ -6342,6 +6539,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + [[package]] name = "subtle" version = "2.5.0" @@ -6818,6 +7037,28 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "typeshare" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f44d1a2f454cb35fbe05b218c410792697e76bd868f48d3a418f2cd1a7d527d6" +dependencies = [ + "chrono", + "serde", + "serde_json", + "typeshare-annotation", +] + +[[package]] +name = "typeshare-annotation" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc670d0e358428857cc3b4bf504c691e572fccaec9542ff09212d3f13d74b7a9" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "ubyte" version = "0.10.3" @@ -6827,6 +7068,18 @@ dependencies = [ "serde", ] +[[package]] +name = "ucan-capabilities-object" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f39597d86523b7f8028e7c05989fc64c1868f381e68ffc9c4b8540e5a891382" +dependencies = [ + "iri-string", + "nutype", + "serde", + "thiserror", +] + [[package]] name = "uint" version = "0.9.5" @@ -6946,6 +7199,18 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" +[[package]] +name = "varsig" +version = "0.1.0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/webauthn#ec7517b3c07403def693f8a6c9f458223310117a" +dependencies = [ + "passkey-types", + "serde", + "serde_json", + "thiserror", + "unsigned-varint", +] + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/kepler-core/Cargo.toml b/kepler-core/Cargo.toml index 315f3173..d79f0b70 100644 --- a/kepler-core/Cargo.toml +++ b/kepler-core/Cargo.toml @@ -23,7 +23,7 @@ time = "0.3" kepler-lib = { version = "0.2", path = "../lib" } libp2p = { version = "0.52.1", default-features = false, features = ["ed25519"] } thiserror = "1" -ssi = "0.6" +ssi = { version = "0.7", git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp" } serde = { version = "1", features = ["derive"] } serde_json = "1" serde_ipld_dagcbor = "0.3" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 3c447cc2..f102d24a 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -6,22 +6,23 @@ edition = "2021" [dependencies] async-trait = "0.1" iri-string = "0.6" -libipld = { version = "0.14", default-features = false, features = ["dag-cbor", "dag-json", "derive", "serde-codec"]} +libipld = { version = "0.16", default-features = false, features = ["dag-cbor", "dag-json", "derive", "serde-codec"]} serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_with = "1.0" thiserror = "1" base64 = "0.13" -cacaos = "0.5" -siwe-recap = "0.1.0" +cacaos = { git = "https://github.com/spruceid/cacao-rs", branch = "feat/webauthn" } +siwe-recap = "0.2.0" lazy_static = "1.4" -did-method-key = { default-features = false, version = "0.2" } -did-tz = { default-features = false, version = "0.2" } -did-ethr = { default-features = false, version = "0.2" } -did-pkh = { version = "0.2" } -did-web = { default-features = false, version = "0.2" } -did-webkey = { default-features = false, version = "0.2" } -did-onion = { default-features = false, version = "0.2" } +did-method-key = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +did-tz = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +did-ethr = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +did-pkh = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", version = "0.2" } +did-web = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +did-webkey = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +did-onion = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +serde_ipld_dagcbor = "0.4" [target.'cfg(target_arch = "wasm32")'.dependencies] uuid = { version = "1", features = ["v4", "js"] } @@ -30,7 +31,9 @@ uuid = { version = "1", features = ["v4", "js"] } uuid = { version = "1", features = ["v4"] } [dependencies.ssi] -version = "0.6" +git = "https://github.com/spruceid/ssi" +branch = "feat/webauthn-exp" +version = "0.7" default-features = false features = ["ed25519", "rsa", "secp256k1"] From a0ff69ea3112141aa770afc14defb3ca3af4f8ce Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 13:19:06 +0200 Subject: [PATCH 02/24] add new AnyResource type --- lib/src/lib.rs | 1 + lib/src/resource.rs | 196 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 153 insertions(+), 44 deletions(-) diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 9059f9da..6fda03f1 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -3,6 +3,7 @@ pub mod resolver; pub mod resource; pub use cacaos; +pub use iri_string; pub use libipld; pub use siwe_recap; pub use ssi; diff --git a/lib/src/resource.rs b/lib/src/resource.rs index 12274e0b..bc5b5a18 100644 --- a/lib/src/resource.rs +++ b/lib/src/resource.rs @@ -1,4 +1,7 @@ -use iri_string::{types::UriString, validate::Error as UriError}; +use iri_string::{ + types::{UriStr, UriString}, + validate::Error as UriError, +}; use libipld::{ cbor::DagCborCodec, cid::{ @@ -8,11 +11,9 @@ use libipld::{ codec::{Decode, Encode}, error::Error as IpldError, }; +use serde::{Deserialize, Serialize}; use serde_with::{DeserializeFromStr, SerializeDisplay}; -use ssi::{ - did::DIDURL, - ucan::{Capability, UcanResource, UcanScope}, -}; +use ssi::did::DIDURL; use std::io::{Read, Seek, Write}; use std::{convert::TryFrom, fmt, str::FromStr}; @@ -143,45 +144,6 @@ pub enum ResourceCapErr { MissingAction, } -impl TryInto for ResourceId { - type Error = ResourceCapErr; - fn try_into(self) -> Result { - Ok(Capability { - with: UcanResource::URI(ssi::vc::URI::String(format!( - "{}/{}{}", - &self.orbit, - &self.service.as_deref().unwrap_or(""), - &self.path.as_deref().unwrap_or("") - ))), - can: UcanScope { - namespace: match self.service { - Some(s) => format!("kepler.{s}"), - None => "kepler".to_string(), - }, - capability: self.fragment.ok_or(ResourceCapErr::MissingAction)?, - }, - additional_fields: None, - }) - } -} - -impl TryFrom<&Capability> for ResourceId { - type Error = KRIParseError; - fn try_from(c: &Capability) -> Result { - let n = &c.can.namespace; - let mut r = Self::from_str(&c.with.to_string())?; - if n.starts_with("kepler") - && ((n.get(6..7) == Some(".") && n.get(7..) == r.service.as_deref()) - || (n.get(6..7).is_none() && r.service.is_none())) - { - r.fragment = Some(c.can.capability.clone()); - Ok(r) - } else { - Err(KRIParseError::IncorrectForm) - } - } -} - #[derive(Error, Debug)] pub enum ResourceCheckError { #[error("Base and Extension Orbits do not match")] @@ -289,6 +251,27 @@ impl FromStr for ResourceId { } } +impl TryFrom for ResourceId { + type Error = KRIParseError; + fn try_from(u: UriString) -> Result { + u.as_str().parse() + } +} + +impl<'a> TryFrom<&'a UriStr> for ResourceId { + type Error = KRIParseError; + fn try_from(u: &'a UriStr) -> Result { + u.as_str().parse() + } +} + +impl TryFrom<&UriString> for ResourceId { + type Error = KRIParseError; + fn try_from(u: &UriString) -> Result { + u.as_str().parse() + } +} + impl Encode for ResourceId { fn encode(&self, c: DagCborCodec, w: &mut W) -> Result<(), IpldError> where @@ -307,6 +290,131 @@ impl Decode for ResourceId { } } +#[derive(Serialize, Deserialize, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[serde(untagged)] +pub enum AnyResource { + Kepler(ResourceId), + Other(O), +} + +impl AnyResource { + pub fn orbit(&self) -> Option<&OrbitId> { + match self { + AnyResource::Kepler(id) => Some(id.orbit()), + AnyResource::Other(_) => None, + } + } + + pub fn kepler_resource(&self) -> Option<&ResourceId> { + match self { + AnyResource::Kepler(id) => Some(id), + AnyResource::Other(_) => None, + } + } +} + +impl AnyResource +where + O: AsRef, +{ + pub fn extends>(&self, other: &AnyResource) -> bool { + match (self, other) { + (AnyResource::Kepler(a), AnyResource::Kepler(b)) => a.extends(b).is_ok(), + (AnyResource::Other(a), AnyResource::Other(b)) => a.as_ref().starts_with(b.as_ref()), + _ => false, + } + } +} + +impl From for AnyResource { + fn from(id: ResourceId) -> Self { + AnyResource::Kepler(id) + } +} + +impl<'a> From<&'a UriStr> for AnyResource<&'a UriStr> { + fn from(id: &'a UriStr) -> Self { + id.as_str() + .parse() + .map(AnyResource::Kepler) + .unwrap_or(AnyResource::Other(id)) + } +} + +impl<'a> From<&'a UriString> for AnyResource<&'a UriStr> { + fn from(id: &'a UriString) -> Self { + id.as_str() + .parse() + .map(AnyResource::Kepler) + .unwrap_or(AnyResource::Other(id)) + } +} + +impl From for AnyResource { + fn from(id: UriString) -> Self { + id.as_str() + .parse() + .map(AnyResource::Kepler) + .unwrap_or(AnyResource::Other(id)) + } +} + +impl From<&UriString> for AnyResource { + fn from(id: &UriString) -> Self { + id.as_str() + .parse() + .map(AnyResource::Kepler) + .unwrap_or(AnyResource::Other(id.clone())) + } +} + +impl From<&UriStr> for AnyResource { + fn from(id: &UriStr) -> Self { + id.as_str() + .parse() + .map(AnyResource::Kepler) + .unwrap_or(AnyResource::Other(id.to_owned())) + } +} + +impl<'a> From> for AnyResource<&'a UriStr> { + fn from(id: AnyResource<&'a UriString>) -> Self { + match id { + AnyResource::Kepler(id) => AnyResource::Kepler(id), + AnyResource::Other(id) => AnyResource::Other(id.as_ref()), + } + } +} + +impl<'a> From> for AnyResource { + fn from(id: AnyResource<&'a UriStr>) -> Self { + match id { + AnyResource::Kepler(id) => AnyResource::Kepler(id), + AnyResource::Other(id) => AnyResource::Other(id.to_owned()), + } + } +} + +impl std::fmt::Display for AnyResource { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + AnyResource::Kepler(resource_id) => write!(f, "{}", resource_id), + AnyResource::Other(s) => write!(f, "{}", s), + } + } +} + +impl FromStr for AnyResource { + type Err = KRIParseError; + fn from_str(s: &str) -> Result { + if s.starts_with("kepler:") { + Ok(AnyResource::Kepler(s.parse()?)) + } else { + Ok(AnyResource::Other(s.parse()?)) + } + } +} + #[cfg(test)] mod tests { use super::*; From 118ac0e245e0d990a24b61af2272e9302cb19f40 Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 13:19:59 +0200 Subject: [PATCH 03/24] set auth tokens to new cacao type --- lib/src/authorization.rs | 184 +++++++++++++++++++++++++-------------- 1 file changed, 120 insertions(+), 64 deletions(-) diff --git a/lib/src/authorization.rs b/lib/src/authorization.rs index 1254f10c..5cace70d 100644 --- a/lib/src/authorization.rs +++ b/lib/src/authorization.rs @@ -1,12 +1,16 @@ -use crate::resource::{ResourceCapErr, ResourceId}; -use cacaos::siwe_cacao::SiweCacao; -use libipld::{cbor::DagCborCodec, prelude::*}; -use ssi::{ - jwk::JWK, - ucan::{Payload, Ucan}, - vc::NumericDate, +use crate::resource::{AnyResource, ResourceCapErr, ResourceId}; +use cacaos::v2::{common::CommonCacao, varsig::either::EitherSignature, Cacao}; +use iri_string::types::{UriStr, UriString}; +use ssi::ucan::{ + capabilities::*, + common::Common, + jwt::{Jwt, UcanDecode}, + Ucan, +}; +use std::{ + collections::BTreeMap, + iter::{FilterMap, Map}, }; -use uuid::Uuid; pub use libipld::Cid; @@ -17,104 +21,150 @@ pub trait HeaderEncode { Self: Sized; } -#[derive(Clone, Debug)] -pub enum KeplerDelegation { - Ucan(Box), - Cacao(Box), +pub trait Resources<'a, RO: 'a = &'a UriStr, NB: 'a = serde_json::Value> { + type RI; + type Iter: Iterator>)>; + fn grants(&'a self) -> Self::Iter; + fn resources(&'a self) -> Map::Item) -> RO> { + self.grants().map(|(r, _)| r) + } } +pub type KeplerDelegation = CommonCacao; + impl HeaderEncode for KeplerDelegation { fn encode(&self) -> Result { - use std::ops::Deref; - Ok(match self { - Self::Ucan(u) => u.encode()?, - Self::Cacao(c) => { - base64::encode_config(DagCborCodec.encode(c.deref())?, base64::URL_SAFE) + Ok(match self.signature().sig() { + EitherSignature::A(_) => { + base64::encode_config(serde_ipld_dagcbor::to_vec(self)?, base64::URL_SAFE) } + EitherSignature::B(_) => self.serialize_jwt()?.ok_or(EncodingError::NotAJwt)?, }) } fn decode(s: &str) -> Result<(Self, Vec), EncodingError> { Ok(if s.contains('.') { ( - Self::Ucan(Box::new(Ucan::decode(s)?)), + as UcanDecode>::decode(s)?.try_into()?, s.as_bytes().to_vec(), ) } else { let v = base64::decode_config(s, base64::URL_SAFE)?; - (Self::Cacao(Box::new(DagCborCodec.decode(&v)?)), v) + (serde_ipld_dagcbor::from_slice(&v)?, v) }) } } -impl KeplerDelegation { - pub fn from_bytes(b: &[u8]) -> Result { - match DagCborCodec.decode(b) { - Ok(cacao) => Ok(Self::Cacao(Box::new(cacao))), - Err(_) => Ok(Self::Ucan(Box::new(Ucan::decode( - &String::from_utf8_lossy(b), - )?))), - } +impl<'a, NB: 'a, RO: 'a, F: 'a, S: 'a> Resources<'a, RO, NB> for Cacao +where + Capabilities: Resources<'a, RO, NB>, +{ + type RI = as Resources<'a, RO, NB>>::RI; + type Iter = as Resources<'a, RO, NB>>::Iter; + fn grants(&'a self) -> Self::Iter { + self.capabilities().grants() } } -// turn everything into url safe, b64-cacao or jwt +impl<'a, NB: 'a> Resources<'a, ResourceId, NB> for Capabilities { + type RI = &'a UriString; + type Iter = FilterMap< + std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, + fn( + (&'a UriString, &'a BTreeMap>), + ) -> Option<(ResourceId, &'a BTreeMap>)>, + >; + fn grants(&'a self) -> Self::Iter { + self.abilities() + .iter() + .filter_map(|(r, a)| r.try_into().map(|k| (k, a)).ok()) + } +} -pub type KeplerInvocation = Ucan; +impl<'a, NB: 'a> Resources<'a, &'a UriStr, NB> for Capabilities { + type RI = &'a UriString; + type Iter = Map< + std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, + fn( + (&'a UriString, &'a BTreeMap>), + ) -> (&'a UriStr, &'a BTreeMap>), + >; + fn grants(&'a self) -> Self::Iter { + self.abilities().iter().map(|(r, a)| (r.as_ref(), a)) + } +} -impl HeaderEncode for KeplerInvocation { - fn encode(&self) -> Result { - Ok(self.encode()?) +impl<'a, NB: 'a> Resources<'a, AnyResource<&'a UriStr>, NB> for Capabilities { + type RI = &'a UriString; + type Iter = Map< + std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, + fn( + (&'a UriString, &'a BTreeMap>), + ) -> ( + AnyResource<&'a UriStr>, + &'a BTreeMap>, + ), + >; + fn grants(&'a self) -> Self::Iter { + self.abilities().iter().map(|(r, a)| (r.into(), a)) } - fn decode(s: &str) -> Result<(Self, Vec), EncodingError> { - Ok((Self::decode(s)?, s.as_bytes().to_vec())) +} + +pub fn delegation_from_bytes(b: &[u8]) -> Result { + match serde_ipld_dagcbor::from_slice(b) { + Ok(cacao) => Ok(cacao), + Err(_) => Ok( + as UcanDecode>::decode(&String::from_utf8_lossy(b))?.try_into()?, + ), } } +pub type KeplerInvocation = CommonCacao; + #[derive(Debug, Clone)] pub enum KeplerRevocation { - Cacao(SiweCacao), + Cacao(CommonCacao), } impl HeaderEncode for KeplerRevocation { fn encode(&self) -> Result { match self { Self::Cacao(c) => Ok(base64::encode_config( - DagCborCodec.encode(&c)?, + serde_ipld_dagcbor::to_vec(&c)?, base64::URL_SAFE, )), } } fn decode(s: &str) -> Result<(Self, Vec), EncodingError> { let v = base64::decode_config(s, base64::URL_SAFE)?; - Ok((Self::Cacao(DagCborCodec.decode(&v)?), v)) + Ok((Self::Cacao(serde_ipld_dagcbor::from_slice(&v)?), v)) } } -pub async fn make_invocation( - invocation_target: Vec, - delegation: Cid, - jwk: &JWK, - verification_method: String, - expiration: f64, - not_before: Option, - nonce: Option, -) -> Result { - Ok(Payload { - issuer: verification_method.clone(), - audience: verification_method, - not_before: not_before.map(NumericDate::try_from_seconds).transpose()?, - expiration: NumericDate::try_from_seconds(expiration)?, - nonce: Some(nonce.unwrap_or_else(|| format!("urn:uuid:{}", Uuid::new_v4()))), - facts: None, - proof: vec![delegation], - attenuation: invocation_target - .into_iter() - .map(|t| t.try_into()) - .collect::, _>>()?, - } - .sign(jwk.get_algorithm().unwrap_or_default(), jwk)?) -} +// pub async fn make_invocation( +// invocation_target: Vec, +// delegation: Cid, +// jwk: &JWK, +// verification_method: String, +// expiration: f64, +// not_before: Option, +// nonce: Option, +// ) -> Result { +// Ok(Payload { +// issuer: verification_method.clone(), +// audience: verification_method, +// not_before: not_before.map(NumericDate::try_from_seconds).transpose()?, +// expiration: NumericDate::try_from_seconds(expiration)?, +// nonce: Some(nonce.unwrap_or_else(|| format!("urn:uuid:{}", Uuid::new_v4()))), +// facts: None, +// proof: vec![delegation], +// attenuation: invocation_target +// .into_iter() +// .map(|t| t.try_into()) +// .collect::, _>>()?, +// } +// .sign(jwk.get_algorithm().unwrap_or_default(), jwk)?) +// } #[derive(Debug, thiserror::Error)] pub enum InvocationError { @@ -123,17 +173,23 @@ pub enum InvocationError { #[error(transparent)] NumericDateConversion(#[from] ssi::jwt::NumericDateConversionError), #[error(transparent)] - UCAN(#[from] ssi::ucan::error::Error), + UCAN(#[from] ssi::ucan::Error), } #[derive(Debug, thiserror::Error)] pub enum EncodingError { #[error(transparent)] - SSIError(#[from] ssi::ucan::error::Error), + UCAN(#[from] ssi::ucan::Error), #[error(transparent)] - IpldError(#[from] libipld::error::Error), + CacaoError(#[from] cacaos::v2::common::Error), + #[error(transparent)] + ToIpldError(#[from] serde_ipld_dagcbor::EncodeError), #[error(transparent)] Base64(#[from] base64::DecodeError), + #[error(transparent)] + FromIpldError(#[from] serde_ipld_dagcbor::DecodeError), + #[error("CACAO not a JWT")] + NotAJwt, } pub enum CapabilitiesQuery { From 63df43d762496563f50e19d795cb47c70185da9d Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 18:24:41 +0200 Subject: [PATCH 04/24] remove glue code --- kepler-core/src/util.rs | 232 ---------------------------------------- 1 file changed, 232 deletions(-) delete mode 100644 kepler-core/src/util.rs diff --git a/kepler-core/src/util.rs b/kepler-core/src/util.rs deleted file mode 100644 index 6166922e..00000000 --- a/kepler-core/src/util.rs +++ /dev/null @@ -1,232 +0,0 @@ -use crate::types::Resource; -use kepler_lib::{ - authorization::{KeplerDelegation, KeplerInvocation, KeplerRevocation}, - cacaos::siwe::Message, - libipld::Cid, - resource::OrbitId, - siwe_recap::{extract_capabilities, verify_statement, Capability as SiweCap}, - ssi::ucan::Capability as UcanCap, -}; -use serde::{Deserialize, Serialize}; -use std::str::FromStr; -use time::OffsetDateTime; - -#[derive(Serialize, Deserialize, Clone, Debug, Hash, PartialEq, Eq)] -pub struct Capability { - pub resource: Resource, - pub action: String, -} - -#[non_exhaustive] -#[derive(thiserror::Error, Debug)] -pub enum CapExtractError { - #[error("Default actions are not allowed for Kepler capabilities")] - DefaultActions, - #[error("Invalid Extra Fields")] - InvalidFields, - #[error(transparent)] - Cid(#[from] kepler_lib::libipld::cid::Error), -} - -fn extract_ucan_cap(c: &UcanCap) -> Result { - Ok(Capability { - resource: c.with.to_string().into(), - action: c.can.capability.clone(), - }) -} - -fn extract_siwe_cap(c: SiweCap) -> Result<(Vec, Vec), CapExtractError> { - if !c.default_actions.as_ref().is_empty() { - Err(CapExtractError::DefaultActions) - } else { - Ok(( - c.targeted_actions - .into_iter() - .flat_map(|(r, acs)| { - acs.into_iter() - .map(|action| Capability { - resource: Resource::from(r.clone()), - action, - }) - .collect::>() - }) - .collect(), - match &c - .extra_fields - .iter() - .map(|(n, a)| (n.as_str(), a)) - .collect::>()[..] - { - [] => vec![], - [("parents", serde_json::Value::Array(a))] => a - .iter() - .map(|s| { - s.as_str() - .map(Cid::from_str) - .ok_or(kepler_lib::libipld::cid::Error::ParsingError)? - }) - .collect::, kepler_lib::libipld::cid::Error>>()?, - _ => return Err(CapExtractError::InvalidFields), - }, - )) - } -} - -#[derive(Debug, Clone)] -pub struct DelegationInfo { - pub capabilities: Vec, - pub delegator: String, - pub delegate: String, - pub parents: Vec, - pub delegation: KeplerDelegation, - pub expiry: Option, - pub not_before: Option, - pub issued_at: Option, -} - -impl DelegationInfo { - pub fn orbits(&self) -> impl Iterator + '_ { - self.capabilities.iter().filter_map(|c| c.resource.orbit()) - } -} - -#[non_exhaustive] -#[derive(thiserror::Error, Debug)] -pub enum DelegationError { - #[error(transparent)] - InvalidCapability(#[from] CapExtractError), - #[error("Missing Delegator")] - MissingDelegator, - #[error("Missing Delegate")] - MissingDelegate, - #[error(transparent)] - SiweConversion(#[from] kepler_lib::cacaos::siwe_cacao::SIWEPayloadConversionError), - #[error(transparent)] - SiweCapError(#[from] kepler_lib::siwe_recap::Error), - #[error("Invalid Siwe Statement")] - InvalidStatement, -} - -impl TryFrom for DelegationInfo { - type Error = DelegationError; - fn try_from(d: KeplerDelegation) -> Result { - Ok(match d { - KeplerDelegation::Ucan(ref u) => Self { - capabilities: u - .payload - .attenuation - .iter() - .map(extract_ucan_cap) - .collect::, CapExtractError>>()?, - delegator: u.payload.issuer.clone(), - delegate: u.payload.audience.clone(), - parents: u.payload.proof.clone(), - expiry: OffsetDateTime::from_unix_timestamp_nanos( - (u.payload.expiration.as_seconds() * 1_000_000_000.0) as i128, - ) - .ok(), - not_before: u.payload.not_before.and_then(|t| { - OffsetDateTime::from_unix_timestamp_nanos( - (t.as_seconds() * 1_000_000_000.0) as i128, - ) - .ok() - }), - delegation: d, - issued_at: None, - }, - KeplerDelegation::Cacao(ref c) => { - let m: Message = c.payload().clone().try_into()?; - if !verify_statement(&m)? { - return Err(DelegationError::InvalidStatement); - }; - let (capabilities, parents) = extract_capabilities(&m)? - .remove(&"kepler".parse()?) - .map(extract_siwe_cap) - .transpose()? - .unwrap_or_default(); - Self { - capabilities, - delegator: c.payload().iss.to_string(), - delegate: c.payload().aud.to_string(), - parents, - expiry: c.payload().exp.as_ref().map(|t| *t.as_ref()), - not_before: c.payload().nbf.as_ref().map(|t| *t.as_ref()), - issued_at: Some(*c.payload().iat.as_ref()), - delegation: d, - } - } - }) - } -} - -#[derive(Debug, Clone)] -pub struct InvocationInfo { - pub capabilities: Vec, - pub invoker: String, - pub parents: Vec, - pub invocation: KeplerInvocation, -} - -impl InvocationInfo { - pub fn orbits(&self) -> impl Iterator + '_ { - self.capabilities.iter().filter_map(|c| c.resource.orbit()) - } -} - -#[non_exhaustive] -#[derive(thiserror::Error, Debug)] -pub enum InvocationError { - #[error("Missing Resource")] - MissingResource, - #[error(transparent)] - ResourceParse(#[from] CapExtractError), -} - -impl TryFrom for InvocationInfo { - type Error = InvocationError; - fn try_from(invocation: KeplerInvocation) -> Result { - Ok(Self { - capabilities: invocation - .payload - .attenuation - .iter() - .map(extract_ucan_cap) - .collect::, CapExtractError>>()?, - invoker: invocation.payload.issuer.clone(), - parents: invocation.payload.proof.clone(), - invocation, - }) - } -} - -#[derive(Debug, Clone)] -pub struct RevocationInfo { - // TODO these should be hash - pub parents: Vec, - pub revoked: Cid, - pub revoker: String, - pub revocation: KeplerRevocation, -} - -#[derive(thiserror::Error, Debug)] -pub enum RevocationError { - #[error("Invalid Target")] - InvalidTarget, -} - -impl TryFrom for RevocationInfo { - type Error = RevocationError; - fn try_from(r: KeplerRevocation) -> Result { - match r { - KeplerRevocation::Cacao(ref c) => match c.payload().aud.as_str().split_once(':') { - Some(("ucan", ps)) => Ok(Self { - parents: Vec::new(), - revoked: ps.parse().map_err(|_| RevocationError::InvalidTarget)?, - revoker: c.payload().iss.to_string(), - revocation: r, - }), - _ => Err(RevocationError::InvalidTarget), - }, - } - } -} From 6346d1cc404e815e72dc5a97ae6ac2dd7c5bcbc3 Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 18:25:34 +0200 Subject: [PATCH 05/24] impl sql wrappers for some types --- kepler-core/src/models/abilities.rs | 4 +- .../src/relationships/invoked_abilities.rs | 4 +- kepler-core/src/types/ability_name.rs | 104 ++++++++++++++++++ kepler-core/src/types/caveats.rs | 12 +- kepler-core/src/types/mod.rs | 4 +- kepler-core/src/types/orbit_id_wrap.rs | 25 +++-- kepler-core/src/types/resource.rs | 100 ++++++++++------- 7 files changed, 193 insertions(+), 60 deletions(-) create mode 100644 kepler-core/src/types/ability_name.rs diff --git a/kepler-core/src/models/abilities.rs b/kepler-core/src/models/abilities.rs index 681dcd8c..f7b33924 100644 --- a/kepler-core/src/models/abilities.rs +++ b/kepler-core/src/models/abilities.rs @@ -1,6 +1,6 @@ use super::*; use crate::hash::Hash; -use crate::types::{Caveats, Resource}; +use crate::types::{AbilityName, Caveats, Resource}; use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] @@ -9,7 +9,7 @@ pub struct Model { #[sea_orm(primary_key)] pub resource: Resource, #[sea_orm(primary_key)] - pub ability: String, + pub ability: AbilityName, #[sea_orm(primary_key)] pub delegation: Hash, diff --git a/kepler-core/src/relationships/invoked_abilities.rs b/kepler-core/src/relationships/invoked_abilities.rs index 2f0102df..fe15877f 100644 --- a/kepler-core/src/relationships/invoked_abilities.rs +++ b/kepler-core/src/relationships/invoked_abilities.rs @@ -1,6 +1,6 @@ use super::super::models::*; use crate::hash::Hash; -use crate::types::Resource; +use crate::types::{AbilityName, Resource}; use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] @@ -11,7 +11,7 @@ pub struct Model { #[sea_orm(primary_key)] pub resource: Resource, #[sea_orm(primary_key)] - pub ability: String, + pub ability: AbilityName, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] diff --git a/kepler-core/src/types/ability_name.rs b/kepler-core/src/types/ability_name.rs new file mode 100644 index 00000000..521a8c42 --- /dev/null +++ b/kepler-core/src/types/ability_name.rs @@ -0,0 +1,104 @@ +use kepler_lib::ssi::ucan::capabilities::Ability; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct AbilityName(pub Ability); + +impl AsRef for AbilityName { + fn as_ref(&self) -> &Ability { + &self.0 + } +} + +impl From for AbilityName { + fn from(id: Ability) -> Self { + AbilityName(id) + } +} + +impl From for Ability { + fn from(id: AbilityName) -> Self { + id.0 + } +} + +impl From for Value { + fn from(r: AbilityName) -> Self { + Value::String(Some(Box::new(r.to_string()))) + } +} + +impl PartialEq for AbilityName { + fn eq(&self, other: &Ability) -> bool { + self.0 == *other + } +} + +impl AbilityName { + fn into_inner(self) -> Ability { + self.0 + } +} + +impl sea_orm::TryGetable for AbilityName { + fn try_get_by( + res: &QueryResult, + idx: I, + ) -> Result { + Ok(res + .try_get_by::(idx)? + .parse() + .map_err(|e| DbErr::TryIntoErr { + from: "String", + into: "AbilityName", + source: Box::new(e), + })?) + } +} + +impl sea_orm::sea_query::ValueType for AbilityName { + fn try_from(v: Value) -> Result { + match v { + Value::String(Some(x)) => x.parse().or(Err(sea_orm::sea_query::ValueTypeErr)), + _ => Err(sea_orm::sea_query::ValueTypeErr), + } + } + + fn type_name() -> String { + stringify!(AbilityName).to_owned() + } + + fn array_type() -> sea_orm::sea_query::ArrayType { + sea_orm::sea_query::ArrayType::String + } + + fn column_type() -> sea_orm::sea_query::ColumnType { + sea_orm::sea_query::ColumnType::String(None) + } +} + +impl std::str::FromStr for AbilityName { + type Err = ::Err; + fn from_str(s: &str) -> Result { + Ok(Self(Ability::from_str(s)?)) + } +} + +impl std::fmt::Display for AbilityName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +impl sea_orm::sea_query::Nullable for AbilityName { + fn null() -> Value { + Value::String(None) + } +} + +impl sea_orm::TryFromU64 for AbilityName { + fn try_from_u64(_: u64) -> Result { + Err(DbErr::ConvertFromU64(stringify!($type))) + } +} diff --git a/kepler-core/src/types/caveats.rs b/kepler-core/src/types/caveats.rs index 5e72d89d..8ea06e7d 100644 --- a/kepler-core/src/types/caveats.rs +++ b/kepler-core/src/types/caveats.rs @@ -1,9 +1,11 @@ use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -use std::collections::BTreeMap; +use ssi::ucan::capabilities::NotaBeneCollection; + +pub type CaveatsInner = NotaBeneCollection; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Default)] -pub struct Caveats(pub BTreeMap); +pub struct Caveats(pub CaveatsInner); impl From for Value { fn from(source: Caveats) -> Self { @@ -11,6 +13,12 @@ impl From for Value { } } +impl From for Caveats { + fn from(source: CaveatsInner) -> Self { + Self(source) + } +} + impl sea_orm::TryGetableFromJson for Caveats {} impl sea_orm::sea_query::ValueType for Caveats { diff --git a/kepler-core/src/types/mod.rs b/kepler-core/src/types/mod.rs index 12380f58..47a7b53e 100644 --- a/kepler-core/src/types/mod.rs +++ b/kepler-core/src/types/mod.rs @@ -1,10 +1,12 @@ +mod ability_name; mod caveats; mod facts; mod metadata; mod orbit_id_wrap; mod resource; -pub use caveats::Caveats; +pub use ability_name::AbilityName; +pub use caveats::{Caveats, CaveatsInner}; pub use facts::Facts; pub use metadata::Metadata; pub use orbit_id_wrap::OrbitIdWrap; diff --git a/kepler-core/src/types/orbit_id_wrap.rs b/kepler-core/src/types/orbit_id_wrap.rs index 287a5cf4..04efdcc8 100644 --- a/kepler-core/src/types/orbit_id_wrap.rs +++ b/kepler-core/src/types/orbit_id_wrap.rs @@ -1,7 +1,6 @@ use kepler_lib::resource::OrbitId; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; -use std::str::FromStr; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Eq, Hash, PartialOrd, Ord)] pub struct OrbitIdWrap(pub OrbitId); @@ -47,23 +46,25 @@ impl sea_orm::TryGetable for OrbitIdWrap { res: &QueryResult, idx: I, ) -> Result { - let s: String = res.try_get_by(idx).map_err(sea_orm::TryGetError::DbErr)?; - Ok(OrbitIdWrap(OrbitId::from_str(&s).map_err(|e| { - sea_orm::TryGetError::DbErr(DbErr::TryIntoErr { - from: "String", - into: "OrbitId", - source: Box::new(e), - }) - })?)) + Ok(OrbitIdWrap( + res.try_get_by::(idx)?.parse().map_err(|e| { + sea_orm::TryGetError::DbErr(DbErr::TryIntoErr { + from: "String", + into: "OrbitId", + source: Box::new(e), + }) + })?, + )) } } impl sea_orm::sea_query::ValueType for OrbitIdWrap { fn try_from(v: Value) -> Result { match v { - Value::String(Some(x)) => Ok(OrbitId::from_str(&x) - .map_err(|_| sea_orm::sea_query::ValueTypeErr)? - .into()), + Value::String(Some(s)) => s + .parse() + .or(Err(sea_orm::sea_query::ValueTypeErr)) + .map(Self), _ => Err(sea_orm::sea_query::ValueTypeErr), } } diff --git a/kepler-core/src/types/resource.rs b/kepler-core/src/types/resource.rs index 2efac425..7a1ac5a6 100644 --- a/kepler-core/src/types/resource.rs +++ b/kepler-core/src/types/resource.rs @@ -1,51 +1,69 @@ -use kepler_lib::resource::{OrbitId, ResourceId}; +use kepler_lib::{ + iri_string::types::{UriStr, UriString}, + resource::{AnyResource, ResourceId}, +}; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use std::{fmt::Display, str::FromStr}; #[derive(Serialize, Deserialize, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] -#[serde(untagged)] -pub enum Resource { - Kepler(ResourceId), - Other(String), +pub struct Resource(pub AnyResource); + +impl AsRef for Resource { + fn as_ref(&self) -> &AnyResource { + &self.0 + } } impl Resource { - pub fn orbit(&self) -> Option<&OrbitId> { - match self { - Resource::Kepler(id) => Some(id.orbit()), - Resource::Other(_) => None, + pub fn extends, S: AsRef>>(&self, other: &S) -> bool { + match (self.0, other.as_ref()) { + (AnyResource::Kepler(a), AnyResource::Kepler(b)) => a.extends(b).is_ok(), + (AnyResource::Other(a), AnyResource::Other(b)) => a.as_ref().starts_with(b.as_ref()), + _ => false, } } +} - pub fn extends(&self, other: &Self) -> bool { - match (self, other) { - (Resource::Kepler(a), Resource::Kepler(b)) => a.extends(b).is_ok(), - (Resource::Other(a), Resource::Other(b)) => a.starts_with(b), - _ => false, - } +impl From for Resource { + fn from(id: ResourceId) -> Self { + Resource(id.into()) } +} - pub fn kepler_resource(&self) -> Option<&ResourceId> { - match self { - Resource::Kepler(id) => Some(id), - Resource::Other(_) => None, - } +impl From for Resource { + fn from(id: UriString) -> Self { + Resource(id.into()) } } -impl From for Resource { - fn from(id: ResourceId) -> Self { - Resource::Kepler(id) +impl From<&UriString> for Resource { + fn from(id: &UriString) -> Self { + Resource(id.into()) + } +} + +impl From<&UriStr> for Resource { + fn from(id: &UriStr) -> Self { + Resource(id.into()) + } +} + +impl From> for Resource { + fn from(id: AnyResource) -> Self { + Resource(id.into()) + } +} + +impl<'a> From> for Resource { + fn from(id: AnyResource<&'a UriStr>) -> Self { + Resource(id.into()) } } impl From for Value { fn from(r: Resource) -> Self { - Value::String(Some(Box::new(match r { - Resource::Kepler(k) => k.to_string(), - Resource::Other(o) => o, - }))) + Value::String(Some(Box::new(r.to_string()))) } } @@ -54,15 +72,21 @@ impl sea_orm::TryGetable for Resource { res: &QueryResult, idx: I, ) -> Result { - let s: String = res.try_get_by(idx).map_err(sea_orm::TryGetError::DbErr)?; - Ok(Resource::from(s)) + Ok(res + .try_get_by::(idx)? + .parse() + .map_err(|e| DbErr::TryIntoErr { + from: "String", + into: "Resource", + source: Box::new(e), + })?) } } impl sea_orm::sea_query::ValueType for Resource { fn try_from(v: Value) -> Result { match v { - Value::String(Some(x)) => Ok(Resource::from(*x)), + Value::String(Some(s)) => s.parse().or(Err(sea_orm::sea_query::ValueTypeErr)), _ => Err(sea_orm::sea_query::ValueTypeErr), } } @@ -80,22 +104,16 @@ impl sea_orm::sea_query::ValueType for Resource { } } -impl From for Resource { - fn from(s: String) -> Self { - if let Ok(resource_id) = ResourceId::from_str(&s) { - Resource::Kepler(resource_id) - } else { - Resource::Other(s) - } +impl FromStr for Resource { + type Err = ::Err; + fn from_str(s: &str) -> Result { + Ok(Self(AnyResource::from_str(s)?)) } } impl Display for Resource { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Resource::Kepler(resource_id) => write!(f, "{}", resource_id), - Resource::Other(s) => write!(f, "{}", s), - } + write!(f, "{}", self.as_ref()) } } From 94fbe3caa3e9c5784ba7a2668431032c679cd158 Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 18:27:06 +0200 Subject: [PATCH 06/24] use base authz type instead of intermediate Info type --- kepler-core/src/events/mod.rs | 7 +++---- kepler-core/src/lib.rs | 1 - kepler-core/src/types/resource.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/kepler-core/src/events/mod.rs b/kepler-core/src/events/mod.rs index 191ca25f..54ba634d 100644 --- a/kepler-core/src/events/mod.rs +++ b/kepler-core/src/events/mod.rs @@ -1,7 +1,6 @@ use crate::{ hash::{hash, Hash}, types::Metadata, - util::{DelegationInfo, InvocationInfo, RevocationInfo}, }; pub use kepler_lib::{ authorization::{ @@ -40,9 +39,9 @@ impl SerializedEvent { } } -pub type Delegation = SerializedEvent; -pub type Invocation = SerializedEvent; -pub type Revocation = SerializedEvent; +pub type Delegation = SerializedEvent; +pub type Invocation = SerializedEvent; +pub type Revocation = SerializedEvent; #[derive(Debug, Hash, PartialEq, Eq)] pub(crate) enum Operation { diff --git a/kepler-core/src/lib.rs b/kepler-core/src/lib.rs index a6b29946..cde15342 100644 --- a/kepler-core/src/lib.rs +++ b/kepler-core/src/lib.rs @@ -8,7 +8,6 @@ pub mod models; pub mod relationships; pub mod storage; pub mod types; -pub mod util; pub use db::{Commit, InvocationOutcome, OrbitDatabase, TxError, TxStoreError}; pub use libp2p; diff --git a/kepler-core/src/types/resource.rs b/kepler-core/src/types/resource.rs index 7a1ac5a6..4d1ea543 100644 --- a/kepler-core/src/types/resource.rs +++ b/kepler-core/src/types/resource.rs @@ -19,7 +19,7 @@ impl Resource { pub fn extends, S: AsRef>>(&self, other: &S) -> bool { match (self.0, other.as_ref()) { (AnyResource::Kepler(a), AnyResource::Kepler(b)) => a.extends(b).is_ok(), - (AnyResource::Other(a), AnyResource::Other(b)) => a.as_ref().starts_with(b.as_ref()), + (AnyResource::Other(a), AnyResource::Other(b)) => a.as_str().starts_with(b.as_ref()), _ => false, } } From a3166dd9b1f050436b4ea8d5ce0a66cb78007b84 Mon Sep 17 00:00:00 2001 From: chunningham Date: Sun, 10 Sep 2023 18:34:03 +0200 Subject: [PATCH 07/24] generalise validation, share between inv and del --- kepler-core/src/db.rs | 302 +++++++++++++-------------- kepler-core/src/models/delegation.rs | 241 +++++++++------------ kepler-core/src/models/invocation.rs | 211 +++++-------------- kepler-core/src/models/mod.rs | 210 +++++++++++++++++++ 4 files changed, 508 insertions(+), 456 deletions(-) diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index 5faa414c..0c282888 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -8,11 +8,11 @@ use crate::storage::{ either::EitherError, Content, HashBuffer, ImmutableDeleteStore, ImmutableReadStore, ImmutableStaging, ImmutableWriteStore, StorageSetup, StoreSize, }; -use crate::types::{Metadata, OrbitIdWrap, Resource}; -use crate::util::{Capability, DelegationInfo}; +use crate::types::{Metadata, OrbitIdWrap}; use kepler_lib::{ - authorization::{EncodingError, KeplerDelegation}, - resource::OrbitId, + authorization::{EncodingError, KeplerDelegation, Resources}, + resource::{OrbitId, ResourceId}, + ssi::ucan::capabilities::Ability, }; use sea_orm::{ entity::prelude::*, @@ -47,11 +47,11 @@ pub enum TxError { #[error(transparent)] Ucan(#[from] ssi::ucan::Error), #[error(transparent)] - Cacao(#[from] kepler_lib::cacaos::siwe_cacao::VerificationError), + Cacao(#[from] kepler_lib::cacaos::v2::common::Error), #[error(transparent)] - InvalidDelegation(#[from] delegation::DelegationError), + InvalidDelegation(ValidationError), #[error(transparent)] - InvalidInvocation(#[from] invocation::InvocationError), + InvalidInvocation(ValidationError), #[error(transparent)] InvalidRevocation(#[from] revocation::RevocationError), #[error("Epoch Hashing Err: {0}")] @@ -64,6 +64,10 @@ pub enum TxError { Secrets(K::Error), #[error("Orbit not found")] OrbitNotFound, + #[error(transparent)] + Serde(#[from] serde_json::Error), + #[error("Missing event for service: {0} {1} {2:?}")] + MissingServiceEvent(ResourceId, String, Option<(i64, Hash, i64)>), } #[non_exhaustive] @@ -212,40 +216,46 @@ where let mut stages = HashMap::new(); let mut ops = Vec::new(); // for each capability being invoked - for cap in invocation.0.capabilities.iter() { - match cap - .resource - .kepler_resource() - .and_then(|r| Some((r.service()?, cap.action.as_str(), r.orbit(), r.path()?))) - { - // stage inputs for content writes - Some(("kv", "put", orbit, path)) => { - let (metadata, mut stage) = inputs - .remove(&(orbit.clone(), path.to_string())) - .ok_or(TxStoreError::MissingInput)?; - - let value = stage.hash(); - - let norm_path = normalize_path(path); - - stages.insert((orbit.clone(), norm_path.to_string()), stage); - // add write for tx - ops.push(Operation::KvWrite { - orbit: orbit.clone(), - key: norm_path.to_string(), - metadata, - value, - }); - } - // add delete for tx - Some(("kv", "del", orbit, path)) => { - ops.push(Operation::KvDelete { - orbit: orbit.clone(), - key: normalize_path(path).to_string(), - version: None, - }); + let activity: HashMap<_, _> = Resources::<'_, ResourceId>::grants(&invocation.0) + .map(|(r, a)| (r, a.clone())) + .collect(); + for (resource, actions) in activity.iter() { + for action in actions.keys() { + match ( + action.namespace().as_ref(), + action.name().as_ref(), + resource.service(), + resource.path(), + ) { + // stage inputs for content writes + ("kv", "put", Some("kv"), Some(path)) => { + let (metadata, mut stage) = inputs + .remove(&(resource.orbit().clone(), path.to_string())) + .ok_or(TxStoreError::MissingInput)?; + + let value = stage.hash(); + + let norm_path = normalize_path(path); + + stages.insert((resource.orbit().clone(), norm_path.to_string()), stage); + // add write for tx + ops.push(Operation::KvWrite { + orbit: resource.orbit().clone(), + key: norm_path.to_string(), + metadata, + value, + }); + } + // add delete for tx + ("kv", "del", Some("kv"), Some(path)) => { + ops.push(Operation::KvDelete { + orbit: resource.orbit().clone(), + key: normalize_path(path).to_string(), + version: None, + }); + } + _ => {} } - _ => {} } } @@ -253,7 +263,6 @@ where .conn .begin_with_config(Some(sea_orm::IsolationLevel::ReadUncommitted), None) .await?; - let caps = invocation.0.capabilities.clone(); // verify and commit invocation and kv operations let commit = transact( &tx, @@ -265,50 +274,58 @@ where let mut results = Vec::new(); // perform and record side effects - for cap in caps { - match ( - cap.resource - .kepler_resource() - .and_then(|r| Some((r.orbit(), r.service()?, normalize_path(r.path()?)))), - cap.action.as_str(), - ) { - (Some((orbit, "kv", path)), "get") => results.push(InvocationOutcome::KvRead( - get_kv(&tx, &self.storage, orbit, path) - .await - .map_err(|e| match e { - EitherError::A(e) => TxStoreError::Tx(e.into()), - EitherError::B(e) => TxStoreError::StoreRead(e), - })?, - )), - (Some((orbit, "kv", path)), "list") => { - results.push(InvocationOutcome::KvList(list(&tx, orbit, path).await?)) - } - (Some((orbit, "kv", path)), "del") => { - let kv = get_kv_entity(&tx, orbit, path).await?; - if let Some(kv) = kv { - self.storage - .remove(orbit, &kv.value) - .await - .map_err(TxStoreError::StoreDelete)?; + for (resource, actions) in activity.iter() { + for action in actions.keys() { + match ( + action.namespace().as_ref(), + action.name().as_ref(), + resource.service(), + resource.path(), + ) { + ("kv", "get", Some("kv"), Some(path)) => { + results.push(InvocationOutcome::KvRead( + get_kv(&tx, &self.storage, resource.orbit(), path) + .await + .map_err(|e| match e { + EitherError::A(e) => TxStoreError::Tx(e.into()), + EitherError::B(e) => TxStoreError::StoreRead(e), + })?, + )) } - results.push(InvocationOutcome::KvDelete) - } - (Some((orbit, "kv", path)), "put") => { - if let Some(stage) = stages.remove(&(orbit.clone(), path.to_string())) { - self.storage - .persist(orbit, stage) - .await - .map_err(TxStoreError::StoreWrite)?; - results.push(InvocationOutcome::KvWrite) + ("kv", "list", Some("kv"), Some(path)) => results.push( + InvocationOutcome::KvList(list(&tx, resource.orbit(), path).await?), + ), + ("kv", "del", Some("kv"), Some(path)) => { + let kv = get_kv_entity(&tx, resource.orbit(), path).await?; + if let Some(kv) = kv { + self.storage + .remove(resource.orbit(), &kv.value) + .await + .map_err(TxStoreError::StoreDelete)?; + } + results.push(InvocationOutcome::KvDelete) } + ("kv", "put", Some("kv"), Some(path)) => { + if let Some(stage) = + stages.remove(&(resource.orbit().clone(), path.to_string())) + { + self.storage + .persist(resource.orbit(), stage) + .await + .map_err(TxStoreError::StoreWrite)?; + results.push(InvocationOutcome::KvWrite) + } + } + ("kv", "metadata", Some("kv"), Some(path)) => results.push( + InvocationOutcome::KvMetadata(metadata(&tx, resource.orbit(), path).await?), + ), + ("kv", "read", Some("capabilities"), Some("all")) => { + results.push(InvocationOutcome::OpenSessions( + get_valid_delegations(&tx, resource.orbit(), None).await?, + )) + } + _ => {} } - (Some((orbit, "kv", path)), "metadata") => results.push( - InvocationOutcome::KvMetadata(metadata(&tx, orbit, path).await?), - ), - (Some((orbit, "capabilities", "all")), "read") => results.push( - InvocationOutcome::OpenSessions(get_valid_delegations(&tx, orbit).await?), - ), - _ => {} } } @@ -325,25 +342,7 @@ pub enum InvocationOutcome { KvMetadata(Option), KvWrite, KvRead(Option<(Metadata, Content)>), - OpenSessions(HashMap), -} - -impl From for TxError { - fn from(e: delegation::Error) -> Self { - match e { - delegation::Error::InvalidDelegation(e) => Self::InvalidDelegation(e), - delegation::Error::Db(e) => Self::Db(e), - } - } -} - -impl From for TxError { - fn from(e: invocation::Error) -> Self { - match e { - invocation::Error::InvalidInvocation(e) => Self::InvalidInvocation(e), - invocation::Error::Db(e) => Self::Db(e), - } - } + OpenSessions(HashMap), } impl From for TxError { @@ -364,7 +363,7 @@ async fn event_orbits<'a, C: ConnectionTrait>( let revoked_events = event_order::Entity::find() .filter( event_order::Column::Event.is_in(ev.iter().filter_map(|(_, e)| match e { - Event::Revocation(r) => Some(Hash::from(r.0.revoked)), + // TODO Event::Revocation(r) => Some(Hash::from(r.0.revoke)), _ => None, })), ) @@ -373,16 +372,16 @@ async fn event_orbits<'a, C: ConnectionTrait>( for e in ev { match &e.1 { Event::Delegation(d) => { - for orbit in d.0.orbits() { - let entry = orbits.entry(orbit.clone()).or_insert_with(Vec::new); + for orbit in d.0.resources().map(|r: ResourceId| r.into_inner().0) { + let entry = orbits.entry(orbit).or_insert_with(Vec::new); if !entry.iter().any(|(h, _)| h == &e.0) { entry.push(e); } } } Event::Invocation(i, _) => { - for orbit in i.0.orbits() { - let entry = orbits.entry(orbit.clone()).or_insert_with(Vec::new); + for orbit in i.0.resources().map(|r: ResourceId| r.into_inner().0) { + let entry = orbits.entry(orbit).or_insert_with(Vec::new); if !entry.iter().any(|(h, _)| h == &e.0) { entry.push(e); } @@ -418,21 +417,18 @@ pub(crate) async fn transact( .map(|e| (e.hash(), e)) .collect::>(); let event_orbits = event_orbits(db, &event_hashes).await?; + let host = Ability::new("kepler/host").unwrap(); let mut new_orbits = event_hashes .iter() .filter_map(|(_, e)| match e { - Event::Delegation(d) => Some(d.0.capabilities.iter().filter_map(|c| { - match (&c.resource, c.action.as_str()) { - (Resource::Kepler(r), "host") - if r.path().is_none() - && r.service().is_none() - && r.fragment().is_none() => - { - Some(OrbitIdWrap(r.orbit().clone())) - } - _ => None, - } - })), + Event::Delegation(d) => Some( + Resources::<'_, ResourceId>::grants(&d.0) + .filter_map(|(k, a)| match k.into_inner() { + (orbit, None, None, None) if a.contains_key(&host) => Some(orbit), + _ => None, + }) + .map(OrbitIdWrap), + ), _ => None, }) .flatten() @@ -591,23 +587,22 @@ pub(crate) async fn transact( for (hash, event) in event_hashes { match event { - Event::Delegation(d) => delegation::process(db, *d).await?, - Event::Invocation(i, ops) => { - invocation::process( - db, - *i, - ops.into_iter() - .map(|op| { - let v = orbit_order - .get(op.orbit()) - .and_then(|(s, e, _, h)| Some((s, e, h.get(&hash)?))) - .unwrap(); - op.version(*v.0, *v.1, *v.2) - }) - .collect(), - ) - .await? - } + Event::Delegation(d) => delegation::process(db, *d).await.map_err(|e| e.to_del())?, + Event::Invocation(i, ops) => invocation::process( + db, + *i, + ops.into_iter() + .map(|op| { + let v = orbit_order + .get(op.orbit()) + .and_then(|(s, e, _, h)| Some((s, e, h.get(&hash)?))) + .unwrap(); + op.version(*v.0, *v.1, *v.2) + }) + .collect(), + ) + .await + .map_err(|e| e.to_inv())?, Event::Revocation(r) => revocation::process(db, *r).await?, }; } @@ -736,7 +731,8 @@ async fn get_kv_entity( async fn get_valid_delegations( db: &C, orbit: &OrbitId, -) -> Result, TxError> { + time: Option, +) -> Result, TxError> { let (dels, abilities): (Vec, Vec>) = delegation::Entity::find() .left_join(revocation::Entity) @@ -746,44 +742,26 @@ async fn get_valid_delegations( .await? .into_iter() .unzip(); - let parents = dels.load_many(parent_delegations::Entity, db).await?; - let now = time::OffsetDateTime::now_utc(); + let now = time.unwrap_or_else(time::OffsetDateTime::now_utc); Ok(dels .into_iter() .zip(abilities) - .zip(parents) - .filter_map(|((del, ability), parents)| { + .filter_map(|(del, ability)| { if del.expiry.map(|e| e > now).unwrap_or(true) && del.not_before.map(|n| n <= now).unwrap_or(true) - && ability.iter().any(|a| a.resource.orbit() == Some(orbit)) + && ability + .iter() + .any(|a| a.resource.as_ref().orbit() == Some(orbit)) { - Some(match KeplerDelegation::from_bytes(&del.serialization) { - Ok(delegation) => Ok(( - del.id, - DelegationInfo { - delegator: del.delegator, - delegate: del.delegatee, - parents: parents.into_iter().map(|p| p.parent.to_cid(0x55)).collect(), - expiry: del.expiry, - not_before: del.not_before, - issued_at: del.issued_at, - capabilities: ability - .into_iter() - .map(|a| Capability { - resource: a.resource, - action: a.ability, - }) - .collect(), - delegation, - }, - )), + Some(match del.reser_cacao() { + Ok(delegation) => Ok((del.id, delegation.0)), Err(e) => Err(e), }) } else { None } }) - .collect::, EncodingError>>()?) + .collect::, EncodingError>>()?) } fn normalize_path(p: &str) -> &str { diff --git a/kepler-core/src/models/delegation.rs b/kepler-core/src/models/delegation.rs index 494d7830..12b41d3d 100644 --- a/kepler-core/src/models/delegation.rs +++ b/kepler-core/src/models/delegation.rs @@ -1,9 +1,15 @@ use crate::hash::Hash; -use crate::types::{Facts, Resource}; -use crate::{events::Delegation, models::*, relationships::*, util}; -use kepler_lib::{authorization::KeplerDelegation, resolver::DID_METHODS}; +use crate::types::Facts; +use crate::{ + events::{Delegation, SerializedEvent}, + models::*, + relationships::*, +}; +use kepler_lib::authorization::{ + delegation_from_bytes, EncodingError, KeplerDelegation, Resources, +}; use sea_orm::{entity::prelude::*, sea_query::OnConflict, ConnectionTrait}; -use time::OffsetDateTime; +use time::{ext::NumericalDuration, OffsetDateTime}; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "delegation")] @@ -20,6 +26,39 @@ pub struct Model { pub serialization: Vec, } +impl Model { + pub(crate) fn reser_cacao(&self) -> Result { + Ok(SerializedEvent( + delegation_from_bytes(&self.serialization)?, + self.serialization.clone(), + )) + } + + pub(crate) fn valid_at(&self, time: OffsetDateTime) -> bool { + let skew = (SKEW as i64).seconds(); + self.expiry.map_or(true, |exp| time < exp + skew) + && self.not_before.map_or(true, |nbf| nbf <= time + skew) + } + + pub(crate) fn validate_bounds( + &self, + start: Option, + end: Option, + ) -> bool { + let a = match (self.not_before, start) { + (Some(nbf), Some(start)) => start >= nbf, + (None, Some(_)) => false, + _ => true, + }; + let b = match (self.expiry, end) { + (Some(exp), Some(end)) => exp >= end, + (None, Some(_)) => false, + _ => true, + }; + a && b + } +} + #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { // inverse relation, delegations belong to delegators @@ -95,146 +134,65 @@ impl Linked for Delegatee { impl ActiveModelBehavior for ActiveModel {} -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error(transparent)] - Db(#[from] DbErr), - #[error(transparent)] - InvalidDelegation(#[from] DelegationError), -} - -#[derive(Debug, thiserror::Error)] -pub enum DelegationError { - #[error("Delegation expired or not yet valid")] - InvalidTime, - #[error("Failed to verify signature")] - InvalidSignature, - #[error("Unauthorized Delegator: {0}")] - UnauthorizedDelegator(String), - #[error("Unauthorized Capability: {0}, {1}")] - UnauthorizedCapability(Resource, String), - #[error("Cannot find parent delegation")] - MissingParents, -} - pub(crate) async fn process( db: &C, - delegation: Delegation, -) -> Result { - let (d, ser) = (delegation.0, delegation.1); - verify(&d.delegation).await?; - - validate(db, &d).await?; + SerializedEvent(d, ser): Delegation, +) -> Result { + let time = OffsetDateTime::now_utc(); + if !d.valid_at_time::<60, u64>(time.unix_timestamp() as u64) { + return Err(ValidationError::InvalidTime.into()); + } + verify(&d).await?; + validate(db, &d, Option:: bool>::None).await?; save(db, d, ser).await } -// verify signatures and time -async fn verify(delegation: &KeplerDelegation) -> Result<(), Error> { - match delegation { - KeplerDelegation::Ucan(ref ucan) => { - ucan.verify_signature(DID_METHODS.to_resolver()) - .await - .map_err(|_| DelegationError::InvalidSignature)?; - ucan.payload - .validate_time(None) - .map_err(|_| DelegationError::InvalidTime)?; - } - KeplerDelegation::Cacao(ref cacao) => { - cacao - .verify() - .await - .map_err(|_| DelegationError::InvalidSignature)?; - if !cacao.payload().valid_now() { - return Err(DelegationError::InvalidTime)?; - } - } - }; - Ok(()) -} - -// verify parenthood and authorization -async fn validate( - db: &C, - delegation: &util::DelegationInfo, -) -> Result<(), Error> { - // get caps which rely on delegated caps - let dependant_caps: Vec<_> = delegation - .capabilities - .iter() - .filter(|c| { - // remove caps for which the delegator is the root authority - c.resource - .orbit() - .map(|o| o.did() != delegation.delegator) - .unwrap_or(true) - }) - .collect(); - - match (dependant_caps.is_empty(), delegation.parents.is_empty()) { - // no dependant caps, no parents needed, must be valid - (true, _) => Ok(()), - // dependant caps, no parents, invalid - (false, true) => Err(DelegationError::MissingParents.into()), - // dependant caps, parents, check parents - (false, false) => { - // get parents which have - let parents: Vec<_> = Entity::find() - // the correct id - .filter(Column::Id.is_in(delegation.parents.iter().map(|c| Hash::from(*c)))) - // the correct delegatee - .filter(Column::Delegatee.eq(delegation.delegator.clone())) - .all(db) - .await? - .into_iter() - .filter(|p| { - // valid time bounds - p.expiry < delegation.expiry - && p.not_before - .map(|pnbf| delegation.not_before.map(|nbf| pnbf > nbf).unwrap_or(true)) - .unwrap_or(false) - }) - .collect(); - - // get delegated abilities from each parent - let parent_abilities = parents.load_many(abilities::Entity, db).await?; - - // check each dependant cap is supported by at least one parent cap - match dependant_caps.iter().find(|c| { - !parent_abilities - .iter() - .flatten() - .any(|pc| c.resource.extends(&pc.resource) && c.action == pc.ability) - }) { - Some(c) => Err(DelegationError::UnauthorizedCapability( - c.resource.clone(), - c.action.clone(), - ) - .into()), - None => Ok(()), - } - } - } +fn nothing(_: &Model) -> bool { + true } async fn save( db: &C, - delegation: util::DelegationInfo, + delegation: KeplerDelegation, serialization: Vec, -) -> Result { - save_actors(&[&delegation.delegator, &delegation.delegate], db).await?; +) -> Result { + save_actors( + &[ + &delegation.issuer().to_string(), + &delegation.audience().to_string(), + ], + db, + ) + .await?; let hash: Hash = crate::hash::hash(&serialization); // save delegation match Entity::insert(ActiveModel::from(Model { id: hash, - delegator: delegation.delegator, - delegatee: delegation.delegate, - expiry: delegation.expiry, - issued_at: delegation.issued_at, - not_before: delegation.not_before, - facts: None, + delegator: delegation.issuer().to_string(), + delegatee: delegation.audience().to_string(), + expiry: delegation + .expiration() + .map(|i| OffsetDateTime::from_unix_timestamp(i as i64)) + .transpose() + .map_err(ValidationError::from)?, + issued_at: delegation + .issued_at() + .map(|i| OffsetDateTime::from_unix_timestamp(i as i64)) + .transpose() + .map_err(ValidationError::from)?, + not_before: delegation + .not_before() + .map(|i| OffsetDateTime::from_unix_timestamp(i as i64)) + .transpose() + .map_err(ValidationError::from)?, + facts: delegation + .facts() + // TODO not ideal + .map(|f| serde_json::from_value(serde_json::to_value(f)?)) + .transpose()?, serialization, })) .on_conflict(OnConflict::column(Column::Id).do_nothing().to_owned()) @@ -248,25 +206,30 @@ async fn save( }; // save abilities - if !delegation.capabilities.is_empty() { - abilities::Entity::insert_many(delegation.capabilities.into_iter().map(|ab| { - abilities::ActiveModel::from(abilities::Model { - delegation: hash, - resource: ab.resource, - ability: ab.action, - caveats: Default::default(), - }) - })) + if !delegation.capabilities().is_empty() { + abilities::Entity::insert_many( + Resources::<'_, &'_ UriStr>::grants(&delegation) + .map(|(resource, abilities)| { + abilities.into_iter().map(|(ability, c)| abilities::Model { + delegation: hash, + resource: resource.into(), + ability: ability.clone().into(), + caveats: c.clone().into(), + }) + }) + .flatten() + .map(abilities::ActiveModel::from), + ) .exec(db) .await?; } // save parent relationships - if !delegation.parents.is_empty() { - parent_delegations::Entity::insert_many(delegation.parents.into_iter().map(|p| { + if let Some(prf) = delegation.proof().filter(|p| !p.is_empty()) { + parent_delegations::Entity::insert_many(prf.into_iter().map(|p| { parent_delegations::ActiveModel::from(parent_delegations::Model { child: hash, - parent: p.into(), + parent: (*p).into(), }) })) .exec(db) diff --git a/kepler-core/src/models/invocation.rs b/kepler-core/src/models/invocation.rs index ab9c7c29..b466ada4 100644 --- a/kepler-core/src/models/invocation.rs +++ b/kepler-core/src/models/invocation.rs @@ -1,12 +1,11 @@ use super::super::{ - events::{Invocation, VersionedOperation}, + events::{Invocation, SerializedEvent, VersionedOperation}, models::*, relationships::*, - util, }; use crate::hash::Hash; -use crate::types::{Facts, OrbitIdWrap, Resource}; -use kepler_lib::{authorization::KeplerInvocation, resolver::DID_METHODS}; +use crate::types::{Facts, OrbitIdWrap}; +use kepler_lib::authorization::{KeplerInvocation, Resources}; use sea_orm::{entity::prelude::*, sea_query::OnConflict, Condition, ConnectionTrait, QueryOrder}; use time::OffsetDateTime; @@ -49,154 +48,42 @@ impl Related for Entity { impl ActiveModelBehavior for ActiveModel {} -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error(transparent)] - Db(#[from] DbErr), - #[error(transparent)] - InvalidInvocation(#[from] InvocationError), -} - -#[derive(Debug, thiserror::Error)] -pub enum InvocationError { - #[error("Invocation expired or not yet valid")] - InvalidTime, - #[error("Failed to verify signature")] - InvalidSignature, - #[error("Unauthorized Invoker")] - UnauthorizedInvoker(String), - #[error("Unauthorized Action: {0} / {1}")] - UnauthorizedAction(Resource, String), - #[error("Cannot find parent delegation")] - MissingParents, - #[error("No Such Key: {0}")] - MissingKvWrite(String), -} - pub(crate) async fn process( db: &C, - invocation: Invocation, + SerializedEvent(i, ser): Invocation, ops: Vec, -) -> Result { - let (i, serialized) = (invocation.0, invocation.1); - verify(&i.invocation).await?; - - let now = OffsetDateTime::now_utc(); - validate(db, &i, Some(now)).await?; - - save(db, i, Some(now), serialized, ops).await -} - -async fn verify(invocation: &KeplerInvocation) -> Result<(), Error> { - invocation - .verify_signature(DID_METHODS.to_resolver()) - .await - .map_err(|_| InvocationError::InvalidSignature)?; - invocation - .payload - .validate_time(None) - .map_err(|_| InvocationError::InvalidTime)?; - Ok(()) -} - -// verify parenthood and authorization -async fn validate( - db: &C, - invocation: &util::InvocationInfo, - time: Option, -) -> Result<(), Error> { - // get caps which rely on delegated caps - let dependant_caps: Vec<_> = invocation - .capabilities - .iter() - .filter(|c| { - // remove caps for which the invoker is the root authority - c.resource - .orbit() - .map(|o| o.did() != invocation.invoker) - .unwrap_or(true) - }) - .collect(); - - match (dependant_caps.is_empty(), invocation.parents.is_empty()) { - // no dependant caps, no parents needed, must be valid - (true, _) => Ok(()), - // dependant caps, no parents, invalid - (false, true) => Err(InvocationError::MissingParents.into()), - // dependant caps, parents, check parents - (false, false) => { - // get parents which have - let parents = delegation::Entity::find() - // the correct id - .filter( - delegation::Column::Id.is_in(invocation.parents.iter().map(|c| Hash::from(*c))), - ) - // and also get their abilities - .find_with_related(abilities::Entity) - .all(db) - .await?; - - // check parent identifies correct invoker - parents - .iter() - .map(|(p, _)| { - if p.delegatee != invocation.invoker - && !invocation.invoker.starts_with(&p.delegatee) - { - Err(InvocationError::UnauthorizedInvoker( - invocation.invoker.clone(), - )) - } else { - Ok(()) - } - }) - .collect::, _>>()?; - - let now = time.unwrap_or_else(OffsetDateTime::now_utc); - - // only use parents which are valid at the time of invocation - let parents: Vec<_> = parents - .into_iter() - .filter(|(p, _)| { - p.expiry.map(|pexp| now < pexp).unwrap_or(true) - && p.not_before.map(|pnbf| now >= pnbf).unwrap_or(true) - }) - .collect(); - - // check each dependant cap is supported by at least one parent cap - match dependant_caps.iter().find(|c| { - !parents - .iter() - .flat_map(|(_, a)| a) - .any(|pc| c.resource.extends(&pc.resource) && c.action == pc.ability) - }) { - Some(c) => Err(InvocationError::UnauthorizedAction( - c.resource.clone(), - c.action.clone(), - ) - .into()), - None => Ok(()), - } - } +) -> Result { + let time = OffsetDateTime::now_utc(); + if !i.valid_at_time::<60, u64>(time.unix_timestamp() as u64) { + return Err(ValidationError::InvalidTime.into()); } + verify(&i).await?; + validate(db, &i, Some(|p: &delegation::Model| p.valid_at(time))).await?; + save(db, i, Some(time), ser, ops).await } async fn save( db: &C, - invocation: util::InvocationInfo, + invocation: KeplerInvocation, time: Option, serialization: Vec, parameters: Vec, -) -> Result { +) -> Result { let hash = crate::hash::hash(&serialization); - let issued_at = time.unwrap_or_else(OffsetDateTime::now_utc); + let issued_at = time + .map(Ok) + .or(invocation + .issued_at() + .map(|i| OffsetDateTime::from_unix_timestamp(i as i64))) + .transpose()? + .unwrap_or_else(OffsetDateTime::now_utc); match Entity::insert(ActiveModel::from(Model { id: hash, issued_at, serialization, facts: None, - invoker: invocation.invoker, + invoker: invocation.issuer().to_string(), })) .on_conflict(OnConflict::column(Column::Id).do_nothing().to_owned()) .exec(db) @@ -209,23 +96,30 @@ async fn save( }; // save invoked abilities - if !invocation.capabilities.is_empty() { - invoked_abilities::Entity::insert_many(invocation.capabilities.into_iter().map(|c| { - invoked_abilities::ActiveModel::from(invoked_abilities::Model { - invocation: hash, - resource: c.resource, - ability: c.action, - }) - })) + if !invocation.capabilities().is_empty() { + invoked_abilities::Entity::insert_many( + Resources::<'_, &UriStr>::grants(&invocation) + .map(|(resource, actions)| { + actions.into_iter().map(|(action, _)| { + invoked_abilities::ActiveModel::from(invoked_abilities::Model { + invocation: hash, + resource: resource.into(), + ability: action.clone().into(), + }) + }) + }) + .flatten(), + ) .exec(db) .await?; } + // save parent relationships - if !invocation.parents.is_empty() { - parent_delegations::Entity::insert_many(invocation.parents.into_iter().map(|p| { + if let Some(prf) = invocation.proof().filter(|p| !p.is_empty()) { + parent_delegations::Entity::insert_many(prf.into_iter().map(|p| { parent_delegations::ActiveModel::from(parent_delegations::Model { child: hash, - parent: p.into(), + parent: (*p).into(), }) })) .exec(db) @@ -261,7 +155,7 @@ async fn save( version, orbit, } => { - let deleted_invocation_id = if let Some((s, e, es)) = version { + match if let Some((s, e, es)) = version { kv_write::Entity::find().filter( Condition::all() .add(kv_write::Column::Key.eq(key.clone())) @@ -280,15 +174,22 @@ async fn save( } .one(db) .await? - .ok_or_else(|| InvocationError::MissingKvWrite(key.clone()))? - .invocation; - kv_delete::Entity::insert(kv_delete::ActiveModel::from(kv_delete::Model { - key, - invocation_id: hash, - orbit: orbit.into(), - deleted_invocation_id, - })) - .exec(db) + { + Some(kv) => Ok(kv_delete::Entity::insert(kv_delete::ActiveModel::from( + kv_delete::Model { + key, + invocation_id: hash, + orbit: orbit.into(), + deleted_invocation_id: kv.invocation, + }, + )) + .exec(db)), + None => Err(EventProcessingError::MissingServiceEvent( + orbit.to_resource(Some("kv".to_string()), Some(key), None), + "kv/del".to_string(), + version, + )), + }? .await?; } } diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index a338ecf8..54585669 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -7,3 +7,213 @@ pub mod kv_delete; pub mod kv_write; pub mod orbit; pub mod revocation; + +use crate::{hash::Hash, keys::Secrets, storage::StorageSetup, types::CaveatsInner, TxError}; +use kepler_lib::{ + authorization::Resources, + cacaos::v2::{ + common::{CommonCacao, CommonVerifier, Error as CacaoError}, + Cacao, + }, + iri_string::types::{UriStr, UriString}, + resolver::DID_METHODS, + resource::{AnyResource, ResourceId}, + ssi::ucan::capabilities::{Ability, NotaBeneCollection}, +}; +use sea_orm::entity::prelude::*; +use std::collections::{BTreeMap, HashMap, HashSet}; +use time::OffsetDateTime; + +#[derive(Debug, thiserror::Error)] +pub enum EventProcessingError { + #[error(transparent)] + Db(#[from] DbErr), + #[error(transparent)] + InvalidMessage(#[from] ValidationError), + #[error(transparent)] + Serde(#[from] serde_json::Error), + #[error("Missing event for service: {0} {1} {2:?}")] + MissingServiceEvent(ResourceId, String, Option<(i64, Hash, i64)>), +} + +impl EventProcessingError { + pub(crate) fn to_del(self) -> TxError { + match self { + EventProcessingError::Db(e) => TxError::Db(e), + EventProcessingError::InvalidMessage(e) => TxError::InvalidDelegation(e), + EventProcessingError::Serde(e) => TxError::Serde(e), + EventProcessingError::MissingServiceEvent(id, service, version) => { + TxError::MissingServiceEvent(id, service, version) + } + } + } + pub(crate) fn to_inv(self) -> TxError { + match self { + EventProcessingError::Db(e) => TxError::Db(e), + EventProcessingError::InvalidMessage(e) => TxError::InvalidInvocation(e), + EventProcessingError::Serde(e) => TxError::Serde(e), + EventProcessingError::MissingServiceEvent(id, service, version) => { + TxError::MissingServiceEvent(id, service, version) + } + } + } +} + +impl From for EventProcessingError { + fn from(e: CacaoError) -> Self { + Self::InvalidMessage(e.into()) + } +} + +impl From for EventProcessingError { + fn from(e: time::error::ComponentRange) -> Self { + Self::InvalidMessage(e.into()) + } +} + +#[derive(Debug, thiserror::Error)] +pub enum ValidationError { + #[error("Message expired or not yet valid")] + InvalidTime, + #[error("Failed to verify signature: {0}")] + InvalidSignature(#[from] CacaoError), + #[error("Unauthorized Issuer: {0}")] + UnauthorizedIssuer(String), + #[error("Unauthorized Capabilities: {0:?}")] + UnauthorizedCapability(HashMap>), + #[error("Cannot find parent delegation")] + MissingParents, + #[error(transparent)] + UnixTimeError(#[from] time::error::ComponentRange), +} + +// verify signature +async fn verify(cacao: &CommonCacao) -> Result<(), ValidationError> { + Ok(cacao.verify(&CommonVerifier::new(&*DID_METHODS)).await?) +} + +// verify parenthood and authorization +async fn validate<'a, C: ConnectionTrait>( + db: &C, + message: &'a CommonCacao, + parent_check: Option bool>, +) -> Result<(), EventProcessingError> { + let mut required = get_required(message); + match (required.next(), message.proof()) { + // no dependant caps, no parents needed, must be valid + (None, _) => Ok(()), + // dependant caps and parents, check parents + (Some(rf), Some(prf)) if !prf.is_empty() => { + let mut unauthorized = take_unauthorized( + [rf].into_iter().chain(required), + // get all known parents of `message` + get_granted(db, message, parent_check).await?, + ) + .map(|(r, a)| (r.into(), a.into_iter().cloned().collect())); + match unauthorized.next() { + Some(uf) => Err(ValidationError::UnauthorizedCapability( + [uf].into_iter().chain(unauthorized).collect(), + ) + .into()), + _ => Ok(()), + } + } + // dependant caps, no parents, invalid + _ => Err(ValidationError::MissingParents.into()), + } +} + +// get caps which rely on delegated parent caps +fn get_required<'a, S: 'a, F: 'a, NB: 'a>( + message: &'a Cacao, +) -> impl Iterator< + Item = ( + AnyResource<&'a UriStr>, + &'a BTreeMap>, + ), +> { + Resources::<'a, AnyResource<&'a UriStr>, NB>::grants(message) + // remove caps for which the delegator is the root authority + .filter(|(r, _)| { + r.orbit().map_or(true, |o| { + o.suffix() != message.issuer().method().to_string() + }) + }) +} + +// check each actioned cap is supported by at least one granted cap +// return caps which are not supported +fn take_unauthorized<'a>( + actioned: impl Iterator, &'a BTreeMap)>, + granted: HashMap, BTreeMap>, +) -> impl Iterator, HashSet<&'a Ability>)> { + actioned.filter_map(move |(r, a)| { + a.keys() + .filter(|ab| { + // get unsupported abilities + !granted + .iter() + // only get applicable caps where the resource is right + .filter_map(|(gr, ga)| r.extends(gr).then_some(ga)) + // and the ability is not supported + .any(|ga| ga.contains_key(ab.as_ref())) + }) + .map(Some) + .collect::>>() + .map(|ab| (r, ab)) + }) +} + +async fn get_granted( + db: &C, + message: &CommonCacao, + check: Option bool>, +) -> Result>, EventProcessingError> { + Ok(match message.proof() { + // get delegated abilities from each parent + Some(prf) if !prf.is_empty() => { + let issuer = message.issuer().to_string(); + let nbf = message + .not_before() + .map(|i| OffsetDateTime::from_unix_timestamp(i as i64)) + .transpose()?; + let exp = message + .expiration() + .map(|i| OffsetDateTime::from_unix_timestamp(i as i64)) + .transpose()?; + + delegation::Entity::find() + // get parents which have + // the correct id + .filter(delegation::Column::Id.is_in(prf.iter().map(|c| Hash::from(*c)))) + // the correct delegatee + .filter(delegation::Column::Delegatee.eq(&issuer)) + // unrevoked + .left_join(revocation::Entity) + .filter(revocation::Column::Id.is_null()) + .all(db) + .await? + .into_iter() + // valid issuer + .filter(|p| &p.delegatee == &issuer) + // valid time bounds + .filter(|p| p.validate_bounds(nbf, exp)) + // extra check + .filter(|p| check.as_ref().map_or(true, |f| f(p))) + .collect::>() + .load_many(abilities::Entity, db) + .await? + .into_iter() + .flatten() + .fold(HashMap::new(), |mut acc, pc| { + acc.entry(pc.resource.0) + .or_default() + .entry(pc.ability.0.to_string()) + .or_default() + .extend(pc.caveats.0); + acc + }) + } + _ => HashMap::new(), + }) +} From bf4e0f8816b07c7c77dd304ca32cac8dfc0a95cd Mon Sep 17 00:00:00 2001 From: chunningham Date: Mon, 11 Sep 2023 01:56:53 +0200 Subject: [PATCH 08/24] fix revocation --- kepler-core/src/models/revocation.rs | 44 ++++++++-------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/kepler-core/src/models/revocation.rs b/kepler-core/src/models/revocation.rs index bbd94ef0..699c0459 100644 --- a/kepler-core/src/models/revocation.rs +++ b/kepler-core/src/models/revocation.rs @@ -1,8 +1,7 @@ -use super::super::{events::Revocation, models::*, relationships::*}; +use super::super::{events::SRevocation, models::*}; use crate::hash::{hash, Hash}; -use kepler_lib::authorization::KeplerRevocation; +use kepler_lib::resolver::DID_METHODS; use sea_orm::{entity::prelude::*, sea_query::OnConflict, ConnectionTrait}; -use time::OffsetDateTime; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "revocation")] @@ -67,39 +66,31 @@ pub enum RevocationError { pub(crate) async fn process( db: &C, - revocation: Revocation, + revocation: SRevocation, ) -> Result { let (r, serialization) = (revocation.0, revocation.1); - let t = OffsetDateTime::now_utc(); - - match &r.revocation { - KeplerRevocation::Cacao(c) => { - c.verify() - .await - .map_err(|_| RevocationError::InvalidSignature)?; - if !c.payload().valid_at(&t) { - return Err(RevocationError::InvalidTime.into()); - }; - } - }; + r.verify_signature(&*DID_METHODS, None) + .await + .map_err(|_| RevocationError::InvalidSignature)?; let hash: Hash = hash(&serialization); - let delegation = delegation::Entity::find_by_id(Hash::from(r.revoked)) + // TODO get the whole delegation chain + let delegation = delegation::Entity::find_by_id(Hash::from(r.revoke)) .one(db) .await? .ok_or(RevocationError::MissingParents)?; // check the revoker is also the delegator - if delegation.delegator != r.revoker { - return Err(RevocationError::UnauthorizedRevoker(r.revoker).into()); + if delegation.delegator != r.issuer { + return Err(RevocationError::UnauthorizedRevoker(r.issuer).into()); }; match Entity::insert(ActiveModel::from(Model { id: hash, serialization, - revoker: r.revoker, - revoked: delegation.id, + revoker: r.issuer, + revoked: r.revoke.into(), })) .on_conflict(OnConflict::column(Column::Id).do_nothing().to_owned()) .exec(db) @@ -111,16 +102,5 @@ pub(crate) async fn process( } }; - if !r.parents.is_empty() { - parent_delegations::Entity::insert_many(r.parents.into_iter().map(|p| { - parent_delegations::ActiveModel::from(parent_delegations::Model { - child: hash, - parent: p.into(), - }) - })) - .exec(db) - .await?; - } - Ok(hash) } From 6de8e03a04ff57f6e592771b8099163a99a482d4 Mon Sep 17 00:00:00 2001 From: chunningham Date: Mon, 11 Sep 2023 01:57:35 +0200 Subject: [PATCH 09/24] renames and adding time tolerance as a const generic --- kepler-core/src/db.rs | 46 ++++++++++--------- kepler-core/src/events/mod.rs | 40 ++++++---------- kepler-core/src/models/delegation.rs | 22 ++++----- kepler-core/src/models/invocation.rs | 12 ++--- kepler-core/src/types/ability_name.rs | 2 +- kepler-core/src/types/resource.rs | 2 +- lib/src/authorization.rs | 66 ++++++--------------------- sdk/src/authorization.rs | 8 ++-- sdk/src/session.rs | 8 ++-- sdk/src/siwe_utils.rs | 4 +- 10 files changed, 77 insertions(+), 133 deletions(-) diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index 0c282888..b513df94 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -1,4 +1,6 @@ -use crate::events::{epoch_hash, Delegation, Event, HashError, Invocation, Operation, Revocation}; +use crate::events::{ + epoch_hash, Event, HashError, Operation, SDelegation, SInvocation, SRevocation, +}; use crate::hash::Hash; use crate::keys::{get_did_key, Secrets}; use crate::migrations::Migrator; @@ -10,7 +12,7 @@ use crate::storage::{ }; use crate::types::{Metadata, OrbitIdWrap}; use kepler_lib::{ - authorization::{EncodingError, KeplerDelegation, Resources}, + authorization::{Delegation, EncodingError, Resources}, resource::{OrbitId, ResourceId}, ssi::ucan::capabilities::Ability, }; @@ -165,7 +167,7 @@ where B: StorageSetup, K: Secrets, { - async fn transact( + async fn transact( &self, events: Vec, ) -> Result, TxError> { @@ -174,32 +176,32 @@ where .begin_with_config(Some(sea_orm::IsolationLevel::ReadUncommitted), None) .await?; - let commit = transact(&tx, &self.storage, &self.secrets, events).await?; + let commit = transact::(&tx, &self.storage, &self.secrets, events).await?; tx.commit().await?; Ok(commit) } - pub async fn delegate( + pub async fn delegate( &self, - delegation: Delegation, + delegation: SDelegation, ) -> Result, TxError> { - self.transact(vec![Event::Delegation(Box::new(delegation))]) + self.transact::(vec![Event::Delegation(Box::new(delegation))]) .await } - pub async fn revoke( + pub async fn revoke( &self, - revocation: Revocation, + revocation: SRevocation, ) -> Result, TxError> { - self.transact(vec![Event::Revocation(Box::new(revocation))]) + self.transact::(vec![Event::Revocation(Box::new(revocation))]) .await } - pub async fn invoke( + pub async fn invoke( &self, - invocation: Invocation, + invocation: SInvocation, mut inputs: InvocationInputs, ) -> Result< ( @@ -264,7 +266,7 @@ where .begin_with_config(Some(sea_orm::IsolationLevel::ReadUncommitted), None) .await?; // verify and commit invocation and kv operations - let commit = transact( + let commit = transact::( &tx, &self.storage, &self.secrets, @@ -342,7 +344,7 @@ pub enum InvocationOutcome { KvMetadata(Option), KvWrite, KvRead(Option<(Metadata, Content)>), - OpenSessions(HashMap), + OpenSessions(HashMap), } impl From for TxError { @@ -363,7 +365,7 @@ async fn event_orbits<'a, C: ConnectionTrait>( let revoked_events = event_order::Entity::find() .filter( event_order::Column::Event.is_in(ev.iter().filter_map(|(_, e)| match e { - // TODO Event::Revocation(r) => Some(Hash::from(r.0.revoke)), + Event::Revocation(r) => Some(Hash::from(r.0.revoke)), _ => None, })), ) @@ -388,7 +390,7 @@ async fn event_orbits<'a, C: ConnectionTrait>( } } Event::Revocation(r) => { - let r_hash = Hash::from(r.0.revoked); + let r_hash = Hash::from(r.0.revoke); for revoked in &revoked_events { if r_hash == revoked.event { let entry = orbits @@ -405,7 +407,7 @@ async fn event_orbits<'a, C: ConnectionTrait>( Ok(orbits) } -pub(crate) async fn transact( +pub(crate) async fn transact( db: &C, store_setup: &S, secrets: &K, @@ -587,8 +589,10 @@ pub(crate) async fn transact( for (hash, event) in event_hashes { match event { - Event::Delegation(d) => delegation::process(db, *d).await.map_err(|e| e.to_del())?, - Event::Invocation(i, ops) => invocation::process( + Event::Delegation(d) => delegation::process::(db, *d) + .await + .map_err(|e| e.to_del())?, + Event::Invocation(i, ops) => invocation::process::( db, *i, ops.into_iter() @@ -732,7 +736,7 @@ async fn get_valid_delegations( db: &C, orbit: &OrbitId, time: Option, -) -> Result, TxError> { +) -> Result, TxError> { let (dels, abilities): (Vec, Vec>) = delegation::Entity::find() .left_join(revocation::Entity) @@ -761,7 +765,7 @@ async fn get_valid_delegations( None } }) - .collect::, EncodingError>>()?) + .collect::, EncodingError>>()?) } fn normalize_path(p: &str) -> &str { diff --git a/kepler-core/src/events/mod.rs b/kepler-core/src/events/mod.rs index 54ba634d..28e6c297 100644 --- a/kepler-core/src/events/mod.rs +++ b/kepler-core/src/events/mod.rs @@ -3,9 +3,7 @@ use crate::{ types::Metadata, }; pub use kepler_lib::{ - authorization::{ - EncodingError, HeaderEncode, KeplerDelegation, KeplerInvocation, KeplerRevocation, - }, + authorization::{Delegation, EncodingError, HeaderEncode, Invocation, Revocation}, libipld::cid::{ multihash::{Code, Error as MultihashError, MultihashDigest}, Cid, @@ -18,30 +16,18 @@ use serde_ipld_dagcbor::EncodeError; #[derive(Debug)] pub struct SerializedEvent(pub T, pub(crate) Vec); -#[non_exhaustive] -#[derive(thiserror::Error, Debug)] -pub enum FromReqErr { - #[error(transparent)] - Encoding(#[from] EncodingError), - #[error(transparent)] - TryFrom(T), -} - -impl SerializedEvent { - pub fn from_header_ser(s: &str) -> Result> - where - T: TryFrom, - I: HeaderEncode, - { - I::decode(s) - .map_err(FromReqErr::from) - .and_then(|(i, s)| Ok(Self(T::try_from(i).map_err(FromReqErr::TryFrom)?, s))) +impl SerializedEvent +where + T: HeaderEncode, +{ + pub fn from_header_ser(s: &str) -> Result { + T::decode(s).map(|(t, s)| Self(t, s)) } } -pub type Delegation = SerializedEvent; -pub type Invocation = SerializedEvent; -pub type Revocation = SerializedEvent; +pub type SDelegation = SerializedEvent; +pub type SInvocation = SerializedEvent; +pub type SRevocation = SerializedEvent; #[derive(Debug, Hash, PartialEq, Eq)] pub(crate) enum Operation { @@ -115,9 +101,9 @@ pub(crate) enum VersionedOperation { #[derive(Debug)] pub(crate) enum Event { - Invocation(Box, Vec), - Delegation(Box), - Revocation(Box), + Invocation(Box, Vec), + Delegation(Box), + Revocation(Box), } impl Event { diff --git a/kepler-core/src/models/delegation.rs b/kepler-core/src/models/delegation.rs index 12b41d3d..f880bf43 100644 --- a/kepler-core/src/models/delegation.rs +++ b/kepler-core/src/models/delegation.rs @@ -1,13 +1,11 @@ use crate::hash::Hash; use crate::types::Facts; use crate::{ - events::{Delegation, SerializedEvent}, + events::{SDelegation, SerializedEvent}, models::*, relationships::*, }; -use kepler_lib::authorization::{ - delegation_from_bytes, EncodingError, KeplerDelegation, Resources, -}; +use kepler_lib::authorization::{delegation_from_bytes, Delegation, EncodingError, Resources}; use sea_orm::{entity::prelude::*, sea_query::OnConflict, ConnectionTrait}; use time::{ext::NumericalDuration, OffsetDateTime}; @@ -27,15 +25,15 @@ pub struct Model { } impl Model { - pub(crate) fn reser_cacao(&self) -> Result { + pub(crate) fn reser_cacao(&self) -> Result { Ok(SerializedEvent( delegation_from_bytes(&self.serialization)?, self.serialization.clone(), )) } - pub(crate) fn valid_at(&self, time: OffsetDateTime) -> bool { - let skew = (SKEW as i64).seconds(); + pub(crate) fn valid_at(&self, time: OffsetDateTime) -> bool { + let skew = SKEW.seconds(); self.expiry.map_or(true, |exp| time < exp + skew) && self.not_before.map_or(true, |nbf| nbf <= time + skew) } @@ -134,9 +132,9 @@ impl Linked for Delegatee { impl ActiveModelBehavior for ActiveModel {} -pub(crate) async fn process( +pub(crate) async fn process( db: &C, - SerializedEvent(d, ser): Delegation, + SerializedEvent(d, ser): SDelegation, ) -> Result { let time = OffsetDateTime::now_utc(); if !d.valid_at_time::<60, u64>(time.unix_timestamp() as u64) { @@ -148,13 +146,9 @@ pub(crate) async fn process( save(db, d, ser).await } -fn nothing(_: &Model) -> bool { - true -} - async fn save( db: &C, - delegation: KeplerDelegation, + delegation: Delegation, serialization: Vec, ) -> Result { save_actors( diff --git a/kepler-core/src/models/invocation.rs b/kepler-core/src/models/invocation.rs index b466ada4..c7f06e54 100644 --- a/kepler-core/src/models/invocation.rs +++ b/kepler-core/src/models/invocation.rs @@ -1,11 +1,11 @@ use super::super::{ - events::{Invocation, SerializedEvent, VersionedOperation}, + events::{SInvocation, SerializedEvent, VersionedOperation}, models::*, relationships::*, }; use crate::hash::Hash; use crate::types::{Facts, OrbitIdWrap}; -use kepler_lib::authorization::{KeplerInvocation, Resources}; +use kepler_lib::authorization::{Invocation, Resources}; use sea_orm::{entity::prelude::*, sea_query::OnConflict, Condition, ConnectionTrait, QueryOrder}; use time::OffsetDateTime; @@ -48,9 +48,9 @@ impl Related for Entity { impl ActiveModelBehavior for ActiveModel {} -pub(crate) async fn process( +pub(crate) async fn process( db: &C, - SerializedEvent(i, ser): Invocation, + SerializedEvent(i, ser): SInvocation, ops: Vec, ) -> Result { let time = OffsetDateTime::now_utc(); @@ -58,13 +58,13 @@ pub(crate) async fn process( return Err(ValidationError::InvalidTime.into()); } verify(&i).await?; - validate(db, &i, Some(|p: &delegation::Model| p.valid_at(time))).await?; + validate(db, &i, Some(|p: &delegation::Model| p.valid_at::<60>(time))).await?; save(db, i, Some(time), ser, ops).await } async fn save( db: &C, - invocation: KeplerInvocation, + invocation: Invocation, time: Option, serialization: Vec, parameters: Vec, diff --git a/kepler-core/src/types/ability_name.rs b/kepler-core/src/types/ability_name.rs index 521a8c42..eeddef1a 100644 --- a/kepler-core/src/types/ability_name.rs +++ b/kepler-core/src/types/ability_name.rs @@ -36,7 +36,7 @@ impl PartialEq for AbilityName { } impl AbilityName { - fn into_inner(self) -> Ability { + pub fn into_inner(self) -> Ability { self.0 } } diff --git a/kepler-core/src/types/resource.rs b/kepler-core/src/types/resource.rs index 4d1ea543..03714791 100644 --- a/kepler-core/src/types/resource.rs +++ b/kepler-core/src/types/resource.rs @@ -17,7 +17,7 @@ impl AsRef for Resource { impl Resource { pub fn extends, S: AsRef>>(&self, other: &S) -> bool { - match (self.0, other.as_ref()) { + match (&self.0, other.as_ref()) { (AnyResource::Kepler(a), AnyResource::Kepler(b)) => a.extends(b).is_ok(), (AnyResource::Other(a), AnyResource::Other(b)) => a.as_str().starts_with(b.as_ref()), _ => false, diff --git a/lib/src/authorization.rs b/lib/src/authorization.rs index 5cace70d..7e52cd36 100644 --- a/lib/src/authorization.rs +++ b/lib/src/authorization.rs @@ -1,11 +1,11 @@ -use crate::resource::{AnyResource, ResourceCapErr, ResourceId}; +use crate::resource::{AnyResource, ResourceId}; use cacaos::v2::{common::CommonCacao, varsig::either::EitherSignature, Cacao}; use iri_string::types::{UriStr, UriString}; use ssi::ucan::{ capabilities::*, common::Common, jwt::{Jwt, UcanDecode}, - Ucan, + Revocation as URevocation, Ucan, }; use std::{ collections::BTreeMap, @@ -30,9 +30,9 @@ pub trait Resources<'a, RO: 'a = &'a UriStr, NB: 'a = serde_json::Value> { } } -pub type KeplerDelegation = CommonCacao; +pub type Delegation = CommonCacao; -impl HeaderEncode for KeplerDelegation { +impl HeaderEncode for Delegation { fn encode(&self) -> Result { Ok(match self.signature().sig() { EitherSignature::A(_) => { @@ -110,7 +110,7 @@ impl<'a, NB: 'a> Resources<'a, AnyResource<&'a UriStr>, NB> for Capabilities } } -pub fn delegation_from_bytes(b: &[u8]) -> Result { +pub fn delegation_from_bytes(b: &[u8]) -> Result { match serde_ipld_dagcbor::from_slice(b) { Ok(cacao) => Ok(cacao), Err(_) => Ok( @@ -119,63 +119,23 @@ pub fn delegation_from_bytes(b: &[u8]) -> Result Result { - match self { - Self::Cacao(c) => Ok(base64::encode_config( - serde_ipld_dagcbor::to_vec(&c)?, - base64::URL_SAFE, - )), - } + Ok(base64::encode_config( + serde_ipld_dagcbor::to_vec(&self)?, + base64::URL_SAFE, + )) } fn decode(s: &str) -> Result<(Self, Vec), EncodingError> { let v = base64::decode_config(s, base64::URL_SAFE)?; - Ok((Self::Cacao(serde_ipld_dagcbor::from_slice(&v)?), v)) + Ok((serde_ipld_dagcbor::from_slice(&v)?, v)) } } -// pub async fn make_invocation( -// invocation_target: Vec, -// delegation: Cid, -// jwk: &JWK, -// verification_method: String, -// expiration: f64, -// not_before: Option, -// nonce: Option, -// ) -> Result { -// Ok(Payload { -// issuer: verification_method.clone(), -// audience: verification_method, -// not_before: not_before.map(NumericDate::try_from_seconds).transpose()?, -// expiration: NumericDate::try_from_seconds(expiration)?, -// nonce: Some(nonce.unwrap_or_else(|| format!("urn:uuid:{}", Uuid::new_v4()))), -// facts: None, -// proof: vec![delegation], -// attenuation: invocation_target -// .into_iter() -// .map(|t| t.try_into()) -// .collect::, _>>()?, -// } -// .sign(jwk.get_algorithm().unwrap_or_default(), jwk)?) -// } - -#[derive(Debug, thiserror::Error)] -pub enum InvocationError { - #[error(transparent)] - ResourceCap(#[from] ResourceCapErr), - #[error(transparent)] - NumericDateConversion(#[from] ssi::jwt::NumericDateConversionError), - #[error(transparent)] - UCAN(#[from] ssi::ucan::Error), -} - #[derive(Debug, thiserror::Error)] pub enum EncodingError { #[error(transparent)] diff --git a/sdk/src/authorization.rs b/sdk/src/authorization.rs index ee547149..59864525 100644 --- a/sdk/src/authorization.rs +++ b/sdk/src/authorization.rs @@ -1,4 +1,4 @@ -use kepler_lib::authorization::{KeplerDelegation, KeplerInvocation}; +use kepler_lib::authorization::{Delegation, Invocation}; use serde::{Deserialize, Serialize}; use crate::session::Session; @@ -6,13 +6,13 @@ use crate::session::Session; #[derive(Debug, Deserialize, Serialize, Clone)] pub struct DelegationHeaders { #[serde(with = "header_enc", rename = "Authorization")] - delegation: KeplerDelegation, + delegation: Delegation, } #[derive(Debug, Deserialize, Serialize, Clone)] pub struct InvocationHeaders { #[serde(with = "header_enc", rename = "Authorization")] - invocation: KeplerInvocation, + invocation: Invocation, } impl InvocationHeaders { @@ -30,7 +30,7 @@ impl InvocationHeaders { } impl DelegationHeaders { - pub fn new(delegation: KeplerDelegation) -> Self { + pub fn new(delegation: Delegation) -> Self { Self { delegation } } } diff --git a/sdk/src/session.rs b/sdk/src/session.rs index 4d1d3a46..ba27f1b4 100644 --- a/sdk/src/session.rs +++ b/sdk/src/session.rs @@ -1,7 +1,7 @@ use crate::authorization::DelegationHeaders; use http::uri::Authority; use kepler_lib::{ - authorization::{make_invocation, InvocationError, KeplerInvocation}, + authorization::{make_invocation, Invocation, InvocationError}, cacaos::{ siwe::{generate_nonce, Message, TimeStamp, Version as SIWEVersion}, siwe_cacao::SIWESignature, @@ -132,7 +132,7 @@ impl Session { pub async fn invoke( self, actions: Vec<(String, String, String)>, - ) -> Result { + ) -> Result { let targets = actions .into_iter() .map(|(s, p, a)| self.orbit_id.clone().to_resource(Some(s), Some(p), Some(a))); @@ -186,7 +186,7 @@ pub async fn prepare_session(config: SessionConfig) -> Result Result { use kepler_lib::{ - authorization::KeplerDelegation, + authorization::Delegation, cacaos::siwe_cacao::SiweCacao, libipld::{cbor::DagCborCodec, multihash::Code, store::DefaultParams, Block}, }; @@ -199,7 +199,7 @@ pub fn complete_session_setup(signed_session: SignedSession) -> Result::encode(DagCborCodec, Code::Blake3_256, &delegation) .map_err(Error::UnableToGenerateCid)? .cid(); - let delegation_header = DelegationHeaders::new(KeplerDelegation::Cacao(Box::new(delegation))); + let delegation_header = DelegationHeaders::new(Delegation::Cacao(Box::new(delegation))); Ok(Session { delegation_header, diff --git a/sdk/src/siwe_utils.rs b/sdk/src/siwe_utils.rs index b33d1fc3..e3ea6830 100644 --- a/sdk/src/siwe_utils.rs +++ b/sdk/src/siwe_utils.rs @@ -1,5 +1,5 @@ use http::uri::Authority; -use kepler_lib::authorization::KeplerDelegation; +use kepler_lib::authorization::Delegation; use kepler_lib::cacaos::{ siwe::{generate_nonce, Message, TimeStamp, Version}, siwe_cacao::{SIWESignature, SiweCacao}, @@ -73,7 +73,7 @@ pub fn generate_host_siwe_message(config: HostConfig) -> Result } pub fn siwe_to_delegation_headers(signed_message: SignedMessage) -> DelegationHeaders { - DelegationHeaders::new(KeplerDelegation::Cacao(Box::new(SiweCacao::new( + DelegationHeaders::new(Delegation::Cacao(Box::new(SiweCacao::new( signed_message.siwe.into(), signed_message.signature, None, From 0294a4c5c5cdf643295611e33bdd88ea341da635 Mon Sep 17 00:00:00 2001 From: chunningham Date: Mon, 11 Sep 2023 02:00:44 +0200 Subject: [PATCH 10/24] update application --- Cargo.lock | 759 ++++++++++++++++++++++--------------------- src/auth_guards.rs | 43 +-- src/authorization.rs | 21 +- src/lib.rs | 1 + src/routes/mod.rs | 39 +-- 5 files changed, 428 insertions(+), 435 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b133d6b6..46872448 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -58,9 +58,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" dependencies = [ "memchr", ] @@ -146,7 +146,7 @@ dependencies = [ "async-lock", "async-task", "concurrent-queue", - "fastrand", + "fastrand 1.9.0", "futures-lite", "slab", ] @@ -182,15 +182,15 @@ dependencies = [ "polling", "rustix 0.37.23", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", ] [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] @@ -260,7 +260,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -271,13 +271,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -328,7 +328,7 @@ dependencies = [ "http", "hyper", "ring", - "time 0.3.23", + "time", "tokio", "tower", "tracing", @@ -384,7 +384,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand", + "fastrand 1.9.0", "http", "tokio-stream", "tower", @@ -492,7 +492,7 @@ dependencies = [ "percent-encoding", "regex", "ring", - "time 0.3.23", + "time", "tracing", ] @@ -540,7 +540,7 @@ dependencies = [ "aws-smithy-http-tower", "aws-smithy-types", "bytes", - "fastrand", + "fastrand 1.9.0", "http", "http-body", "hyper", @@ -628,7 +628,7 @@ dependencies = [ "itoa", "num-integer", "ryu", - "time 0.3.23", + "time", ] [[package]] @@ -658,9 +658,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -716,9 +716,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "base64ct" @@ -769,9 +769,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bitvec" @@ -819,24 +819,24 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq 0.2.6", + "constant_time_eq 0.3.0", ] [[package]] name = "blake2s_simd" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" +checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq 0.2.6", + "constant_time_eq 0.3.0", ] [[package]] @@ -910,7 +910,7 @@ dependencies = [ "async-lock", "async-task", "atomic-waker", - "fastrand", + "fastrand 1.9.0", "futures-lite", "log", ] @@ -990,9 +990,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "serde", @@ -1050,9 +1050,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bytes-utils" @@ -1084,7 +1084,7 @@ dependencies = [ "ssi-jwt", "ssi-ucan", "thiserror", - "time 0.3.23", + "time", "ucan-capabilities-object", "url", "varsig", @@ -1105,7 +1105,7 @@ dependencies = [ "serde_with 2.3.3", "siwe", "thiserror", - "time 0.3.23", + "time", "url", ] @@ -1149,9 +1149,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfb-mode" @@ -1170,18 +1173,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -1291,9 +1293,9 @@ checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" [[package]] name = "const-oid" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "constant_time_eq" @@ -1301,12 +1303,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "constant_time_eq" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" - [[package]] name = "constant_time_eq" version = "0.3.0" @@ -1326,7 +1322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" dependencies = [ "percent-encoding", - "time 0.3.23", + "time", "version_check", ] @@ -1382,9 +1378,9 @@ checksum = "fd121741cf3eb82c08dd3023eb55bf2665e5f60ec20f89760cf836ae4562e6a0" [[package]] name = "crc32c" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfea2db42e9927a3845fb268a10a72faed6d416065f77873f05e411457c363e" +checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74" dependencies = [ "rustc_version", ] @@ -1457,9 +1453,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array 0.14.7", "rand_core 0.6.4", @@ -1501,9 +1497,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.3" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436ace70fc06e06f7f689d2624dc4e2f0ea666efb5aa704215f7249ae6e047a7" +checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" dependencies = [ "cfg-if", "cpufeatures", @@ -1524,7 +1520,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -1620,7 +1616,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -1664,7 +1660,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -1716,21 +1712,30 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ - "const-oid 0.9.4", + "const-oid 0.9.5", "zeroize", ] [[package]] name = "der" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ - "const-oid 0.9.4", + "const-oid 0.9.5", "pem-rfc7468 0.7.0", "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +dependencies = [ + "serde", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1833,17 +1838,17 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] name = "did-ethr" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "chrono", @@ -1859,7 +1864,7 @@ dependencies = [ [[package]] name = "did-method-key" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "multibase 0.8.0", @@ -1874,7 +1879,7 @@ dependencies = [ [[package]] name = "did-onion" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "http", @@ -1887,7 +1892,7 @@ dependencies = [ [[package]] name = "did-pkh" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "bech32 0.8.1", @@ -1906,7 +1911,7 @@ dependencies = [ [[package]] name = "did-tz" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "anyhow", "async-trait", @@ -1926,7 +1931,7 @@ dependencies = [ [[package]] name = "did-web" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "http", @@ -1938,7 +1943,7 @@ dependencies = [ [[package]] name = "did-webkey" version = "0.2.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "anyhow", "async-trait", @@ -1979,7 +1984,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid 0.9.4", + "const-oid 0.9.5", "crypto-common", "subtle", ] @@ -2024,11 +2029,11 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ - "der 0.7.7", + "der 0.7.8", "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", @@ -2047,9 +2052,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ "pkcs8 0.10.2", "signature 2.1.0", @@ -2071,12 +2076,13 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.0.0-rc.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa8e9049d5d72bfc12acbc05914731b5322f79b5e2f195e9f2d705fca22ab4c" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.0.0-rc.3", - "ed25519 2.2.1", + "curve25519-dalek 4.1.0", + "ed25519 2.2.2", + "rand_core 0.6.4", "serde", "sha2 0.10.7", "zeroize", @@ -2084,9 +2090,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -2115,7 +2121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct 0.2.0", - "crypto-bigint 0.5.2", + "crypto-bigint 0.5.3", "digest 0.10.7", "ff 0.13.0", "generic-array 0.14.7", @@ -2131,9 +2137,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -2146,9 +2152,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -2186,6 +2192,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "ff" version = "0.12.1" @@ -2208,9 +2220,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" [[package]] name = "figment" @@ -2221,11 +2233,17 @@ dependencies = [ "atomic", "pear", "serde", - "toml 0.7.6", + "toml 0.7.8", "uncased", "version_check", ] +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + [[package]] name = "fixed-hash" version = "0.7.0" @@ -2237,9 +2255,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -2365,7 +2383,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -2382,7 +2400,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -2392,8 +2410,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", - "rustls 0.20.8", - "webpki 0.22.0", + "rustls 0.20.9", + "webpki 0.22.1", ] [[package]] @@ -2493,9 +2511,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "glob" @@ -2551,9 +2569,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -2610,21 +2628,20 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ "hashbrown 0.14.0", ] [[package]] name = "headers" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.13.1", - "bitflags 1.3.2", + "base64 0.21.4", "bytes", "headers-core", "http", @@ -2720,9 +2737,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" @@ -2741,7 +2758,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -2774,7 +2791,7 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls 0.21.5", + "rustls 0.21.7", "tokio", "tokio-rustls 0.24.1", ] @@ -2937,15 +2954,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.4", + "rustix 0.38.13", "windows-sys 0.48.0", ] [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -3096,9 +3113,9 @@ dependencies = [ [[package]] name = "json-number" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c724484d970b5aabe46934b9571980e255fd50a9ef1b13f23ed2b5c2a19bbb69" +checksum = "280f53da10842ffc42737ac8a6f2c14ced71f950de1cdb6765264a2eb1100cc5" dependencies = [ "lexical", "ryu-js", @@ -3119,9 +3136,9 @@ dependencies = [ [[package]] name = "json-syntax" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9043ed89d8285e64843df5e12696d5d14f1efc0642bdde62852239917fa7e1f" +checksum = "9f2f4557e0fe320cc102bdebf9fa9471b8513e13bb34b5fc23d7e270c5f9b1cc" dependencies = [ "contextual", "decoded-char", @@ -3220,7 +3237,7 @@ dependencies = [ "serde_json", "ssi", "thiserror", - "time 0.3.23", + "time", ] [[package]] @@ -3264,7 +3281,7 @@ dependencies = [ "serde_json", "serde_with 1.14.0", "thiserror", - "time 0.3.23", + "time", "tokio", "tracing", ] @@ -3281,7 +3298,7 @@ dependencies = [ "serde", "serde_json", "serde_with 1.14.0", - "time 0.3.23", + "time", "wasm-bindgen", "wasm-bindgen-futures", ] @@ -3540,9 +3557,9 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libp2p" -version = "0.52.1" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38039ba2df4f3255842050845daef4a004cc1f26da03dbc645535088b51910ef" +checksum = "32d07d1502a027366d55afe187621c2d7895dc111a3df13b35fed698049681d7" dependencies = [ "bytes", "futures", @@ -3572,9 +3589,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d45dd90e8f0e1fa59e85ff5316dd4d1ac41a9a507e79cda1b0e9b7be43ad1a56" +checksum = "2f5107ad45cb20b2f6c3628c7b6014b996fcb13a88053f4569c872c6e30abf58" dependencies = [ "libp2p-core", "libp2p-identity", @@ -3596,7 +3613,7 @@ dependencies = [ "libp2p-identity", "log", "multiaddr", - "multihash 0.19.0", + "multihash 0.19.1", "multistream-select", "once_cell", "parking_lot 0.12.1", @@ -3612,14 +3629,14 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2874d9c6575f1d7a151022af5c42bb0ffdcdfbafe0a6fd039de870b384835a2" +checksum = "686e73aff5e23efbb99bc85340ea6fd8686986aa7b283a881ba182cfca535ca9" dependencies = [ "bs58 0.5.0", - "ed25519-dalek 1.0.1", + "ed25519-dalek 2.0.0", "log", - "multihash 0.19.0", + "multihash 0.19.1", "quick-protobuf", "rand 0.8.5", "sha2 0.10.7", @@ -3629,9 +3646,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.1" +version = "0.43.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de15b2097fc3bde063df8c202803538ff467fedb18f01c13bc5da55913d246c" +checksum = "28016944851bd73526d3c146aabf0fa9bbe27c558f080f9e5447da3a1772c01a" dependencies = [ "either", "fnv", @@ -3673,9 +3690,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "lock_api" @@ -3689,9 +3706,9 @@ dependencies = [ [[package]] name = "locspan" -version = "0.7.13" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685e26b5a3e4266c351baf3c00793a097e40f4293270ac508b3f4cbc41e72e54" +checksum = "6eb541fabac50f90782ec4fafa7b0b3961adc0d1862c7c7a863dc94ed5541d73" dependencies = [ "contextual", "hashbrown 0.13.2", @@ -3711,9 +3728,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ "value-bag", ] @@ -3753,9 +3770,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "mime" @@ -3826,7 +3843,7 @@ dependencies = [ "data-encoding", "libp2p-identity", "multibase 0.9.1", - "multihash 0.19.0", + "multihash 0.19.1", "percent-encoding", "serde", "static_assertions", @@ -3891,7 +3908,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" dependencies = [ - "blake2b_simd 1.0.1", + "blake2b_simd 1.0.2", "blake2s_simd", "blake3", "core2", @@ -3906,9 +3923,9 @@ dependencies = [ [[package]] name = "multihash" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd59dcc2bbe70baabeac52cd22ae52c55eefe6c38ff11a9439f16a350a939f2" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" dependencies = [ "core2", "unsigned-varint", @@ -3982,9 +3999,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -4020,6 +4037,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.32", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -4043,9 +4071,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm", @@ -4083,9 +4111,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -4110,11 +4138,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if", "foreign-types", "libc", @@ -4131,7 +4159,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -4142,18 +4170,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.26.0+1.1.1u" +version = "300.1.3+3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37" +checksum = "cd2c101a165fff9935e34def4669595ab1c7847943c42be86e21503e482be107" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -4279,7 +4307,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", @@ -4291,7 +4319,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" dependencies = [ - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", @@ -4348,7 +4376,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -4391,7 +4419,7 @@ checksum = "61a386cd715229d399604b50d1361683fe687066f42d56f54be995bc6868f71c" dependencies = [ "inlinable_string", "pear_codegen", - "yansi 1.0.0-rc", + "yansi 1.0.0-rc.1", ] [[package]] @@ -4403,7 +4431,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -4438,12 +4466,12 @@ checksum = "b687ff7b5da449d39e418ad391e5e08da53ec334903ddbb921db208908fc372c" [[package]] name = "pgp" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a79d6411154d1a9908e7a2c4bac60a5742f6125823c2c30780c7039aef02f0" +checksum = "27e1f8e085bfa9b85763fe3ddaacbe90a09cd847b3833129153a6cb063bbe132" dependencies = [ "aes", - "base64 0.21.2", + "base64 0.21.4", "bitfield", "block-padding 0.3.3", "blowfish", @@ -4456,10 +4484,11 @@ dependencies = [ "chrono", "cipher", "crc24", + "curve25519-dalek 4.1.0", "derive_builder 0.12.0", "des", "digest 0.10.7", - "ed25519-dalek 2.0.0-rc.3", + "ed25519-dalek 2.0.0", "elliptic-curve 0.13.5", "flate2", "generic-array 0.14.7", @@ -4469,13 +4498,13 @@ dependencies = [ "md-5", "nom", "num-bigint-dig", - "num-derive", + "num-derive 0.4.0", "num-traits", "p256 0.13.2", "p384", "rand 0.8.5", "ripemd", - "rsa 0.9.0-pre.2", + "rsa 0.9.2", "sha1", "sha2 0.10.7", "sha3", @@ -4489,29 +4518,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -4536,7 +4565,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ - "der 0.7.7", + "der 0.7.8", "pkcs8 0.10.2", "spki 0.7.2", ] @@ -4568,7 +4597,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.7", + "der 0.7.8", "spki 0.7.2", ] @@ -4580,9 +4609,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" -version = "3.0.2" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "polling" @@ -4694,9 +4723,9 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", "version_check", - "yansi 1.0.0-rc", + "yansi 1.0.0-rc.1", ] [[package]] @@ -4766,9 +4795,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -4900,34 +4929,34 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1641819477c319ef452a075ac34a4be92eb9ba09f6841f62d594d50fdcf0bf6b" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bf53dad9b6086826722cdc99140793afd9f62faa14a1ad07eb4f955e7a7216" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] name = "regex" -version = "1.9.1" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.3", - "regex-syntax 0.7.4", + "regex-automata 0.3.8", + "regex-syntax 0.7.5", ] [[package]] @@ -4941,13 +4970,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.5", ] [[package]] @@ -4958,9 +4987,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rend" @@ -4973,11 +5002,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -4996,7 +5025,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.5", + "rustls 0.21.7", "rustls-pemfile", "serde", "serde_json", @@ -5010,7 +5039,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.25.2", "winreg", ] @@ -5128,7 +5157,7 @@ dependencies = [ "serde_json", "state", "tempfile", - "time 0.3.23", + "time", "tokio", "tokio-stream", "tokio-util", @@ -5149,7 +5178,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.26", + "syn 2.0.32", "unicode-xid", ] @@ -5175,7 +5204,7 @@ dependencies = [ "smallvec", "stable-pattern", "state", - "time 0.3.23", + "time", "tokio", "uncased", ] @@ -5202,12 +5231,12 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.0-pre.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65db0998ad35adcaca498b7358992e088ee16cc783fe6fb899da203e113a63e5" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" dependencies = [ "byteorder", - "const-oid 0.9.4", + "const-oid 0.9.5", "digest 0.10.7", "num-bigint-dig", "num-integer", @@ -5217,20 +5246,19 @@ dependencies = [ "pkcs8 0.10.2", "rand_core 0.6.4", "signature 2.1.0", + "spki 0.7.2", "subtle", "zeroize", ] [[package]] name = "rust_decimal" -version = "1.30.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0446843641c69436765a35a5a77088e28c2e6a12da93e84aa3ab1cd4aa5a042" +checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" dependencies = [ "arrayvec 0.7.4", "borsh", - "bytecheck", - "byteorder", "bytes", "num-traits", "rand 0.8.5", @@ -5284,14 +5312,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys 0.4.7", "windows-sys 0.48.0", ] @@ -5310,21 +5338,21 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ "log", "ring", "sct 0.7.0", - "webpki 0.22.0", + "webpki 0.22.1", ] [[package]] name = "rustls" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -5350,14 +5378,14 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", ] [[package]] name = "rustls-webpki" -version = "0.101.1" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" dependencies = [ "ring", "untrusted", @@ -5467,7 +5495,7 @@ dependencies = [ "serde_json", "sqlx", "thiserror", - "time 0.3.23", + "time", "tracing", "url", "uuid", @@ -5511,7 +5539,7 @@ dependencies = [ "rust_decimal", "sea-query-derive", "serde_json", - "time 0.3.23", + "time", "uuid", ] @@ -5527,7 +5555,7 @@ dependencies = [ "sea-query", "serde_json", "sqlx", - "time 0.3.23", + "time", "uuid", ] @@ -5616,7 +5644,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", - "der 0.7.7", + "der 0.7.8", "generic-array 0.14.7", "pkcs8 0.10.2", "subtle", @@ -5625,9 +5653,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -5638,9 +5666,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -5654,9 +5682,9 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.173" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -5681,13 +5709,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.173" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -5727,9 +5755,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" dependencies = [ "itoa", "ryu", @@ -5782,7 +5810,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros 2.3.3", - "time 0.3.23", + "time", ] [[package]] @@ -5806,7 +5834,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -5945,7 +5973,7 @@ dependencies = [ "rand 0.8.5", "sha3", "thiserror", - "time 0.3.23", + "time", ] [[package]] @@ -5982,9 +6010,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -6014,6 +6042,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -6056,14 +6094,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.7", + "der 0.7.8", ] [[package]] name = "sqlformat" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ "itertools", "nom", @@ -6125,7 +6163,7 @@ dependencies = [ "rand 0.8.5", "rsa 0.6.1", "rust_decimal", - "rustls 0.20.8", + "rustls 0.20.9", "rustls-pemfile", "serde", "serde_json", @@ -6136,11 +6174,11 @@ dependencies = [ "sqlx-rt", "stringprep", "thiserror", - "time 0.3.23", + "time", "tokio-stream", "url", "uuid", - "webpki-roots", + "webpki-roots 0.22.6", "whoami", ] @@ -6190,7 +6228,7 @@ dependencies = [ [[package]] name = "ssi" version = "0.7.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "ssi-caips", "ssi-core", @@ -6211,7 +6249,7 @@ dependencies = [ [[package]] name = "ssi-caips" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "bs58 0.4.0", "ssi-jwk", @@ -6221,12 +6259,12 @@ dependencies = [ [[package]] name = "ssi-contexts" version = "0.1.5" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" [[package]] name = "ssi-core" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "serde", @@ -6236,7 +6274,7 @@ dependencies = [ [[package]] name = "ssi-crypto" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "bs58 0.4.0", "digest 0.9.0", @@ -6251,7 +6289,7 @@ dependencies = [ [[package]] name = "ssi-dids" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "anyhow", "async-trait", @@ -6277,7 +6315,7 @@ dependencies = [ [[package]] name = "ssi-json-ld" version = "0.2.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-std", "combination", @@ -6298,7 +6336,7 @@ dependencies = [ [[package]] name = "ssi-jwk" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "base64 0.12.3", "blake2b_simd 0.5.11", @@ -6309,7 +6347,7 @@ dependencies = [ "lazy_static", "multibase 0.9.1", "num-bigint", - "num-derive", + "num-derive 0.3.3", "num-traits", "p256 0.11.1", "rand 0.7.3", @@ -6326,7 +6364,7 @@ dependencies = [ [[package]] name = "ssi-jws" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "base64 0.12.3", "blake2", @@ -6347,7 +6385,7 @@ dependencies = [ [[package]] name = "ssi-jwt" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "chrono", "serde", @@ -6361,7 +6399,7 @@ dependencies = [ [[package]] name = "ssi-ldp" version = "0.3.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "bs58 0.4.0", @@ -6397,7 +6435,7 @@ dependencies = [ [[package]] name = "ssi-ssh" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "sshkeys", "ssi-jwk", @@ -6407,7 +6445,7 @@ dependencies = [ [[package]] name = "ssi-tzkey" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "bs58 0.4.0", "ed25519-dalek 1.0.1", @@ -6419,7 +6457,7 @@ dependencies = [ [[package]] name = "ssi-ucan" version = "0.2.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "base64 0.12.3", "chrono", @@ -6442,7 +6480,7 @@ dependencies = [ [[package]] name = "ssi-vc" version = "0.2.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "base64 0.12.3", @@ -6470,7 +6508,7 @@ dependencies = [ [[package]] name = "ssi-zcap-ld" version = "0.1.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#1279253f2be16fb0bdd43b387a1621e905f18afc" +source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" dependencies = [ "async-trait", "iref", @@ -6519,10 +6557,11 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stringprep" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ + "finl_unicode", "unicode-bidi", "unicode-normalization", ] @@ -6580,9 +6619,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.26" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ "proc-macro2", "quote", @@ -6609,36 +6648,35 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ - "autocfg", "cfg-if", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix 0.37.23", + "rustix 0.38.13", "windows-sys 0.48.0", ] [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -6675,21 +6713,11 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.23" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ + "deranged", "itoa", "js-sys", "serde", @@ -6705,9 +6733,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] @@ -6738,11 +6766,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", @@ -6750,7 +6777,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.3", "tokio-macros", "windows-sys 0.48.0", ] @@ -6763,7 +6790,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -6793,9 +6820,9 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls 0.20.8", + "rustls 0.20.9", "tokio", - "webpki 0.22.0", + "webpki 0.22.1", ] [[package]] @@ -6804,7 +6831,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.5", + "rustls 0.21.7", "tokio", ] @@ -6857,9 +6884,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -6878,9 +6905,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.0.0", "serde", @@ -6938,7 +6965,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] [[package]] @@ -7143,9 +7170,9 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "unsigned-varint" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" [[package]] name = "untrusted" @@ -7155,9 +7182,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -7166,9 +7193,9 @@ dependencies = [ [[package]] name = "urlencoding" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "utf8-decode" @@ -7250,12 +7277,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -7283,7 +7304,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", "wasm-bindgen-shared", ] @@ -7317,7 +7338,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7350,9 +7371,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" dependencies = [ "ring", "untrusted", @@ -7364,9 +7385,15 @@ version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ - "webpki 0.22.0", + "webpki 0.22.1", ] +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + [[package]] name = "whoami" version = "1.4.1" @@ -7405,7 +7432,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -7423,7 +7450,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -7443,17 +7470,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -7464,9 +7491,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -7476,9 +7503,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -7488,9 +7515,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -7500,9 +7527,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -7512,9 +7539,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -7524,9 +7551,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -7536,26 +7563,27 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.0" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -7575,12 +7603,13 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.1.0", "rand_core 0.6.4", + "serde", "zeroize", ] @@ -7598,9 +7627,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "yansi" -version = "1.0.0-rc" +version = "1.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee746ad3851dd3bc40e4a028ab3b00b99278d929e48957bcb2d111874a7e43e" +checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" [[package]] name = "zeroize" @@ -7619,5 +7648,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.32", ] diff --git a/src/auth_guards.rs b/src/auth_guards.rs index a500751d..8a42f782 100644 --- a/src/auth_guards.rs +++ b/src/auth_guards.rs @@ -1,14 +1,6 @@ use anyhow::Result; -use kepler_core::{ - types::Metadata, - util::{Capability, DelegationInfo}, - InvocationOutcome, -}; -use kepler_lib::{ - authorization::{EncodingError, HeaderEncode}, - libipld::cid::Cid, - resource::OrbitId, -}; +use kepler_core::{types::Metadata, InvocationOutcome}; +use kepler_lib::{authorization::Delegation, resource::OrbitId}; use rocket::{ data::{Capped, FromData}, futures::io::AsyncRead, @@ -19,7 +11,6 @@ use rocket::{ serde::json::Json, Data, }; -use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, HashMap}; use tokio_util::compat::FuturesAsyncReadCompatExt; use tracing::{info_span, Instrument}; @@ -88,13 +79,8 @@ where InvocationOutcome::OpenSessions(sessions) => Json( sessions .into_iter() - .map(|(hash, del)| { - Ok(( - hash.to_cid(0x55).to_string(), - CapJsonRep::from_delegation(del)?, - )) - }) - .collect::>>() + .map(|(hash, del)| Ok((hash.to_cid(0x55).to_string(), del))) + .collect::>>() .map_err(|_| Status::InternalServerError)?, ) .respond_to(request), @@ -115,27 +101,6 @@ where } } -#[derive(Serialize, Deserialize)] -pub struct CapJsonRep { - pub capabilities: Vec, - pub delegator: String, - pub delegate: String, - pub parents: Vec, - raw: String, -} - -impl CapJsonRep { - pub fn from_delegation(d: DelegationInfo) -> Result { - Ok(Self { - capabilities: d.capabilities, - delegator: d.delegator, - delegate: d.delegate, - parents: d.parents, - raw: d.delegation.encode()?, - }) - } -} - pub struct ObjectHeaders(pub Metadata); #[async_trait] diff --git a/src/authorization.rs b/src/authorization.rs index 4caaf330..3058fdc2 100644 --- a/src/authorization.rs +++ b/src/authorization.rs @@ -1,26 +1,22 @@ -use kepler_core::{ - events::{FromReqErr, SerializedEvent}, - util::{DelegationInfo, InvocationInfo, RevocationInfo}, -}; -use kepler_lib::authorization::{KeplerDelegation, KeplerInvocation, KeplerRevocation}; +use kepler_core::events::SerializedEvent; +use kepler_lib::authorization::{Delegation, EncodingError, Revocation}; use rocket::{ http::Status, request::{FromRequest, Outcome, Request}, }; -use std::convert::TryFrom; pub struct AuthHeaderGetter(pub SerializedEvent); macro_rules! impl_fromreq { - ($type:ident, $inter:ident, $name:tt) => { + ($type:ident, $name:tt) => { #[rocket::async_trait] impl<'r> FromRequest<'r> for AuthHeaderGetter<$type> { - type Error = FromReqErr<<$type as TryFrom<$inter>>::Error>; + type Error = EncodingError; async fn from_request(request: &'r Request<'_>) -> Outcome { match request .headers() .get_one($name) - .map(SerializedEvent::<$type>::from_header_ser::<$inter>) + .map(SerializedEvent::<$type>::from_header_ser) { Some(Ok(e)) => Outcome::Success(AuthHeaderGetter(e)), Some(Err(e)) => Outcome::Failure((Status::Unauthorized, e)), @@ -31,9 +27,10 @@ macro_rules! impl_fromreq { }; } -impl_fromreq!(DelegationInfo, KeplerDelegation, "Authorization"); -impl_fromreq!(InvocationInfo, KeplerInvocation, "Authorization"); -impl_fromreq!(RevocationInfo, KeplerRevocation, "Authorization"); +impl_fromreq!(Delegation, "Authorization"); +// currently delegations and invocations are really the same type +// impl_fromreq!(Invocation, "Authorization"); +impl_fromreq!(Revocation, "Authorization"); #[cfg(test)] mod test { diff --git a/src/lib.rs b/src/lib.rs index a348b350..1294d13b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,6 +36,7 @@ pub type Block = OBlock; pub type BlockStores = Either; pub type BlockConfig = Either; pub type BlockStage = Either; +pub const OK_SKEW: u64 = 60; impl From for BlockConfig { fn from(c: BlockStorage) -> BlockConfig { diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 29bf536c..8233885c 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -1,3 +1,4 @@ +use crate::OK_SKEW; use anyhow::Result; use rocket::{data::ToByteUnit, http::Status, State}; use std::collections::HashMap; @@ -14,11 +15,13 @@ use crate::{ use kepler_core::{ sea_orm::DbErr, storage::{ImmutableReadStore, ImmutableStaging}, - types::Resource, - util::{DelegationInfo, InvocationInfo}, TxError, TxStoreError, }; - +use kepler_lib::{ + authorization::{Delegation, Invocation, Resources}, + resource::ResourceId, + ssi::ucan::capabilities::ability::Ability, +}; pub mod util; use util::LimitedReader; @@ -60,7 +63,7 @@ pub async fn open_host_key( #[post("/delegate")] pub async fn delegate( - d: AuthHeaderGetter, + d: AuthHeaderGetter, req_span: TracingSpan, kepler: &State, ) -> Result { @@ -72,7 +75,7 @@ pub async fn delegate( .with_label_values(&["delegate"]) .start_timer(); let res = kepler - .delegate(d.0) + .delegate::(d.0) .await .map_err(|e| { ( @@ -100,7 +103,7 @@ pub async fn delegate( #[post("/invoke", data = "")] pub async fn invoke( - i: AuthHeaderGetter, + i: AuthHeaderGetter, req_span: TracingSpan, headers: ObjectHeaders, data: DataIn<'_>, @@ -116,29 +119,27 @@ pub async fn invoke( .with_label_values(&["invoke"]) .start_timer(); - let mut put_iter = - i.0 .0 - .capabilities - .iter() - .filter_map(|c| match (&c.resource, c.action.as_str()) { - (Resource::Kepler(r), "put") if r.service() == Some("kv") => { - r.path().map(|p| (r.orbit(), p)) - } - _ => None, - }); + let d = Ability::new("kv/put").unwrap(); + let mut put_iter = Resources::<'_, ResourceId, _>::grants(&i.0 .0).filter_map(|(r, a)| { + let (o, s, p, _) = r.into_inner(); + match (s.as_deref(), p, a.contains_key(&d)) { + (Some("kv"), Some(p), true) => Some((o, p)), + _ => None, + } + }); let inputs = match (data, put_iter.next(), put_iter.next()) { (DataIn::None | DataIn::One(_), None, _) => HashMap::new(), (DataIn::One(d), Some((orbit, path)), None) => { let mut stage = staging - .stage(orbit) + .stage(&orbit) .await .map_err(|e| (Status::InternalServerError, e.to_string()))?; let open_data = d.open(1u8.gigabytes()).compat(); if let Some(limit) = config.storage.limit { let current_size = kepler - .store_size(orbit) + .store_size(&orbit) .await .map_err(|e| (Status::InternalServerError, e.to_string()))? .ok_or_else(|| (Status::NotFound, "orbit not found".to_string()))?; @@ -179,7 +180,7 @@ pub async fn invoke( } }; let res = kepler - .invoke::(i.0, inputs) + .invoke::(i.0, inputs) .await .map( |(_, mut outcomes)| match (outcomes.pop(), outcomes.pop(), outcomes.drain(..)) { From a19405fed8da7410a79c76d195a64ecc62f45b9d Mon Sep 17 00:00:00 2001 From: chunningham Date: Tue, 12 Sep 2023 06:45:16 +0200 Subject: [PATCH 11/24] use 'once' iter --- kepler-core/src/models/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index 54585669..e00008d7 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -21,7 +21,10 @@ use kepler_lib::{ ssi::ucan::capabilities::{Ability, NotaBeneCollection}, }; use sea_orm::entity::prelude::*; -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::{ + collections::{BTreeMap, HashMap, HashSet}, + iter::once, +}; use time::OffsetDateTime; #[derive(Debug, thiserror::Error)] @@ -105,14 +108,14 @@ async fn validate<'a, C: ConnectionTrait>( // dependant caps and parents, check parents (Some(rf), Some(prf)) if !prf.is_empty() => { let mut unauthorized = take_unauthorized( - [rf].into_iter().chain(required), + once(rf).chain(required), // get all known parents of `message` get_granted(db, message, parent_check).await?, ) .map(|(r, a)| (r.into(), a.into_iter().cloned().collect())); match unauthorized.next() { Some(uf) => Err(ValidationError::UnauthorizedCapability( - [uf].into_iter().chain(unauthorized).collect(), + once(uf).chain(unauthorized).collect(), ) .into()), _ => Ok(()), From a069707c3d486ada36098b35af56e0c030f52f91 Mon Sep 17 00:00:00 2001 From: chunningham Date: Wed, 20 Sep 2023 00:52:46 +0200 Subject: [PATCH 12/24] update dependancies, avoid webauthn in this branch --- Cargo.lock | 823 +++++++++++++++------------------- kepler-core/Cargo.toml | 8 +- kepler-core/src/db.rs | 2 +- kepler-core/src/models/mod.rs | 4 +- lib/Cargo.toml | 18 +- lib/src/authorization.rs | 15 +- src/routes/mod.rs | 4 +- 7 files changed, 384 insertions(+), 490 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46872448..fc9e9f54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" - [[package]] name = "addr2line" version = "0.21.0" @@ -52,15 +46,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0" dependencies = [ "memchr", ] @@ -195,24 +190,6 @@ dependencies = [ "event-listener", ] -[[package]] -name = "async-process" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" -dependencies = [ - "async-io", - "async-lock", - "autocfg", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix 0.37.23", - "signal-hook", - "windows-sys 0.48.0", -] - [[package]] name = "async-std" version = "1.12.0" @@ -224,7 +201,6 @@ dependencies = [ "async-global-executor", "async-io", "async-lock", - "async-process", "crossbeam-utils", "futures-channel", "futures-core", @@ -260,7 +236,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -277,14 +253,14 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] name = "atoi" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ "num-traits", ] @@ -671,19 +647,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "bae" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b8de67cc41132507eeece2584804efcb15f85ba516e34c944b7667f480397a" -dependencies = [ - "heck 0.3.3", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "base-x" version = "0.2.11" @@ -772,6 +735,9 @@ name = "bitflags" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -1010,9 +976,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-tools" @@ -1067,7 +1033,7 @@ dependencies = [ [[package]] name = "cacaos" version = "0.5.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/webauthn#ec7517b3c07403def693f8a6c9f458223310117a" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#e0aa87713900ea5d29fb50b880148e2c55c7ec20" dependencies = [ "async-trait", "hex", @@ -1173,9 +1139,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1186,33 +1152,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "ciborium" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" -dependencies = [ - "ciborium-io", - "ciborium-ll", - "serde", -] - -[[package]] -name = "ciborium-io" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" - -[[package]] -name = "ciborium-ll" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" -dependencies = [ - "ciborium-io", - "half", -] - [[package]] name = "cid" version = "0.8.6" @@ -1352,24 +1291,29 @@ dependencies = [ ] [[package]] -name = "coset" -version = "0.3.4" +name = "cpufeatures" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c765a4e852cef25c69a48e9fcd60995a7fecabf0134a0021e7181452c4a60f95" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ - "ciborium", - "ciborium-io", + "libc", ] [[package]] -name = "cpufeatures" -version = "0.2.9" +name = "crc" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ - "libc", + "crc-catalog", ] +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + [[package]] name = "crc24" version = "0.1.6" @@ -1520,7 +1464,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -1616,7 +1560,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -1660,7 +1604,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -1842,13 +1786,13 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] name = "did-ethr" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "chrono", @@ -1864,7 +1808,7 @@ dependencies = [ [[package]] name = "did-method-key" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "multibase 0.8.0", @@ -1879,7 +1823,7 @@ dependencies = [ [[package]] name = "did-onion" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "http", @@ -1892,7 +1836,7 @@ dependencies = [ [[package]] name = "did-pkh" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "bech32 0.8.1", @@ -1911,7 +1855,7 @@ dependencies = [ [[package]] name = "did-tz" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "anyhow", "async-trait", @@ -1931,7 +1875,7 @@ dependencies = [ [[package]] name = "did-web" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "http", @@ -1943,7 +1887,7 @@ dependencies = [ [[package]] name = "did-webkey" version = "0.2.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "anyhow", "async-trait", @@ -1989,26 +1933,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dotenvy" version = "0.15.7" @@ -2093,6 +2017,9 @@ name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +dependencies = [ + "serde", +] [[package]] name = "elliptic-curve" @@ -2171,6 +2098,17 @@ dependencies = [ "libc", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -2362,13 +2300,13 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.11.2", + "parking_lot", ] [[package]] @@ -2400,18 +2338,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", -] - -[[package]] -name = "futures-rustls" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" -dependencies = [ - "futures-io", - "rustls 0.20.9", - "webpki 0.22.1", + "syn 2.0.37", ] [[package]] @@ -2586,12 +2513,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "half" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" - [[package]] name = "hashbrown" version = "0.11.2" @@ -2659,15 +2580,6 @@ dependencies = [ "http", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.1" @@ -2679,9 +2591,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -2707,6 +2619,15 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "http" version = "0.2.9" @@ -2779,7 +2700,7 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls 0.22.0", - "webpki 0.21.4", + "webpki", ] [[package]] @@ -2878,6 +2799,17 @@ dependencies = [ "hashbrown 0.14.0", ] +[[package]] +name = "inherent" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce243b1bfa62ffc028f1cc3b6034ec63d649f3031bc8a4fbbb004e1ac17d1f68" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "inlinable_string" version = "0.1.15" @@ -3258,7 +3190,7 @@ dependencies = [ "lazy_static", "libipld 0.16.0", "serde", - "serde_ipld_dagcbor 0.4.1", + "serde_ipld_dagcbor 0.4.2", "serde_json", "serde_with 1.14.0", "siwe-recap 0.2.0", @@ -3402,9 +3334,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libipld" @@ -3421,7 +3353,7 @@ dependencies = [ "libipld-macro 0.14.0", "log", "multihash 0.16.3", - "parking_lot 0.12.1", + "parking_lot", "thiserror", ] @@ -3616,7 +3548,7 @@ dependencies = [ "multihash 0.19.1", "multistream-select", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "pin-project", "quick-protobuf", "rand 0.8.5", @@ -3667,9 +3599,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" dependencies = [ "cc", "pkg-config", @@ -3876,7 +3808,7 @@ dependencies = [ [[package]] name = "multidid" version = "0.1.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/webauthn#ec7517b3c07403def693f8a6c9f458223310117a" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#e0aa87713900ea5d29fb50b880148e2c55c7ec20" dependencies = [ "bech32 0.9.1", "bs58 0.5.0", @@ -4045,7 +3977,7 @@ checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -4159,7 +4091,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -4170,9 +4102,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.3+3.1.2" +version = "300.1.5+3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd2c101a165fff9935e34def4669595ab1c7847943c42be86e21503e482be107" +checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" dependencies = [ "cc", ] @@ -4261,27 +4193,37 @@ dependencies = [ "num-traits", ] +[[package]] +name = "ordered-float" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a54938017eacd63036332b4ae5c8a49fc8c0c1d6d629893057e4f13609edd06" +dependencies = [ + "num-traits", +] + [[package]] name = "ouroboros" -version = "0.15.6" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" +checksum = "e2ba07320d39dfea882faa70554b4bd342a5f273ed59ba7c1c6b4c840492c954" dependencies = [ "aliasable", "ouroboros_macro", + "static_assertions", ] [[package]] name = "ouroboros_macro" -version = "0.15.6" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7" +checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" dependencies = [ - "Inflector", + "heck", "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.37", ] [[package]] @@ -4331,17 +4273,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -4349,21 +4280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -4374,28 +4291,11 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", "windows-targets 0.48.5", ] -[[package]] -name = "passkey-types" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d50824f04736455af2ce22124c2a621475f1f1b1f261c05dc0f0730aea87e2" -dependencies = [ - "bitflags 1.3.2", - "ciborium", - "coset", - "data-encoding", - "rand 0.8.5", - "serde", - "sha2 0.10.7", - "strum", - "typeshare", -] - [[package]] name = "paste" version = "1.0.14" @@ -4431,7 +4331,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -4533,7 +4433,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -4708,9 +4608,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] @@ -4723,7 +4623,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", "version_check", "yansi 1.0.0-rc.1", ] @@ -4752,7 +4652,7 @@ dependencies = [ "lazy_static", "libc", "memchr", - "parking_lot 0.12.1", + "parking_lot", "procfs", "protobuf", "thiserror", @@ -4898,15 +4798,6 @@ dependencies = [ "locspan-derive", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -4916,17 +4807,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", - "thiserror", -] - [[package]] name = "ref-cast" version = "1.0.20" @@ -4944,7 +4824,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -5147,7 +5027,7 @@ dependencies = [ "memchr", "multer", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "rand 0.8.5", "ref-cast", @@ -5178,7 +5058,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.32", + "syn 2.0.37", "unicode-xid", ] @@ -5333,19 +5213,7 @@ dependencies = [ "log", "ring", "sct 0.6.1", - "webpki 0.21.4", -] - -[[package]] -name = "rustls" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" -dependencies = [ - "log", - "ring", - "sct 0.7.0", - "webpki 0.22.1", + "webpki", ] [[package]] @@ -5383,9 +5251,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" dependencies = [ "ring", "untrusted", @@ -5473,11 +5341,24 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sea-bae" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd3534a9978d0aa7edd2808dc1f8f31c4d0ecd31ddf71d997b3c98e9f3c9114" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "sea-orm" -version = "0.11.3" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fade86e8d41fd1a4721f84cb834f4ca2783f973cc30e6212b7fafc134f169214" +checksum = "61f6c7daef05dde3476d97001e11fca7a52b655aa3bf4fd610ab2da1176a2ed5" dependencies = [ "async-stream", "async-trait", @@ -5490,10 +5371,10 @@ dependencies = [ "sea-orm-macros", "sea-query", "sea-query-binder", - "sea-strum", "serde", "serde_json", "sqlx", + "strum", "thiserror", "time", "tracing", @@ -5503,22 +5384,23 @@ dependencies = [ [[package]] name = "sea-orm-macros" -version = "0.11.3" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28936f26d62234ff0be16f80115dbdeb3237fe9c25cf18fbcd1e3b3592360f20" +checksum = "cd90e73d5f5b184bad525767da29fbfec132b4e62ebd6f60d2f2737ec6468f62" dependencies = [ - "bae", - "heck 0.3.3", + "heck", "proc-macro2", "quote", - "syn 1.0.109", + "sea-bae", + "syn 2.0.37", + "unicode-ident", ] [[package]] name = "sea-orm-migration" -version = "0.11.3" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278d3adfd0832b6ffc17d3cfbc574d3695a5c1b38814e0bc8ac238d33f3d87cf" +checksum = "21f673fcefb3a7e7b89a12b6c0e854ec0be14367635ac3435369c8ad7f11e09e" dependencies = [ "async-trait", "futures", @@ -5530,12 +5412,15 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.28.5" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbab99b8cd878ab7786157b7eb8df96333a6807cc6e45e8888c85b51534b401a" +checksum = "28c05a5bf6403834be253489bbe95fa9b1e5486bc843b61f60d26b5c9c1e244b" dependencies = [ "bigdecimal", "chrono", + "derivative", + "inherent", + "ordered-float 3.9.1", "rust_decimal", "sea-query-derive", "serde_json", @@ -5545,9 +5430,9 @@ dependencies = [ [[package]] name = "sea-query-binder" -version = "0.3.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cea85029985b40dfbf18318d85fe985c04db7c1b4e5e8e0a0a0cdff5f1e30f9" +checksum = "36bbb68df92e820e4d5aeb17b4acd5cc8b5d18b2c36a4dd6f4626aabfa7ab1b9" dependencies = [ "bigdecimal", "chrono", @@ -5561,11 +5446,11 @@ dependencies = [ [[package]] name = "sea-query-derive" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f62030c60f3a691f5fe251713b4e220b306e50a71e1d6f9cce1f24bb781978" +checksum = "bd78f2e0ee8e537e9195d1049b752e0433e2cac125426bccb7b5c3e508096117" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "syn 1.0.109", @@ -5574,9 +5459,9 @@ dependencies = [ [[package]] name = "sea-schema" -version = "0.11.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb2940bb5a10bc6cd05b450ce6cd3993e27fddd7eface2becb97fc5af3a040e" +checksum = "0cd9561232bd1b82ea748b581f15909d11de0db6563ddcf28c5d908aee8282f1" dependencies = [ "futures", "sea-query", @@ -5585,35 +5470,13 @@ dependencies = [ [[package]] name = "sea-schema-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56821b7076f5096b8f726e2791ad255a99c82498e08ec477a65a96c461ff1927" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "sea-strum" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391d06a6007842cfe79ac6f7f53911b76dfd69fc9a6769f1cf6569d12ce20e1b" -dependencies = [ - "sea-strum_macros", -] - -[[package]] -name = "sea-strum_macros" -version = "0.23.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b4397b825df6ccf1e98bcdabef3bbcfc47ff5853983467850eeab878384f21" +checksum = "c6f686050f76bffc4f635cda8aea6df5548666b830b52387e8bc7de11056d11e" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro2", "quote", - "rustversion", "syn 1.0.109", ] @@ -5715,7 +5578,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -5732,9 +5595,9 @@ dependencies = [ [[package]] name = "serde_ipld_dagcbor" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74e4c1e1617be5feb2f03f629f8097f76b51373785a83a875453c2b04c880f4e" +checksum = "8e880e0b1f9c7a8db874642c1217f7e19b29e325f24ab9f0fcb11818adec7f01" dependencies = [ "cbor4ii", "cid 0.10.1", @@ -5755,9 +5618,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -5834,7 +5697,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -5903,16 +5766,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -6044,9 +5897,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -6110,108 +5963,222 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" +checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" dependencies = [ "sqlx-core", "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", ] [[package]] name = "sqlx-core" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" +checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.3", + "async-io", + "async-std", "atoi", - "base64 0.13.1", "bigdecimal", - "bitflags 1.3.2", "byteorder", "bytes", "chrono", + "crc", "crossbeam-queue", - "digest 0.10.7", - "dirs", "dotenvy", "either", "event-listener", - "flume", "futures-channel", "futures-core", - "futures-executor", "futures-intrusive", + "futures-io", "futures-util", - "generic-array 0.14.7", "hashlink", "hex", - "hkdf", - "hmac", - "indexmap 1.9.3", - "itoa", - "libc", - "libsqlite3-sys", + "indexmap 2.0.0", "log", - "md-5", "memchr", - "num-bigint", "once_cell", "paste", "percent-encoding", - "rand 0.8.5", - "rsa 0.6.1", "rust_decimal", - "rustls 0.20.9", + "rustls 0.21.7", "rustls-pemfile", "serde", "serde_json", - "sha1", "sha2 0.10.7", "smallvec", "sqlformat", - "sqlx-rt", - "stringprep", "thiserror", "time", + "tokio", "tokio-stream", + "tracing", "url", "uuid", - "webpki-roots 0.22.6", - "whoami", + "webpki-roots 0.24.0", ] [[package]] name = "sqlx-macros" -version = "0.6.3" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" +checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc" dependencies = [ + "async-std", "dotenvy", "either", - "heck 0.4.1", + "heck", + "hex", "once_cell", "proc-macro2", "quote", + "serde", "serde_json", + "sha2 0.10.7", "sqlx-core", - "sqlx-rt", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", "syn 1.0.109", + "tempfile", + "tokio", "url", ] [[package]] -name = "sqlx-rt" -version = "0.6.3" +name = "sqlx-mysql" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" +checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482" dependencies = [ - "async-std", - "futures-rustls", + "atoi", + "base64 0.21.4", + "bigdecimal", + "bitflags 2.4.0", + "byteorder", + "bytes", + "chrono", + "crc", + "digest 0.10.7", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array 0.14.7", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", "once_cell", - "tokio", - "tokio-rustls 0.23.4", + "percent-encoding", + "rand 0.8.5", + "rsa 0.9.2", + "rust_decimal", + "serde", + "sha1", + "sha2 0.10.7", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "time", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e" +dependencies = [ + "atoi", + "base64 0.21.4", + "bigdecimal", + "bitflags 2.4.0", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "num-bigint", + "once_cell", + "rand 0.8.5", + "rust_decimal", + "serde", + "serde_json", + "sha1", + "sha2 0.10.7", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "time", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" +dependencies = [ + "atoi", + "chrono", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "time", + "tracing", + "url", + "uuid", ] [[package]] @@ -6228,7 +6195,7 @@ dependencies = [ [[package]] name = "ssi" version = "0.7.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "ssi-caips", "ssi-core", @@ -6249,7 +6216,7 @@ dependencies = [ [[package]] name = "ssi-caips" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "bs58 0.4.0", "ssi-jwk", @@ -6259,12 +6226,12 @@ dependencies = [ [[package]] name = "ssi-contexts" version = "0.1.5" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" [[package]] name = "ssi-core" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "serde", @@ -6274,7 +6241,7 @@ dependencies = [ [[package]] name = "ssi-crypto" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "bs58 0.4.0", "digest 0.9.0", @@ -6289,7 +6256,7 @@ dependencies = [ [[package]] name = "ssi-dids" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "anyhow", "async-trait", @@ -6315,7 +6282,7 @@ dependencies = [ [[package]] name = "ssi-json-ld" version = "0.2.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-std", "combination", @@ -6336,7 +6303,7 @@ dependencies = [ [[package]] name = "ssi-jwk" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "base64 0.12.3", "blake2b_simd 0.5.11", @@ -6364,7 +6331,7 @@ dependencies = [ [[package]] name = "ssi-jws" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "base64 0.12.3", "blake2", @@ -6385,7 +6352,7 @@ dependencies = [ [[package]] name = "ssi-jwt" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "chrono", "serde", @@ -6399,7 +6366,7 @@ dependencies = [ [[package]] name = "ssi-ldp" version = "0.3.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "bs58 0.4.0", @@ -6435,7 +6402,7 @@ dependencies = [ [[package]] name = "ssi-ssh" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "sshkeys", "ssi-jwk", @@ -6445,7 +6412,7 @@ dependencies = [ [[package]] name = "ssi-tzkey" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "bs58 0.4.0", "ed25519-dalek 1.0.1", @@ -6457,30 +6424,29 @@ dependencies = [ [[package]] name = "ssi-ucan" version = "0.2.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "base64 0.12.3", "chrono", "libipld 0.16.0", "serde", + "serde_jcs", "serde_json", "serde_with 1.14.0", "ssi-caips", "ssi-core", - "ssi-crypto", "ssi-dids", "ssi-jwk", "ssi-jws", "ssi-jwt", "thiserror", "ucan-capabilities-object", - "varsig", ] [[package]] name = "ssi-vc" version = "0.2.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "base64 0.12.3", @@ -6508,7 +6474,7 @@ dependencies = [ [[package]] name = "ssi-zcap-ld" version = "0.1.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/webauthn-exp#720e395804b7bb03dffff8ab0a703792d9a9291c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" dependencies = [ "async-trait", "iref", @@ -6580,25 +6546,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.24.3" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" [[package]] name = "subtle" @@ -6619,9 +6569,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.32" +version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ "proc-macro2", "quote", @@ -6654,7 +6604,7 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand 2.0.0", - "redox_syscall 0.3.5", + "redox_syscall", "rustix 0.38.13", "windows-sys 0.48.0", ] @@ -6676,7 +6626,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -6707,7 +6657,7 @@ dependencies = [ "byteorder", "integer-encoding", "log", - "ordered-float", + "ordered-float 1.1.1", "threadpool", ] @@ -6777,7 +6727,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys 0.48.0", ] @@ -6790,7 +6740,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -6811,18 +6761,7 @@ checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls 0.19.1", "tokio", - "webpki 0.21.4", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.9", - "tokio", - "webpki 0.22.1", + "webpki", ] [[package]] @@ -6965,7 +6904,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] [[package]] @@ -7060,31 +6999,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "typeshare" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f44d1a2f454cb35fbe05b218c410792697e76bd868f48d3a418f2cd1a7d527d6" -dependencies = [ - "chrono", - "serde", - "serde_json", - "typeshare-annotation", -] - -[[package]] -name = "typeshare-annotation" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc670d0e358428857cc3b4bf504c691e572fccaec9542ff09212d3f13d74b7a9" -dependencies = [ - "quote", - "syn 1.0.109", -] +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ubyte" @@ -7137,9 +7054,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -7229,11 +7146,9 @@ checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" [[package]] name = "varsig" version = "0.1.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/webauthn#ec7517b3c07403def693f8a6c9f458223310117a" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#e0aa87713900ea5d29fb50b880148e2c55c7ec20" dependencies = [ - "passkey-types", "serde", - "serde_json", "thiserror", "unsigned-varint", ] @@ -7304,7 +7219,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", "wasm-bindgen-shared", ] @@ -7338,7 +7253,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7369,23 +7284,13 @@ dependencies = [ "untrusted", ] -[[package]] -name = "webpki" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "webpki 0.22.1", + "rustls-webpki", ] [[package]] @@ -7399,10 +7304,6 @@ name = "whoami" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" -dependencies = [ - "wasm-bindgen", - "web-sys", -] [[package]] name = "winapi" @@ -7648,5 +7549,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.37", ] diff --git a/kepler-core/Cargo.toml b/kepler-core/Cargo.toml index d79f0b70..80e95c58 100644 --- a/kepler-core/Cargo.toml +++ b/kepler-core/Cargo.toml @@ -15,19 +15,19 @@ tokio = ["sea-orm/runtime-tokio-rustls"] async-std = ["sea-orm/runtime-async-std-rustls"] [dependencies] -sea-orm = { version = "0.11", default-features = false, features = ["macros", "with-time", "with-json", "sqlx", "sea-orm-internal", "sqlx-dep"] } -sea-orm-migration = { version = "0.11", default-features = false } +sea-orm = { version = "0.12", default-features = false, features = ["macros", "with-time", "with-json", "sqlx", "sea-orm-internal", "sqlx-dep"] } +sea-orm-migration = { version = "0.12", default-features = false } futures = { default-features = false, version = "0.3", features = ["alloc", "std"] } pin-project = "1" time = "0.3" kepler-lib = { version = "0.2", path = "../lib" } libp2p = { version = "0.52.1", default-features = false, features = ["ed25519"] } thiserror = "1" -ssi = { version = "0.7", git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp" } +ssi = { version = "0.7", git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10" } serde = { version = "1", features = ["derive"] } serde_json = "1" serde_ipld_dagcbor = "0.3" [dev-dependencies] -sea-orm = { version = "0.11", features = ["runtime-async-std-rustls", "sqlx-sqlite"] } +sea-orm = { version = "0.12", features = ["runtime-async-std-rustls", "sqlx-sqlite"] } async-std = { version = "1", features = ["attributes"] } diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index b513df94..a386cad4 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -47,7 +47,7 @@ pub enum TxError { #[error("database error: {0}")] Db(#[from] DbErr), #[error(transparent)] - Ucan(#[from] ssi::ucan::Error), + Ucan(#[from] ssi::ucan::jose::VerificationError), #[error(transparent)] Cacao(#[from] kepler_lib::cacaos::v2::common::Error), #[error(transparent)] diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index e00008d7..09529ff2 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -96,10 +96,10 @@ async fn verify(cacao: &CommonCacao) -> Result<(), ValidationError> { } // verify parenthood and authorization -async fn validate<'a, C: ConnectionTrait>( +async fn validate<'a, C: ConnectionTrait, T: Fn(&delegation::Model) -> bool>( db: &C, message: &'a CommonCacao, - parent_check: Option bool>, + parent_check: Option, ) -> Result<(), EventProcessingError> { let mut required = get_required(message); match (required.next(), message.proof()) { diff --git a/lib/Cargo.toml b/lib/Cargo.toml index f102d24a..6d782b21 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,16 +12,16 @@ serde_json = "1.0" serde_with = "1.0" thiserror = "1" base64 = "0.13" -cacaos = { git = "https://github.com/spruceid/cacao-rs", branch = "feat/webauthn" } +cacaos = { git = "https://github.com/spruceid/cacao-rs", branch = "feat/cacao-v2" } siwe-recap = "0.2.0" lazy_static = "1.4" -did-method-key = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } -did-tz = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } -did-ethr = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } -did-pkh = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", version = "0.2" } -did-web = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } -did-webkey = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } -did-onion = { git = "https://github.com/spruceid/ssi", branch = "feat/webauthn-exp", default-features = false, version = "0.2" } +did-method-key = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } +did-tz = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } +did-ethr = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } +did-pkh = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", version = "0.2" } +did-web = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } +did-webkey = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } +did-onion = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } serde_ipld_dagcbor = "0.4" [target.'cfg(target_arch = "wasm32")'.dependencies] @@ -32,7 +32,7 @@ uuid = { version = "1", features = ["v4"] } [dependencies.ssi] git = "https://github.com/spruceid/ssi" -branch = "feat/webauthn-exp" +branch = "feat/ucan-0.10" version = "0.7" default-features = false features = ["ed25519", "rsa", "secp256k1"] diff --git a/lib/src/authorization.rs b/lib/src/authorization.rs index 7e52cd36..12566866 100644 --- a/lib/src/authorization.rs +++ b/lib/src/authorization.rs @@ -1,12 +1,7 @@ use crate::resource::{AnyResource, ResourceId}; use cacaos::v2::{common::CommonCacao, varsig::either::EitherSignature, Cacao}; use iri_string::types::{UriStr, UriString}; -use ssi::ucan::{ - capabilities::*, - common::Common, - jwt::{Jwt, UcanDecode}, - Revocation as URevocation, Ucan, -}; +use ssi::ucan::{capabilities::*, jose, jwt::Jwt, Revocation as URevocation, Ucan, UcanDecode}; use std::{ collections::BTreeMap, iter::{FilterMap, Map}, @@ -45,7 +40,7 @@ impl HeaderEncode for Delegation { fn decode(s: &str) -> Result<(Self, Vec), EncodingError> { Ok(if s.contains('.') { ( - as UcanDecode>::decode(s)?.try_into()?, + >::decode(s)?.try_into()?, s.as_bytes().to_vec(), ) } else { @@ -113,9 +108,7 @@ impl<'a, NB: 'a> Resources<'a, AnyResource<&'a UriStr>, NB> for Capabilities pub fn delegation_from_bytes(b: &[u8]) -> Result { match serde_ipld_dagcbor::from_slice(b) { Ok(cacao) => Ok(cacao), - Err(_) => Ok( - as UcanDecode>::decode(&String::from_utf8_lossy(b))?.try_into()?, - ), + Err(_) => Ok(>::decode(&String::from_utf8_lossy(b))?.try_into()?), } } @@ -139,7 +132,7 @@ impl HeaderEncode for Revocation { #[derive(Debug, thiserror::Error)] pub enum EncodingError { #[error(transparent)] - UCAN(#[from] ssi::ucan::Error), + UCAN(#[from] ssi::ucan::jwt::DecodeError), #[error(transparent)] CacaoError(#[from] cacaos::v2::common::Error), #[error(transparent)] diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 8233885c..b983328a 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -81,7 +81,7 @@ pub async fn delegate( ( match e { TxError::OrbitNotFound => Status::NotFound, - TxError::Db(DbErr::ConnectionAcquire) => Status::InternalServerError, + TxError::Db(DbErr::ConnectionAcquire(_)) => Status::InternalServerError, _ => Status::Unauthorized, }, e.to_string(), @@ -198,7 +198,7 @@ pub async fn invoke( ( match e { TxStoreError::Tx(TxError::OrbitNotFound) => Status::NotFound, - TxStoreError::Tx(TxError::Db(DbErr::ConnectionAcquire)) => { + TxStoreError::Tx(TxError::Db(DbErr::ConnectionAcquire(_))) => { Status::InternalServerError } _ => Status::Unauthorized, From b8097234e5cb04bf3e5e2646c37f28b6ddc41407 Mon Sep 17 00:00:00 2001 From: chunningham Date: Wed, 20 Sep 2023 01:23:35 +0200 Subject: [PATCH 13/24] remove skew generic const --- Cargo.lock | 6 +++--- kepler-core/src/db.rs | 24 +++++++++++------------- kepler-core/src/models/delegation.rs | 10 +++++----- kepler-core/src/models/invocation.rs | 6 +++--- src/lib.rs | 1 - src/routes/mod.rs | 5 ++--- 6 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc9e9f54..228ac933 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1033,7 +1033,7 @@ dependencies = [ [[package]] name = "cacaos" version = "0.5.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#e0aa87713900ea5d29fb50b880148e2c55c7ec20" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#9464d9ebf5a7f90d6317e0dd1407d0f772678fa0" dependencies = [ "async-trait", "hex", @@ -3808,7 +3808,7 @@ dependencies = [ [[package]] name = "multidid" version = "0.1.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#e0aa87713900ea5d29fb50b880148e2c55c7ec20" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#9464d9ebf5a7f90d6317e0dd1407d0f772678fa0" dependencies = [ "bech32 0.9.1", "bs58 0.5.0", @@ -7146,7 +7146,7 @@ checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" [[package]] name = "varsig" version = "0.1.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#e0aa87713900ea5d29fb50b880148e2c55c7ec20" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#9464d9ebf5a7f90d6317e0dd1407d0f772678fa0" dependencies = [ "serde", "thiserror", diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index a386cad4..a189985a 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -167,7 +167,7 @@ where B: StorageSetup, K: Secrets, { - async fn transact( + async fn transact( &self, events: Vec, ) -> Result, TxError> { @@ -176,30 +176,30 @@ where .begin_with_config(Some(sea_orm::IsolationLevel::ReadUncommitted), None) .await?; - let commit = transact::(&tx, &self.storage, &self.secrets, events).await?; + let commit = transact(&tx, &self.storage, &self.secrets, events).await?; tx.commit().await?; Ok(commit) } - pub async fn delegate( + pub async fn delegate( &self, delegation: SDelegation, ) -> Result, TxError> { - self.transact::(vec![Event::Delegation(Box::new(delegation))]) + self.transact(vec![Event::Delegation(Box::new(delegation))]) .await } - pub async fn revoke( + pub async fn revoke( &self, revocation: SRevocation, ) -> Result, TxError> { - self.transact::(vec![Event::Revocation(Box::new(revocation))]) + self.transact(vec![Event::Revocation(Box::new(revocation))]) .await } - pub async fn invoke( + pub async fn invoke( &self, invocation: SInvocation, mut inputs: InvocationInputs, @@ -266,7 +266,7 @@ where .begin_with_config(Some(sea_orm::IsolationLevel::ReadUncommitted), None) .await?; // verify and commit invocation and kv operations - let commit = transact::( + let commit = transact( &tx, &self.storage, &self.secrets, @@ -407,7 +407,7 @@ async fn event_orbits<'a, C: ConnectionTrait>( Ok(orbits) } -pub(crate) async fn transact( +pub(crate) async fn transact( db: &C, store_setup: &S, secrets: &K, @@ -589,10 +589,8 @@ pub(crate) async fn transact delegation::process::(db, *d) - .await - .map_err(|e| e.to_del())?, - Event::Invocation(i, ops) => invocation::process::( + Event::Delegation(d) => delegation::process(db, *d).await.map_err(|e| e.to_del())?, + Event::Invocation(i, ops) => invocation::process( db, *i, ops.into_iter() diff --git a/kepler-core/src/models/delegation.rs b/kepler-core/src/models/delegation.rs index f880bf43..59814e71 100644 --- a/kepler-core/src/models/delegation.rs +++ b/kepler-core/src/models/delegation.rs @@ -7,7 +7,7 @@ use crate::{ }; use kepler_lib::authorization::{delegation_from_bytes, Delegation, EncodingError, Resources}; use sea_orm::{entity::prelude::*, sea_query::OnConflict, ConnectionTrait}; -use time::{ext::NumericalDuration, OffsetDateTime}; +use time::{ext::NumericalDuration, Duration, OffsetDateTime}; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "delegation")] @@ -32,8 +32,8 @@ impl Model { )) } - pub(crate) fn valid_at(&self, time: OffsetDateTime) -> bool { - let skew = SKEW.seconds(); + pub(crate) fn valid_at(&self, time: OffsetDateTime, skew: Option) -> bool { + let skew = skew.unwrap_or_else(|| Duration::seconds(0)); self.expiry.map_or(true, |exp| time < exp + skew) && self.not_before.map_or(true, |nbf| nbf <= time + skew) } @@ -132,12 +132,12 @@ impl Linked for Delegatee { impl ActiveModelBehavior for ActiveModel {} -pub(crate) async fn process( +pub(crate) async fn process( db: &C, SerializedEvent(d, ser): SDelegation, ) -> Result { let time = OffsetDateTime::now_utc(); - if !d.valid_at_time::<60, u64>(time.unix_timestamp() as u64) { + if !d.valid_at_time(time.unix_timestamp() as u64, None) { return Err(ValidationError::InvalidTime.into()); } verify(&d).await?; diff --git a/kepler-core/src/models/invocation.rs b/kepler-core/src/models/invocation.rs index c7f06e54..0c4ed2a9 100644 --- a/kepler-core/src/models/invocation.rs +++ b/kepler-core/src/models/invocation.rs @@ -48,17 +48,17 @@ impl Related for Entity { impl ActiveModelBehavior for ActiveModel {} -pub(crate) async fn process( +pub(crate) async fn process( db: &C, SerializedEvent(i, ser): SInvocation, ops: Vec, ) -> Result { let time = OffsetDateTime::now_utc(); - if !i.valid_at_time::<60, u64>(time.unix_timestamp() as u64) { + if !i.valid_at_time(time.unix_timestamp() as u64, None) { return Err(ValidationError::InvalidTime.into()); } verify(&i).await?; - validate(db, &i, Some(|p: &delegation::Model| p.valid_at::<60>(time))).await?; + validate(db, &i, Some(|p: &delegation::Model| p.valid_at(time, None))).await?; save(db, i, Some(time), ser, ops).await } diff --git a/src/lib.rs b/src/lib.rs index 1294d13b..a348b350 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,6 @@ pub type Block = OBlock; pub type BlockStores = Either; pub type BlockConfig = Either; pub type BlockStage = Either; -pub const OK_SKEW: u64 = 60; impl From for BlockConfig { fn from(c: BlockStorage) -> BlockConfig { diff --git a/src/routes/mod.rs b/src/routes/mod.rs index b983328a..4970f154 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -1,4 +1,3 @@ -use crate::OK_SKEW; use anyhow::Result; use rocket::{data::ToByteUnit, http::Status, State}; use std::collections::HashMap; @@ -75,7 +74,7 @@ pub async fn delegate( .with_label_values(&["delegate"]) .start_timer(); let res = kepler - .delegate::(d.0) + .delegate(d.0) .await .map_err(|e| { ( @@ -180,7 +179,7 @@ pub async fn invoke( } }; let res = kepler - .invoke::(i.0, inputs) + .invoke::(i.0, inputs) .await .map( |(_, mut outcomes)| match (outcomes.pop(), outcomes.pop(), outcomes.drain(..)) { From 2200bb823b2c1cf37bd86c205e1501af89c262b1 Mon Sep 17 00:00:00 2001 From: chunningham Date: Wed, 20 Sep 2023 01:36:10 +0200 Subject: [PATCH 14/24] use optional time instead of closure for parent time check --- kepler-core/src/models/delegation.rs | 4 ++-- kepler-core/src/models/invocation.rs | 2 +- kepler-core/src/models/mod.rs | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kepler-core/src/models/delegation.rs b/kepler-core/src/models/delegation.rs index 59814e71..24251fae 100644 --- a/kepler-core/src/models/delegation.rs +++ b/kepler-core/src/models/delegation.rs @@ -7,7 +7,7 @@ use crate::{ }; use kepler_lib::authorization::{delegation_from_bytes, Delegation, EncodingError, Resources}; use sea_orm::{entity::prelude::*, sea_query::OnConflict, ConnectionTrait}; -use time::{ext::NumericalDuration, Duration, OffsetDateTime}; +use time::{Duration, OffsetDateTime}; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "delegation")] @@ -141,7 +141,7 @@ pub(crate) async fn process( return Err(ValidationError::InvalidTime.into()); } verify(&d).await?; - validate(db, &d, Option:: bool>::None).await?; + validate(db, &d, None).await?; save(db, d, ser).await } diff --git a/kepler-core/src/models/invocation.rs b/kepler-core/src/models/invocation.rs index 0c4ed2a9..d51791a4 100644 --- a/kepler-core/src/models/invocation.rs +++ b/kepler-core/src/models/invocation.rs @@ -58,7 +58,7 @@ pub(crate) async fn process( return Err(ValidationError::InvalidTime.into()); } verify(&i).await?; - validate(db, &i, Some(|p: &delegation::Model| p.valid_at(time, None))).await?; + validate(db, &i, Some(time)).await?; save(db, i, Some(time), ser, ops).await } diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index 09529ff2..5c083db1 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -96,10 +96,10 @@ async fn verify(cacao: &CommonCacao) -> Result<(), ValidationError> { } // verify parenthood and authorization -async fn validate<'a, C: ConnectionTrait, T: Fn(&delegation::Model) -> bool>( +async fn validate<'a, C: ConnectionTrait>( db: &C, message: &'a CommonCacao, - parent_check: Option, + time: Option, ) -> Result<(), EventProcessingError> { let mut required = get_required(message); match (required.next(), message.proof()) { @@ -110,7 +110,7 @@ async fn validate<'a, C: ConnectionTrait, T: Fn(&delegation::Model) -> bool>( let mut unauthorized = take_unauthorized( once(rf).chain(required), // get all known parents of `message` - get_granted(db, message, parent_check).await?, + get_granted(db, message, time).await?, ) .map(|(r, a)| (r.into(), a.into_iter().cloned().collect())); match unauthorized.next() { @@ -170,7 +170,7 @@ fn take_unauthorized<'a>( async fn get_granted( db: &C, message: &CommonCacao, - check: Option bool>, + time: Option, ) -> Result>, EventProcessingError> { Ok(match message.proof() { // get delegated abilities from each parent @@ -202,7 +202,7 @@ async fn get_granted( // valid time bounds .filter(|p| p.validate_bounds(nbf, exp)) // extra check - .filter(|p| check.as_ref().map_or(true, |f| f(p))) + .filter(|p| time.map_or(true, |t| p.valid_at(t, None))) .collect::>() .load_many(abilities::Entity, db) .await? From 02c0a4940155275527b25a3c96acd467ce052c4a Mon Sep 17 00:00:00 2001 From: chunningham Date: Wed, 20 Sep 2023 02:41:49 +0200 Subject: [PATCH 15/24] fix higher trait bound issue --- kepler-core/src/models/delegation.rs | 22 +++++++++++----------- kepler-core/src/models/invocation.rs | 26 +++++++++++++------------- lib/src/authorization.rs | 17 ++++++++++++----- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/kepler-core/src/models/delegation.rs b/kepler-core/src/models/delegation.rs index 24251fae..b1f28752 100644 --- a/kepler-core/src/models/delegation.rs +++ b/kepler-core/src/models/delegation.rs @@ -201,21 +201,21 @@ async fn save( // save abilities if !delegation.capabilities().is_empty() { - abilities::Entity::insert_many( - Resources::<'_, &'_ UriStr>::grants(&delegation) - .map(|(resource, abilities)| { - abilities.into_iter().map(|(ability, c)| abilities::Model { + let abilities = Resources::<'_, AnyResource>::grants(&delegation) + .map(|(resource, abilities)| { + abilities + .into_iter() + .map(move |(ability, c)| abilities::Model { delegation: hash, - resource: resource.into(), + resource: resource.clone().into(), ability: ability.clone().into(), caveats: c.clone().into(), }) - }) - .flatten() - .map(abilities::ActiveModel::from), - ) - .exec(db) - .await?; + }) + .flatten() + .map(abilities::ActiveModel::from) + .collect::>(); + abilities::Entity::insert_many(abilities).exec(db).await?; } // save parent relationships diff --git a/kepler-core/src/models/invocation.rs b/kepler-core/src/models/invocation.rs index d51791a4..a4f73b5d 100644 --- a/kepler-core/src/models/invocation.rs +++ b/kepler-core/src/models/invocation.rs @@ -97,21 +97,21 @@ async fn save( // save invoked abilities if !invocation.capabilities().is_empty() { - invoked_abilities::Entity::insert_many( - Resources::<'_, &UriStr>::grants(&invocation) - .map(|(resource, actions)| { - actions.into_iter().map(|(action, _)| { - invoked_abilities::ActiveModel::from(invoked_abilities::Model { - invocation: hash, - resource: resource.into(), - ability: action.clone().into(), - }) + let invoked = Resources::<'_, AnyResource>::grants(&invocation) + .map(|(resource, actions)| { + actions.into_iter().map(move |(action, _)| { + invoked_abilities::ActiveModel::from(invoked_abilities::Model { + invocation: hash, + resource: resource.clone().into(), + ability: action.clone().into(), }) }) - .flatten(), - ) - .exec(db) - .await?; + }) + .flatten() + .collect::>(); + invoked_abilities::Entity::insert_many(invoked) + .exec(db) + .await?; } // save parent relationships diff --git a/lib/src/authorization.rs b/lib/src/authorization.rs index 12566866..8d0abf62 100644 --- a/lib/src/authorization.rs +++ b/lib/src/authorization.rs @@ -17,7 +17,6 @@ pub trait HeaderEncode { } pub trait Resources<'a, RO: 'a = &'a UriStr, NB: 'a = serde_json::Value> { - type RI; type Iter: Iterator>)>; fn grants(&'a self) -> Self::Iter; fn resources(&'a self) -> Map::Item) -> RO> { @@ -54,7 +53,6 @@ impl<'a, NB: 'a, RO: 'a, F: 'a, S: 'a> Resources<'a, RO, NB> for Cacao where Capabilities: Resources<'a, RO, NB>, { - type RI = as Resources<'a, RO, NB>>::RI; type Iter = as Resources<'a, RO, NB>>::Iter; fn grants(&'a self) -> Self::Iter { self.capabilities().grants() @@ -62,7 +60,6 @@ where } impl<'a, NB: 'a> Resources<'a, ResourceId, NB> for Capabilities { - type RI = &'a UriString; type Iter = FilterMap< std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, fn( @@ -77,7 +74,6 @@ impl<'a, NB: 'a> Resources<'a, ResourceId, NB> for Capabilities { } impl<'a, NB: 'a> Resources<'a, &'a UriStr, NB> for Capabilities { - type RI = &'a UriString; type Iter = Map< std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, fn( @@ -89,8 +85,19 @@ impl<'a, NB: 'a> Resources<'a, &'a UriStr, NB> for Capabilities { } } +impl<'a, NB: 'a> Resources<'a, AnyResource, NB> for Capabilities { + type Iter = Map< + std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, + fn( + (&'a UriString, &'a BTreeMap>), + ) -> (AnyResource, &'a BTreeMap>), + >; + fn grants(&'a self) -> Self::Iter { + self.abilities().iter().map(|(r, a)| (r.into(), a)) + } +} + impl<'a, NB: 'a> Resources<'a, AnyResource<&'a UriStr>, NB> for Capabilities { - type RI = &'a UriString; type Iter = Map< std::collections::btree_map::Iter<'a, UriString, BTreeMap>>, fn( From d7b3090d8fac20e9814fa1fd2037a9a3406e85cb Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 15:44:43 +0200 Subject: [PATCH 16/24] fix peer did generation --- kepler-core/src/keys.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kepler-core/src/keys.rs b/kepler-core/src/keys.rs index 3efe05c0..1775e6d8 100644 --- a/kepler-core/src/keys.rs +++ b/kepler-core/src/keys.rs @@ -18,7 +18,7 @@ pub(crate) fn get_did_key(key: PublicKey) -> String { use kepler_lib::libipld::cid::multibase; // only ed25519 feature is enabled, so this unwrap should never fail let ed25519_pk_bytes = key.try_into_ed25519().unwrap().to_bytes(); - let multicodec_pk = [[0xed].as_slice(), ed25519_pk_bytes.as_slice()].concat(); + let multicodec_pk = [[0xed, 0x01].as_slice(), ed25519_pk_bytes.as_slice()].concat(); format!( "did:key:{}", multibase::encode(multibase::Base::Base58Btc, multicodec_pk) From f22f0a72af00e6d08c629b3d40681e0780eab737 Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 16:15:23 +0200 Subject: [PATCH 17/24] update kepler and sdk to new cacaos --- Cargo.lock | 118 +++++++++++++---------------- kepler-core/Cargo.toml | 2 +- kepler-core/src/db.rs | 2 +- kepler-core/src/models/mod.rs | 2 +- lib/Cargo.toml | 8 +- lib/src/authorization.rs | 4 +- sdk/Cargo.toml | 7 ++ sdk/src/authorization.rs | 14 +--- sdk/src/serde_siwe.rs | 4 +- sdk/src/session.rs | 136 ++++++++++++++++------------------ sdk/src/siwe_utils.rs | 37 +++++---- 11 files changed, 150 insertions(+), 184 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 228ac933..399bb770 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,9 +53,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -807,9 +807,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ "arrayref", "arrayvec 0.7.4", @@ -1033,7 +1033,7 @@ dependencies = [ [[package]] name = "cacaos" version = "0.5.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#9464d9ebf5a7f90d6317e0dd1407d0f772678fa0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v3#92661420efc40f9d2b1345e6366d848f238828bd" dependencies = [ "async-trait", "hex", @@ -1162,7 +1162,6 @@ dependencies = [ "multibase 0.9.1", "multihash 0.16.3", "serde", - "serde_bytes", "unsigned-varint", ] @@ -1441,9 +1440,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.0" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -1792,7 +1791,7 @@ dependencies = [ [[package]] name = "did-ethr" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "chrono", @@ -1808,7 +1807,7 @@ dependencies = [ [[package]] name = "did-method-key" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "multibase 0.8.0", @@ -1823,7 +1822,7 @@ dependencies = [ [[package]] name = "did-onion" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "http", @@ -1836,7 +1835,7 @@ dependencies = [ [[package]] name = "did-pkh" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "bech32 0.8.1", @@ -1855,7 +1854,7 @@ dependencies = [ [[package]] name = "did-tz" version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "anyhow", "async-trait", @@ -1874,8 +1873,8 @@ dependencies = [ [[package]] name = "did-web" -version = "0.2.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +version = "0.2.2" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "http", @@ -1887,7 +1886,7 @@ dependencies = [ [[package]] name = "did-webkey" version = "0.2.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "anyhow", "async-trait", @@ -2004,7 +2003,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "ed25519 2.2.2", "rand_core 0.6.4", "serde", @@ -2886,7 +2885,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.13", + "rustix 0.38.14", "windows-sys 0.48.0", ] @@ -3165,7 +3164,7 @@ dependencies = [ "sea-orm", "sea-orm-migration", "serde", - "serde_ipld_dagcbor 0.3.0", + "serde_ipld_dagcbor", "serde_json", "ssi", "thiserror", @@ -3190,14 +3189,13 @@ dependencies = [ "lazy_static", "libipld 0.16.0", "serde", - "serde_ipld_dagcbor 0.4.2", + "serde_ipld_dagcbor", "serde_json", "serde_with 1.14.0", "siwe-recap 0.2.0", "ssi", "thiserror", "tokio", - "uuid", ] [[package]] @@ -3210,12 +3208,14 @@ dependencies = [ "iri-string", "kepler-lib", "serde", + "serde_ipld_dagcbor", "serde_json", "serde_with 1.14.0", "thiserror", "time", "tokio", "tracing", + "uuid", ] [[package]] @@ -3808,7 +3808,7 @@ dependencies = [ [[package]] name = "multidid" version = "0.1.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#9464d9ebf5a7f90d6317e0dd1407d0f772678fa0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v3#92661420efc40f9d2b1345e6366d848f238828bd" dependencies = [ "bech32 0.9.1", "bs58 0.5.0", @@ -3829,8 +3829,6 @@ dependencies = [ "blake3", "core2", "multihash-derive", - "serde", - "serde-big-array", "unsigned-varint", ] @@ -4384,7 +4382,7 @@ dependencies = [ "chrono", "cipher", "crc24", - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "derive_builder 0.12.0", "des", "digest 0.10.7", @@ -5192,9 +5190,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" dependencies = [ "bitflags 2.4.0", "errno", @@ -5251,9 +5249,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -5581,18 +5579,6 @@ dependencies = [ "syn 2.0.37", ] -[[package]] -name = "serde_ipld_dagcbor" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2433e94ffb5977e67afbd75733abd6ada1c4f497125894a8c89b3fdc5fd6a058" -dependencies = [ - "cbor4ii", - "cid 0.8.6", - "scopeguard", - "serde", -] - [[package]] name = "serde_ipld_dagcbor" version = "0.4.2" @@ -5702,9 +5688,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -5881,9 +5867,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -6195,7 +6181,7 @@ dependencies = [ [[package]] name = "ssi" version = "0.7.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "ssi-caips", "ssi-core", @@ -6216,7 +6202,7 @@ dependencies = [ [[package]] name = "ssi-caips" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "bs58 0.4.0", "ssi-jwk", @@ -6226,12 +6212,12 @@ dependencies = [ [[package]] name = "ssi-contexts" version = "0.1.5" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" [[package]] name = "ssi-core" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "serde", @@ -6241,7 +6227,7 @@ dependencies = [ [[package]] name = "ssi-crypto" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "bs58 0.4.0", "digest 0.9.0", @@ -6256,7 +6242,7 @@ dependencies = [ [[package]] name = "ssi-dids" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "anyhow", "async-trait", @@ -6282,7 +6268,7 @@ dependencies = [ [[package]] name = "ssi-json-ld" version = "0.2.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-std", "combination", @@ -6303,7 +6289,7 @@ dependencies = [ [[package]] name = "ssi-jwk" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "base64 0.12.3", "blake2b_simd 0.5.11", @@ -6331,7 +6317,7 @@ dependencies = [ [[package]] name = "ssi-jws" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "base64 0.12.3", "blake2", @@ -6352,7 +6338,7 @@ dependencies = [ [[package]] name = "ssi-jwt" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "chrono", "serde", @@ -6366,7 +6352,7 @@ dependencies = [ [[package]] name = "ssi-ldp" version = "0.3.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "bs58 0.4.0", @@ -6402,7 +6388,7 @@ dependencies = [ [[package]] name = "ssi-ssh" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "sshkeys", "ssi-jwk", @@ -6412,7 +6398,7 @@ dependencies = [ [[package]] name = "ssi-tzkey" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "bs58 0.4.0", "ed25519-dalek 1.0.1", @@ -6424,7 +6410,7 @@ dependencies = [ [[package]] name = "ssi-ucan" version = "0.2.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "base64 0.12.3", "chrono", @@ -6446,7 +6432,7 @@ dependencies = [ [[package]] name = "ssi-vc" version = "0.2.0" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "base64 0.12.3", @@ -6474,7 +6460,7 @@ dependencies = [ [[package]] name = "ssi-zcap-ld" version = "0.1.2" -source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#4b807236207bc2b025c1851ebcec1d6af92b9fb4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "iref", @@ -6605,7 +6591,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.0", "redox_syscall", - "rustix 0.38.13", + "rustix 0.38.14", "windows-sys 0.48.0", ] @@ -6799,9 +6785,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -7146,7 +7132,7 @@ checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" [[package]] name = "varsig" version = "0.1.0" -source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v2#9464d9ebf5a7f90d6317e0dd1407d0f772678fa0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v3#92661420efc40f9d2b1345e6366d848f238828bd" dependencies = [ "serde", "thiserror", @@ -7508,7 +7494,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "rand_core 0.6.4", "serde", "zeroize", diff --git a/kepler-core/Cargo.toml b/kepler-core/Cargo.toml index 80e95c58..e563cf55 100644 --- a/kepler-core/Cargo.toml +++ b/kepler-core/Cargo.toml @@ -26,7 +26,7 @@ thiserror = "1" ssi = { version = "0.7", git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10" } serde = { version = "1", features = ["derive"] } serde_json = "1" -serde_ipld_dagcbor = "0.3" +serde_ipld_dagcbor = "0.4" [dev-dependencies] sea-orm = { version = "0.12", features = ["runtime-async-std-rustls", "sqlx-sqlite"] } diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index a189985a..88f3f892 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -49,7 +49,7 @@ pub enum TxError { #[error(transparent)] Ucan(#[from] ssi::ucan::jose::VerificationError), #[error(transparent)] - Cacao(#[from] kepler_lib::cacaos::v2::common::Error), + Cacao(#[from] kepler_lib::cacaos::common::Error), #[error(transparent)] InvalidDelegation(ValidationError), #[error(transparent)] diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index 5c083db1..560f7087 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -11,7 +11,7 @@ pub mod revocation; use crate::{hash::Hash, keys::Secrets, storage::StorageSetup, types::CaveatsInner, TxError}; use kepler_lib::{ authorization::Resources, - cacaos::v2::{ + cacaos::{ common::{CommonCacao, CommonVerifier, Error as CacaoError}, Cacao, }, diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 6d782b21..00cdeb25 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,7 +12,7 @@ serde_json = "1.0" serde_with = "1.0" thiserror = "1" base64 = "0.13" -cacaos = { git = "https://github.com/spruceid/cacao-rs", branch = "feat/cacao-v2" } +cacaos = { git = "https://github.com/spruceid/cacao-rs", branch = "feat/cacao-v3" } siwe-recap = "0.2.0" lazy_static = "1.4" did-method-key = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } @@ -24,12 +24,6 @@ did-webkey = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10 did-onion = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-0.10", default-features = false, version = "0.2" } serde_ipld_dagcbor = "0.4" -[target.'cfg(target_arch = "wasm32")'.dependencies] -uuid = { version = "1", features = ["v4", "js"] } - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -uuid = { version = "1", features = ["v4"] } - [dependencies.ssi] git = "https://github.com/spruceid/ssi" branch = "feat/ucan-0.10" diff --git a/lib/src/authorization.rs b/lib/src/authorization.rs index 8d0abf62..79a1e415 100644 --- a/lib/src/authorization.rs +++ b/lib/src/authorization.rs @@ -1,5 +1,5 @@ use crate::resource::{AnyResource, ResourceId}; -use cacaos::v2::{common::CommonCacao, varsig::either::EitherSignature, Cacao}; +use cacaos::{common::CommonCacao, varsig::either::EitherSignature, Cacao}; use iri_string::types::{UriStr, UriString}; use ssi::ucan::{capabilities::*, jose, jwt::Jwt, Revocation as URevocation, Ucan, UcanDecode}; use std::{ @@ -141,7 +141,7 @@ pub enum EncodingError { #[error(transparent)] UCAN(#[from] ssi::ucan::jwt::DecodeError), #[error(transparent)] - CacaoError(#[from] cacaos::v2::common::Error), + CacaoError(#[from] cacaos::common::Error), #[error(transparent)] ToIpldError(#[from] serde_ipld_dagcbor::EncodeError), #[error(transparent)] diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index f97d202c..4fc1cfeb 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -15,6 +15,13 @@ serde_with = { version = "1" } serde_json = "1.0" thiserror = "1" tracing = "0.1.36" +serde_ipld_dagcbor = "0.4" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +uuid = { version = "1", features = ["v4", "js"] } + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +uuid = { version = "1", features = ["v4"] } [dev-dependencies] tokio = { version = "1", features = ["macros"]} diff --git a/sdk/src/authorization.rs b/sdk/src/authorization.rs index 59864525..7b1bd4e2 100644 --- a/sdk/src/authorization.rs +++ b/sdk/src/authorization.rs @@ -6,7 +6,7 @@ use crate::session::Session; #[derive(Debug, Deserialize, Serialize, Clone)] pub struct DelegationHeaders { #[serde(with = "header_enc", rename = "Authorization")] - delegation: Delegation, + pub delegation: Delegation, } #[derive(Debug, Deserialize, Serialize, Clone)] @@ -16,15 +16,9 @@ pub struct InvocationHeaders { } impl InvocationHeaders { - pub async fn from( - session: Session, - actions: Vec<(String, String, String)>, - ) -> Result { + pub fn from(session: Session, actions: Vec<(String, String, String)>) -> Result { Ok(Self { - invocation: session - .invoke(actions) - .await - .map_err(Error::FailedToMakeInvocation)?, + invocation: session.invoke(actions)?, }) } } @@ -38,7 +32,7 @@ impl DelegationHeaders { #[derive(Debug, thiserror::Error)] pub enum Error { #[error("failed to generate proof for invocation: {0}")] - FailedToMakeInvocation(kepler_lib::authorization::InvocationError), + FailedToMakeInvocation(#[from] crate::session::Error), #[error("failed to translate response to JSON: {0}")] JSONSerializing(serde_json::Error), #[error("failed to parse session from JSON: {0}")] diff --git a/sdk/src/serde_siwe.rs b/sdk/src/serde_siwe.rs index b6486601..f87d3b2f 100644 --- a/sdk/src/serde_siwe.rs +++ b/sdk/src/serde_siwe.rs @@ -14,8 +14,8 @@ pub mod address { } pub mod signature { + use crate::session::SIWESignature; use hex::FromHex; - use kepler_lib::cacaos::siwe_cacao::SIWESignature; use serde::de::{Deserialize, Deserializer, Error}; pub fn deserialize<'de, D>(d: D) -> Result @@ -24,7 +24,7 @@ pub mod signature { { String::deserialize(d).and_then(|sig| { <[u8; 65]>::from_hex(sig.strip_prefix("0x").unwrap_or(&sig)) - .map(Into::into) + .map(SIWESignature) .map_err(|e| D::Error::custom(format!("failed to parse SIWE signature: {e}"))) }) } diff --git a/sdk/src/session.rs b/sdk/src/session.rs index ba27f1b4..bfe7d1bf 100644 --- a/sdk/src/session.rs +++ b/sdk/src/session.rs @@ -1,27 +1,25 @@ use crate::authorization::DelegationHeaders; use http::uri::Authority; use kepler_lib::{ - authorization::{make_invocation, Invocation, InvocationError}, - cacaos::{ - siwe::{generate_nonce, Message, TimeStamp, Version as SIWEVersion}, - siwe_cacao::SIWESignature, - }, + authorization::{Delegation, Invocation}, + cacaos::siwe::{generate_nonce, Message, TimeStamp, Version as SIWEVersion}, libipld::Cid, resolver::DID_METHODS, resource::OrbitId, - siwe_recap::Builder, - ssi::{did::Source, jwk::JWK, vc::get_verification_method}, + ssi::{did::Source, jwk::JWK, ucan::capabilities::Capabilities, vc::get_verification_method}, }; use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DisplayFromStr}; -use std::collections::HashMap; -use time::{ext::NumericalDuration, Duration, OffsetDateTime}; +use time::OffsetDateTime; + +pub struct SIWESignature(pub [u8; 65]); #[serde_as] #[derive(Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct SessionConfig { - pub actions: HashMap>>, + #[serde(default)] + pub actions: Capabilities, #[serde(with = "crate::serde_siwe::address")] pub address: [u8; 20], pub chain_id: u64, @@ -77,38 +75,20 @@ pub struct Session { impl SessionConfig { fn into_message(self, delegate: &str) -> Result { - use serde_json::Value; - let ns = "kepler" - .parse() - .map_err(|e| format!("error parsing kepler as Siwe Capability namespace: {e}"))?; - let b = self - .actions - .into_iter() - .fold(Builder::new(), |builder, (service, actions)| { - actions.into_iter().fold(builder, |b, (path, action)| { - b.with_actions( - &ns, - self.orbit_id - .clone() - .to_resource(Some(service.clone()), Some(path), None) - .to_string(), - action, - ) - }) - }); - match self.parents { - Some(p) => b.with_extra_fields( - &ns, - [( - "parents".to_string(), - Value::Array(p.iter().map(|c| Value::String(c.to_string())).collect()), - )] + use kepler_lib::siwe_recap::Capability; + let caps = + self.actions + .into_inner() .into_iter() - .collect(), - ), - None => b, + .fold(Capability::new(), |mut caps, (k, v)| { + caps.with_actions(k, v); + caps + }); + match self.parents { + Some(p) => caps.with_proofs(&p), + None => caps, } - .build(Message { + .build_message(Message { address: self.address, chain_id: self.chain_id, domain: self.domain, @@ -129,29 +109,38 @@ impl SessionConfig { } impl Session { - pub async fn invoke( - self, - actions: Vec<(String, String, String)>, - ) -> Result { - let targets = actions - .into_iter() - .map(|(s, p, a)| self.orbit_id.clone().to_resource(Some(s), Some(p), Some(a))); + pub fn invoke(self, actions: Vec<(String, String, String)>) -> Result { + use kepler_lib::ssi::ucan::Payload; + use serde_json::Value; + let targets = + actions + .into_iter() + .try_fold(Capabilities::::new(), |mut acc, (s, p, a)| { + let action = format!("{s}/{a}"); + acc.with_action_convert( + self.orbit_id + .clone() + .to_resource(Some(s), Some(p), None) + .to_string(), + action, + [], + ) + .map_err(|_| Error::InvalidAction)?; + Ok::, Error>(acc) + })?; let now = OffsetDateTime::now_utc(); - let nanos = now.nanosecond(); let unix = now.unix_timestamp(); // 60 seconds in the future - let exp = (unix.seconds() + Duration::nanoseconds(nanos.into()) + Duration::MINUTE) - .as_seconds_f64(); - make_invocation( - targets.collect(), - self.delegation_cid, - &self.jwk, + let exp = unix + 60; + let mut p = Payload::::new( + self.verification_method.clone(), self.verification_method, - exp, - None, - None, - ) - .await + ); + p.expiration = Some(exp as u64); + p.proof = Some(vec![self.delegation_cid]); + p.nonce = Some(format!("urn:uuid:{}", uuid::Uuid::new_v4())); + p.capabilities = targets; + Ok(p.sign_with_jwk(&self.jwk, None)?.try_into()?) } } @@ -185,21 +174,14 @@ pub async fn prepare_session(config: SessionConfig) -> Result Result { - use kepler_lib::{ - authorization::Delegation, - cacaos::siwe_cacao::SiweCacao, - libipld::{cbor::DagCborCodec, multihash::Code, store::DefaultParams, Block}, - }; - let delegation = SiweCacao::new( - signed_session.session.siwe.into(), - signed_session.signature, - None, + use kepler_lib::libipld::multihash::{Code, MultihashDigest}; + let delegation = + Delegation::try_from((signed_session.session.siwe, signed_session.signature.0))?; + let delegation_cid = Cid::new_v1( + 0x71, + Code::Blake3_256.digest(&serde_ipld_dagcbor::to_vec(&delegation)?), ); - let delegation_cid = - *Block::::encode(DagCborCodec, Code::Blake3_256, &delegation) - .map_err(Error::UnableToGenerateCid)? - .cid(); - let delegation_header = DelegationHeaders::new(Delegation::Cacao(Box::new(delegation))); + let delegation_header = DelegationHeaders::new(delegation.into()); Ok(Session { delegation_header, @@ -219,11 +201,17 @@ pub enum Error { #[error("unable to generate the SIWE message to start the session: {0}")] UnableToGenerateSIWEMessage(String), #[error("unable to generate the CID: {0}")] - UnableToGenerateCid(kepler_lib::libipld::error::Error), + UnableToGenerateCid(#[from] serde_ipld_dagcbor::EncodeError), #[error("failed to translate response to JSON: {0}")] JSONSerializing(serde_json::Error), #[error("failed to parse input from JSON: {0}")] JSONDeserializing(serde_json::Error), + #[error(transparent)] + CacaoError(#[from] kepler_lib::cacaos::common::Error), + #[error(transparent)] + UcanError(#[from] kepler_lib::ssi::ucan::payload::Error), + #[error("Invalid Actions or Resources")] + InvalidAction, } #[cfg(test)] diff --git a/sdk/src/siwe_utils.rs b/sdk/src/siwe_utils.rs index e3ea6830..36a46d5c 100644 --- a/sdk/src/siwe_utils.rs +++ b/sdk/src/siwe_utils.rs @@ -1,15 +1,11 @@ use http::uri::Authority; -use kepler_lib::authorization::Delegation; -use kepler_lib::cacaos::{ - siwe::{generate_nonce, Message, TimeStamp, Version}, - siwe_cacao::{SIWESignature, SiweCacao}, -}; +use kepler_lib::cacaos::recap_cacao::siwe::{generate_nonce, Message, TimeStamp, Version}; use kepler_lib::resource::OrbitId; -use kepler_lib::siwe_recap::Builder; +use kepler_lib::siwe_recap::Capability; use serde::Deserialize; use serde_with::{serde_as, DisplayFromStr}; -use crate::authorization::DelegationHeaders; +use crate::{authorization::DelegationHeaders, session::SIWESignature}; #[serde_as] #[derive(Deserialize)] @@ -39,15 +35,14 @@ pub struct SignedMessage { impl TryFrom for Message { type Error = String; fn try_from(c: HostConfig) -> Result { - Builder::new() - .with_action( - &"kepler" - .parse() - .map_err(|e| format!("failed to parse kepler as namespace: {e}"))?, + Capability::::new() + .with_action_convert( c.orbit_id.to_resource(None, None, None).to_string(), - "host".to_string(), + "orbit/host".to_string(), + [], ) - .build(Self { + .map_err(|e| format!("failed to create capability: {}", e))? + .build_message(Self { address: c.address, chain_id: c.chain_id, domain: c.domain, @@ -72,12 +67,12 @@ pub fn generate_host_siwe_message(config: HostConfig) -> Result Message::try_from(config).map_err(Error::UnableToGenerateSIWEMessage) } -pub fn siwe_to_delegation_headers(signed_message: SignedMessage) -> DelegationHeaders { - DelegationHeaders::new(Delegation::Cacao(Box::new(SiweCacao::new( - signed_message.siwe.into(), - signed_message.signature, - None, - )))) +pub fn siwe_to_delegation_headers( + signed_message: SignedMessage, +) -> Result { + Ok(DelegationHeaders::new( + (signed_message.siwe, signed_message.signature.0).try_into()?, + )) } #[derive(Debug, thiserror::Error)] @@ -88,4 +83,6 @@ pub enum Error { JSONSerializing(serde_json::Error), #[error("failed to parse input from JSON: {0}")] JSONDeserializing(serde_json::Error), + #[error(transparent)] + CacaoError(#[from] kepler_lib::cacaos::common::Error), } From 9bbccd4ed75101a933ca11dd9d796eddbb01d539 Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 16:15:46 +0200 Subject: [PATCH 18/24] update load test --- test/load/signer/Cargo.lock | 1026 ++++++++++++++++++++-------------- test/load/signer/src/main.rs | 36 +- 2 files changed, 628 insertions(+), 434 deletions(-) diff --git a/test/load/signer/Cargo.lock b/test/load/signer/Cargo.lock index 12188616..25578a78 100644 --- a/test/load/signer/Cargo.lock +++ b/test/load/signer/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -86,9 +86,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arrayref" @@ -138,7 +138,7 @@ dependencies = [ "async-lock", "async-task", "concurrent-queue", - "fastrand", + "fastrand 1.9.0", "futures-lite", "slab", ] @@ -172,17 +172,17 @@ dependencies = [ "log", "parking", "polling", - "rustix", + "rustix 0.37.23", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", ] [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] @@ -222,13 +222,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -286,7 +286,7 @@ checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" dependencies = [ "async-trait", "axum-core", - "bitflags", + "bitflags 1.3.2", "bytes", "futures-util", "http", @@ -327,9 +327,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -388,9 +388,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "base64ct" @@ -410,6 +410,12 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bincode" version = "1.3.3" @@ -431,6 +437,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "bitvec" version = "0.17.4" @@ -487,31 +499,31 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq 0.2.6", + "constant_time_eq 0.3.0", ] [[package]] name = "blake2s_simd" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" +checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" dependencies = [ "arrayref", "arrayvec 0.7.4", - "constant_time_eq 0.2.6", + "constant_time_eq 0.3.0", ] [[package]] name = "blake3" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ "arrayref", "arrayvec 0.7.4", @@ -578,7 +590,7 @@ dependencies = [ "async-lock", "async-task", "atomic-waker", - "fastrand", + "fastrand 1.9.0", "futures-lite", "log", ] @@ -602,11 +614,20 @@ dependencies = [ "sha2 0.9.9", ] +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "serde", @@ -624,9 +645,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-slice-cast" @@ -648,13 +669,39 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" dependencies = [ "serde", ] +[[package]] +name = "cacaos" +version = "0.5.0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v3#92661420efc40f9d2b1345e6366d848f238828bd" +dependencies = [ + "async-trait", + "hex", + "http", + "iri-string", + "libipld 0.16.0", + "multidid", + "serde", + "serde_json", + "siwe", + "siwe-recap 0.2.0", + "ssi-dids", + "ssi-jwk", + "ssi-jwt", + "ssi-ucan", + "thiserror", + "time", + "ucan-capabilities-object", + "url", + "varsig", +] + [[package]] name = "cacaos" version = "0.5.1" @@ -665,12 +712,12 @@ dependencies = [ "hex", "http", "iri-string", - "libipld", + "libipld 0.14.0", "serde", "serde_with 2.3.3", "siwe", "thiserror", - "time 0.3.23", + "time", "url", ] @@ -735,11 +782,23 @@ dependencies = [ "cipher", ] +[[package]] +name = "cbor4ii" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544cf8c89359205f4f990d0e6f3828db42df85b5dac95d09157a250eb0749c4" +dependencies = [ + "serde", +] + [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfb-mode" @@ -758,18 +817,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] @@ -780,7 +838,20 @@ checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase 0.9.1", - "multihash", + "multihash 0.16.3", + "serde", + "unsigned-varint", +] + +[[package]] +name = "cid" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd94671561e36e4e7de75f753f577edafb0e7c05d6e4547229fdf7938fbcd2c3" +dependencies = [ + "core2", + "multibase 0.9.1", + "multihash 0.18.1", "serde", "serde_bytes", "unsigned-varint", @@ -812,7 +883,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "634c509653de24b439672164bbf56f5f582a2ab0e313d3b0f6af0b7345cf2560" dependencies = [ "bincode", - "bs58", + "bs58 0.4.0", "coins-core", "digest 0.10.7", "getrandom 0.2.10", @@ -885,9 +956,9 @@ checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" [[package]] name = "const-oid" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "constant_time_eq" @@ -895,12 +966,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "constant_time_eq" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" - [[package]] name = "constant_time_eq" version = "0.3.0" @@ -1010,9 +1075,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array 0.14.7", "rand_core 0.6.4", @@ -1054,9 +1119,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.3" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436ace70fc06e06f7f689d2624dc4e2f0ea666efb5aa704215f7249ae6e047a7" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -1077,7 +1142,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -1173,7 +1238,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -1217,7 +1282,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -1269,21 +1334,30 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ - "const-oid 0.9.4", + "const-oid 0.9.5", "zeroize", ] [[package]] name = "der" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ - "const-oid 0.9.4", + "const-oid 0.9.5", "pem-rfc7468 0.7.0", "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +dependencies = [ + "serde", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1374,8 +1448,7 @@ dependencies = [ [[package]] name = "did-ethr" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d22b1adcd156bf1041f87f80cd027bf6f82a34849bada30d59b869e831df19d" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "chrono", @@ -1391,8 +1464,7 @@ dependencies = [ [[package]] name = "did-method-key" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543b322ff52ab4892f4fd30ceb8fa1007aca4e3c5e89ad55793036846f0cc74e" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "multibase 0.8.0", @@ -1407,8 +1479,7 @@ dependencies = [ [[package]] name = "did-onion" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e1ba10a5415931c5d436a6343bbd72673a42284a16d4acd501fbfb9d882db5" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "http", @@ -1421,12 +1492,11 @@ dependencies = [ [[package]] name = "did-pkh" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074c4ae82880d60a25048cd3bf2e8aaaa881922d7c73fbb9ec29fc67fa0d33e4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "bech32 0.8.1", - "bs58", + "bs58 0.4.0", "chrono", "iref", "serde", @@ -1441,12 +1511,11 @@ dependencies = [ [[package]] name = "did-tz" version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562670fedf756b20c047dcf4ef88d020c5c86c2115f954fb3aef072952015ba4" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "anyhow", "async-trait", - "bs58", + "bs58 0.4.0", "chrono", "json-patch", "reqwest", @@ -1462,8 +1531,7 @@ dependencies = [ [[package]] name = "did-web" version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e239187ee5cf6b778c75252ad22bb8289508dcaf05a7c718222a3093460ca0d2" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "http", @@ -1475,8 +1543,7 @@ dependencies = [ [[package]] name = "did-webkey" version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88fb811ef9b08a872eac80c1d1bcb0cabf4cd6a205d75971d8864f06ea2a9c2a" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "anyhow", "async-trait", @@ -1517,7 +1584,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid 0.9.4", + "const-oid 0.9.5", "crypto-common", "subtle", ] @@ -1542,11 +1609,11 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ - "der 0.7.7", + "der 0.7.8", "digest 0.10.7", "elliptic-curve 0.13.5", "rfc6979 0.4.0", @@ -1565,9 +1632,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ "pkcs8 0.10.2", "signature 2.1.0", @@ -1589,12 +1656,12 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.0.0-rc.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa8e9049d5d72bfc12acbc05914731b5322f79b5e2f195e9f2d705fca22ab4c" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.0.0-rc.3", - "ed25519 2.2.1", + "curve25519-dalek 4.1.1", + "ed25519 2.2.2", "serde", "sha2 0.10.7", "zeroize", @@ -1602,9 +1669,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -1633,7 +1700,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct 0.2.0", - "crypto-bigint 0.5.2", + "crypto-bigint 0.5.3", "digest 0.10.7", "ff 0.13.0", "generic-array 0.14.7", @@ -1649,18 +1716,18 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] [[package]] name = "errno" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -1991,6 +2058,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "ff" version = "0.12.1" @@ -2013,9 +2086,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" [[package]] name = "fixed-hash" @@ -2040,9 +2113,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -2144,7 +2217,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -2171,7 +2244,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -2265,9 +2338,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "gloo-timers" @@ -2317,9 +2390,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -2375,9 +2448,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -2427,9 +2500,9 @@ dependencies = [ [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -2439,9 +2512,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" @@ -2460,7 +2533,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -2803,9 +2876,9 @@ dependencies = [ [[package]] name = "json-number" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c724484d970b5aabe46934b9571980e255fd50a9ef1b13f23ed2b5c2a19bbb69" +checksum = "280f53da10842ffc42737ac8a6f2c14ced71f950de1cdb6765264a2eb1100cc5" dependencies = [ "lexical", "ryu-js", @@ -2826,9 +2899,9 @@ dependencies = [ [[package]] name = "json-syntax" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9043ed89d8285e64843df5e12696d5d14f1efc0642bdde62852239917fa7e1f" +checksum = "9f2f4557e0fe320cc102bdebf9fa9471b8513e13bb34b5fc23d7e270c5f9b1cc" dependencies = [ "contextual", "decoded-char", @@ -2881,7 +2954,7 @@ version = "0.2.0" dependencies = [ "async-trait", "base64 0.13.1", - "cacaos", + "cacaos 0.5.0", "did-ethr", "did-method-key", "did-onion", @@ -2891,14 +2964,14 @@ dependencies = [ "did-webkey", "iri-string", "lazy_static", - "libipld", + "libipld 0.16.0", "serde", + "serde_ipld_dagcbor", "serde_json", "serde_with 1.14.0", - "siwe-recap", + "siwe-recap 0.2.0", "ssi", "thiserror", - "uuid 1.4.1", ] [[package]] @@ -2911,11 +2984,13 @@ dependencies = [ "iri-string", "kepler-lib", "serde", + "serde_ipld_dagcbor", "serde_json", "serde_with 1.14.0", "thiserror", - "time 0.3.23", + "time", "tracing", + "uuid 1.4.1", ] [[package]] @@ -3017,9 +3092,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libipld" @@ -3030,17 +3105,33 @@ dependencies = [ "async-trait", "cached", "fnv", - "libipld-cbor", - "libipld-cbor-derive", - "libipld-core", - "libipld-json", - "libipld-macro", + "libipld-cbor 0.14.0", + "libipld-cbor-derive 0.14.0", + "libipld-core 0.14.0", + "libipld-macro 0.14.0", "log", - "multihash", + "multihash 0.16.3", "parking_lot 0.12.1", "thiserror", ] +[[package]] +name = "libipld" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1ccd6b8ffb3afee7081fcaec00e1b099fd1c7ccf35ba5729d88538fcc3b4599" +dependencies = [ + "fnv", + "libipld-cbor 0.16.0", + "libipld-cbor-derive 0.16.0", + "libipld-core 0.16.0", + "libipld-json", + "libipld-macro 0.16.0", + "log", + "multihash 0.18.1", + "thiserror", +] + [[package]] name = "libipld-cbor" version = "0.14.0" @@ -3048,7 +3139,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd1ab68c9d26f20c7d0dfea6eecbae8c00359875210001b33ca27d4a02f3d09" dependencies = [ "byteorder", - "libipld-core", + "libipld-core 0.14.0", + "thiserror", +] + +[[package]] +name = "libipld-cbor" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77d98c9d1747aa5eef1cf099cd648c3fd2d235249f5fed07522aaebc348e423b" +dependencies = [ + "byteorder", + "libipld-core 0.16.0", "thiserror", ] @@ -3065,6 +3167,19 @@ dependencies = [ "synstructure", ] +[[package]] +name = "libipld-cbor-derive" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5ba3a729b72973e456a1812b0afe2e176a376c1836cc1528e9fc98ae8cb838" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + [[package]] name = "libipld-core" version = "0.14.0" @@ -3072,22 +3187,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d44790246ec6b7314cba745992c23d479d018073e66d49ae40ae1b64e5dd8eb5" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", + "core2", + "multibase 0.9.1", + "multihash 0.16.3", + "thiserror", +] + +[[package]] +name = "libipld-core" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5acd707e8d8b092e967b2af978ed84709eaded82b75effe6cb6f6cc797ef8158" +dependencies = [ + "anyhow", + "cid 0.10.1", "core2", "multibase 0.9.1", - "multihash", + "multihash 0.18.1", "serde", "thiserror", ] [[package]] name = "libipld-json" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18aa481a87f084d98473dd9ece253a9569c762b75f6bbba8217d54e48c9d63b3" +checksum = "25856def940047b07b25c33d4e66d248597049ab0202085215dc4dca0487731c" dependencies = [ - "libipld-core", - "multihash", + "libipld-core 0.16.0", + "multihash 0.18.1", "serde", "serde_json", ] @@ -3098,7 +3227,16 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852c011562ae5059b67c3a917f9f5945af5a68df8e39ede4444fff33274d25e2" dependencies = [ - "libipld-core", + "libipld-core 0.14.0", +] + +[[package]] +name = "libipld-macro" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71171c54214f866ae6722f3027f81dff0931e600e5a61e6b1b6a49ca0b5ed4ae" +dependencies = [ + "libipld-core 0.16.0", ] [[package]] @@ -3113,6 +3251,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" + [[package]] name = "lock_api" version = "0.4.10" @@ -3125,9 +3269,9 @@ dependencies = [ [[package]] name = "locspan" -version = "0.7.13" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685e26b5a3e4266c351baf3c00793a097e40f4293270ac508b3f4cbc41e72e54" +checksum = "6eb541fabac50f90782ec4fafa7b0b3961adc0d1862c7c7a863dc94ed5541d73" dependencies = [ "contextual", "hashbrown 0.13.2", @@ -3147,9 +3291,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ "value-bag", ] @@ -3180,9 +3324,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "mime" @@ -3244,13 +3388,40 @@ dependencies = [ "data-encoding-macro", ] +[[package]] +name = "multidid" +version = "0.1.0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v3#92661420efc40f9d2b1345e6366d848f238828bd" +dependencies = [ + "bech32 0.9.1", + "bs58 0.5.0", + "hex", + "iri-string", + "serde", + "sha3", + "thiserror", + "unsigned-varint", +] + [[package]] name = "multihash" version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" dependencies = [ - "blake2b_simd 1.0.1", + "blake3", + "core2", + "multihash-derive", + "unsigned-varint", +] + +[[package]] +name = "multihash" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" +dependencies = [ + "blake2b_simd 1.0.2", "blake2s_simd", "blake3", "core2", @@ -3317,9 +3488,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -3355,6 +3526,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -3378,9 +3560,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm", @@ -3396,11 +3578,31 @@ dependencies = [ "libc", ] +[[package]] +name = "nutype" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "060a7fdadbae85c7063375e8fb9dd88c9ac336a22d1f0eb2fefd53dbf98edcb5" +dependencies = [ + "nutype_macros", +] + +[[package]] +name = "nutype_macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0d2e869a6039d8b1d10f8a478f76538958808fbf95dae367875ee9635430b9" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "object" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -3450,11 +3652,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags", + "bitflags 2.4.0", "cfg-if", "foreign-types", "libc", @@ -3471,7 +3673,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -3482,18 +3684,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.26.0+1.1.1u" +version = "300.1.5+3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37" +checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -3525,7 +3727,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", @@ -3537,7 +3739,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" dependencies = [ - "ecdsa 0.16.7", + "ecdsa 0.16.8", "elliptic-curve 0.13.5", "primeorder", "sha2 0.10.7", @@ -3545,9 +3747,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.4" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ "arrayvec 0.7.4", "bitvec 1.0.1", @@ -3559,9 +3761,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.4" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3687,12 +3889,12 @@ checksum = "b687ff7b5da449d39e418ad391e5e08da53ec334903ddbb921db208908fc372c" [[package]] name = "pgp" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a79d6411154d1a9908e7a2c4bac60a5742f6125823c2c30780c7039aef02f0" +checksum = "27e1f8e085bfa9b85763fe3ddaacbe90a09cd847b3833129153a6cb063bbe132" dependencies = [ "aes", - "base64 0.21.2", + "base64 0.21.4", "bitfield", "block-padding 0.3.3", "blowfish", @@ -3705,10 +3907,11 @@ dependencies = [ "chrono", "cipher", "crc24", + "curve25519-dalek 4.1.1", "derive_builder 0.12.0", "des", "digest 0.10.7", - "ed25519-dalek 2.0.0-rc.3", + "ed25519-dalek 2.0.0", "elliptic-curve 0.13.5", "flate2", "generic-array 0.14.7", @@ -3718,13 +3921,13 @@ dependencies = [ "md-5", "nom", "num-bigint-dig", - "num-derive", + "num-derive 0.4.0", "num-traits", "p256 0.13.2", "p384", "rand 0.8.5", "ripemd", - "rsa 0.9.0-pre.2", + "rsa 0.9.2", "sha1", "sha2 0.10.7", "sha3", @@ -3748,29 +3951,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -3795,7 +3998,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ - "der 0.7.7", + "der 0.7.8", "pkcs8 0.10.2", "spki 0.7.2", ] @@ -3827,7 +4030,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.7", + "der 0.7.8", "spki 0.7.2", ] @@ -3839,9 +4042,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" -version = "3.0.2" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "polling" @@ -3850,7 +4053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", @@ -3943,18 +4146,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -4067,7 +4270,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -4076,19 +4279,19 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.9.1" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.3", - "regex-syntax 0.7.4", + "regex-automata 0.3.8", + "regex-syntax 0.7.5", ] [[package]] @@ -4102,13 +4305,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.5", ] [[package]] @@ -4119,17 +4322,17 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -4265,12 +4468,12 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.0-pre.2" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65db0998ad35adcaca498b7358992e088ee16cc783fe6fb899da203e113a63e5" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" dependencies = [ "byteorder", - "const-oid 0.9.4", + "const-oid 0.9.5", "digest 0.10.7", "num-bigint-dig", "num-integer", @@ -4280,6 +4483,7 @@ dependencies = [ "pkcs8 0.10.2", "rand_core 0.6.4", "signature 2.1.0", + "spki 0.7.2", "subtle", "zeroize", ] @@ -4311,19 +4515,32 @@ version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "0.38.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys 0.4.7", "windows-sys", ] [[package]] name = "rustls" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -4337,14 +4554,14 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", ] [[package]] name = "rustls-webpki" -version = "0.101.1" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -4480,7 +4697,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", - "der 0.7.7", + "der 0.7.8", "generic-array 0.14.7", "pkcs8 0.10.2", "subtle", @@ -4489,11 +4706,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -4502,9 +4719,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -4527,9 +4744,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.173" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -4564,13 +4781,25 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.173" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", +] + +[[package]] +name = "serde_ipld_dagcbor" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e880e0b1f9c7a8db874642c1217f7e19b29e325f24ab9f0fcb11818adec7f01" +dependencies = [ + "cbor4ii", + "cid 0.10.1", + "scopeguard", + "serde", ] [[package]] @@ -4586,9 +4815,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.103" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -4631,7 +4860,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros 2.3.3", - "time 0.3.23", + "time", ] [[package]] @@ -4655,14 +4884,14 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -4795,7 +5024,7 @@ dependencies = [ "rand 0.8.5", "sha3", "thiserror", - "time 0.3.23", + "time", ] [[package]] @@ -4812,11 +5041,29 @@ dependencies = [ "thiserror", ] +[[package]] +name = "siwe-recap" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054c5aea5227ca44212d3029576602ebefce5179d584bdfcc842997c73cc40d9" +dependencies = [ + "base64 0.12.3", + "cid 0.10.1", + "iri-string", + "serde", + "serde_jcs", + "serde_json", + "serde_with 2.3.3", + "siwe", + "thiserror", + "ucan-capabilities-object", +] + [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -4832,9 +5079,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -4846,6 +5093,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "spin" version = "0.5.2" @@ -4879,7 +5136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.7", + "der 0.7.8", ] [[package]] @@ -4895,9 +5152,8 @@ dependencies = [ [[package]] name = "ssi" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a74add6dcfc3599495a73e953a7126ea19e9a0fc81860f5d593cabf1322cdf9" +version = "0.7.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "ssi-caips", "ssi-core", @@ -4907,7 +5163,7 @@ dependencies = [ "ssi-jwk", "ssi-jws", "ssi-jwt", - "ssi-ldp 0.2.1", + "ssi-ldp", "ssi-ssh", "ssi-tzkey", "ssi-ucan", @@ -4918,10 +5174,9 @@ dependencies = [ [[package]] name = "ssi-caips" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2c479690955bebece0279a5b1ab9d7d584402caed9f56ecec346d0bc63661f" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ - "bs58", + "bs58 0.4.0", "ssi-jwk", "thiserror", ] @@ -4929,14 +5184,12 @@ dependencies = [ [[package]] name = "ssi-contexts" version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3009b82cbae3d88a76f15460fb5fb3f30a1673eb0359ac6917ffaa3c57f7164" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" [[package]] name = "ssi-core" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e43f42016b80dc3e5eae8f7d2b22db3debbfe97b38e4fa449433497b3513048" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "serde", @@ -4946,10 +5199,9 @@ dependencies = [ [[package]] name = "ssi-crypto" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f41a12b15af9dce950a24a3295a2540be3b8500467621e31a97ddbe7618a5c8" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ - "bs58", + "bs58 0.4.0", "digest 0.9.0", "k256", "keccak-hash", @@ -4962,12 +5214,11 @@ dependencies = [ [[package]] name = "ssi-dids" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e3c375b0fb2129c691e65e776c9105290ade34b56f39755f4f9c40ba98e41c" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "anyhow", "async-trait", - "bs58", + "bs58 0.4.0", "chrono", "derive_builder 0.9.0", "hex", @@ -4989,8 +5240,7 @@ dependencies = [ [[package]] name = "ssi-json-ld" version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50912984a4f415dd419853d461938b2daaa428dcafb8a5dfcde8dc07371371da" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-std", "combination", @@ -5011,19 +5261,18 @@ dependencies = [ [[package]] name = "ssi-jwk" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3c376df0c00621f6d8de45249e901cf2b3868bef84cf785fbcbce62842d815" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "base64 0.12.3", "blake2b_simd 0.5.11", - "bs58", + "bs58 0.4.0", "ed25519-dalek 1.0.1", "getrandom 0.2.10", "k256", "lazy_static", "multibase 0.9.1", "num-bigint", - "num-derive", + "num-derive 0.3.3", "num-traits", "p256 0.11.1", "rand 0.7.3", @@ -5040,8 +5289,7 @@ dependencies = [ [[package]] name = "ssi-jws" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9e36ec8624a4f81f21b0e407f1c2209c2cd89c0ff3c27b928999682b2e8912" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "base64 0.12.3", "blake2", @@ -5062,8 +5310,7 @@ dependencies = [ [[package]] name = "ssi-jwt" version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46522391b37f4b749911bb29b3960a7e2e0b9936c7debf52035f431480b40123" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "chrono", "serde", @@ -5074,52 +5321,19 @@ dependencies = [ "thiserror", ] -[[package]] -name = "ssi-ldp" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de930bb18e3ed3c1f7b0a2b2b4fdba2887dffff34bb5f44b9967a983fea2d60c" -dependencies = [ - "async-trait", - "bs58", - "chrono", - "grdf", - "hex", - "iref", - "json-syntax", - "k256", - "lazy_static", - "locspan", - "multibase 0.8.0", - "rdf-types", - "serde", - "serde_jcs", - "serde_json", - "ssi-caips", - "ssi-contexts", - "ssi-core", - "ssi-crypto", - "ssi-dids", - "ssi-json-ld", - "ssi-jwk", - "ssi-jws", - "static-iref", - "thiserror", -] - [[package]] name = "ssi-ldp" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb057ad335a08d78deca3a7cf8f8393087ca99d64c038e97ff844ea66fbd475" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", - "bs58", + "bs58 0.4.0", "chrono", "grdf", "hex", "iref", "json-syntax", + "k256", "lazy_static", "locspan", "multibase 0.8.0", @@ -5143,8 +5357,7 @@ dependencies = [ [[package]] name = "ssi-ssh" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22967c7882e2457a2813badebf613a1b6ea3240f77ccac5c7c03858806d56618" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "sshkeys", "ssi-jwk", @@ -5154,10 +5367,9 @@ dependencies = [ [[package]] name = "ssi-tzkey" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b57d919e20d214253a9a8dbc5f3b08ff555364934d99a09c828becab27a823" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ - "bs58", + "bs58 0.4.0", "ed25519-dalek 1.0.1", "ssi-jwk", "ssi-jws", @@ -5166,14 +5378,14 @@ dependencies = [ [[package]] name = "ssi-ucan" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0982f62c7860922026a9d9edc6c604de79693ee4c5c6bd65be11e2ff66b1df09" +version = "0.2.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "base64 0.12.3", "chrono", - "libipld", + "libipld 0.16.0", "serde", + "serde_jcs", "serde_json", "serde_with 1.14.0", "ssi-caips", @@ -5183,42 +5395,41 @@ dependencies = [ "ssi-jws", "ssi-jwt", "thiserror", + "ucan-capabilities-object", ] [[package]] name = "ssi-vc" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7a9a9dc254d976962fea4501ed40097b8a7c23c15f076a7f46fa97ed886bc7" +version = "0.2.0" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "base64 0.12.3", "bitvec 0.20.4", - "cacaos", + "cacaos 0.5.1", "chrono", "flate2", "iref", - "libipld", - "multihash", + "libipld 0.14.0", + "multihash 0.16.3", "reqwest", "serde", "serde_json", - "siwe-recap", + "siwe-recap 0.1.0", "ssi-core", "ssi-dids", "ssi-json-ld", "ssi-jwk", "ssi-jws", "ssi-jwt", - "ssi-ldp 0.2.1", + "ssi-ldp", "thiserror", ] [[package]] name = "ssi-zcap-ld" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8380152589e8876e91bb765ce1b363909bc071788c1550bfdb730152c5b7afe" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-0.10#7c92ac58f5fd1cd2bc72fb0bc866949db33b9ab0" dependencies = [ "async-trait", "iref", @@ -5228,7 +5439,7 @@ dependencies = [ "ssi-dids", "ssi-json-ld", "ssi-jwk", - "ssi-ldp 0.3.0", + "ssi-ldp", "thiserror", ] @@ -5300,9 +5511,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.26" +version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ "proc-macro2", "quote", @@ -5335,36 +5546,35 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ - "autocfg", "cfg-if", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix", + "rustix 0.38.14", "windows-sys", ] [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -5379,21 +5589,11 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.23" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ + "deranged", "itoa", "serde", "time-core", @@ -5408,9 +5608,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] @@ -5441,11 +5641,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", @@ -5454,7 +5653,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.4", "tokio-macros", "windows-sys", ] @@ -5467,7 +5666,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -5504,9 +5703,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -5547,7 +5746,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-util", @@ -5593,7 +5792,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] [[package]] @@ -5671,9 +5870,21 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucan-capabilities-object" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f39597d86523b7f8028e7c05989fc64c1868f381e68ffc9c4b8540e5a891382" +dependencies = [ + "iri-string", + "nutype", + "serde", + "thiserror", +] [[package]] name = "uint" @@ -5695,9 +5906,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -5722,9 +5933,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsigned-varint" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" [[package]] name = "untrusted" @@ -5734,9 +5945,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -5781,6 +5992,16 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" +[[package]] +name = "varsig" +version = "0.1.0" +source = "git+https://github.com/spruceid/cacao-rs?branch=feat/cacao-v3#92661420efc40f9d2b1345e6366d848f238828bd" +dependencies = [ + "serde", + "thiserror", + "unsigned-varint", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -5801,9 +6022,9 @@ checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -5824,12 +6045,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -5857,7 +6072,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", "wasm-bindgen-shared", ] @@ -5891,7 +6106,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5927,24 +6142,11 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "winapi" @@ -5964,9 +6166,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -5997,9 +6199,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -6012,53 +6214,54 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys", ] [[package]] @@ -6097,12 +6300,13 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.1.1", "rand_core 0.6.4", + "serde", "zeroize", ] @@ -6123,5 +6327,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn 2.0.37", ] diff --git a/test/load/signer/src/main.rs b/test/load/signer/src/main.rs index ea27393b..5a5e48a1 100644 --- a/test/load/signer/src/main.rs +++ b/test/load/signer/src/main.rs @@ -4,10 +4,10 @@ use ethers::{ prelude::rand::{prelude::StdRng, SeedableRng}, signers::{LocalWallet, Signer}, }; -use kepler_lib::{cacaos::siwe::TimeStamp, resource::OrbitId, ssi::jwk::JWK}; +use kepler_lib::{cacaos::siwe::TimeStamp, resource::OrbitId, ssi::{jwk::JWK, ucan::capabilities::Capabilities}, authorization::HeaderEncode}; use kepler_sdk::{ authorization::{DelegationHeaders, InvocationHeaders}, - session::{complete_session_setup, prepare_session, Session, SessionConfig, SignedSession}, + session::{complete_session_setup, prepare_session, Session, SessionConfig, SignedSession, SIWESignature}, siwe_utils::{ generate_host_siwe_message, siwe_to_delegation_headers, HostConfig, SignedMessage, }, @@ -31,22 +31,14 @@ async fn new_user(wallet: LocalWallet, jwk: JWK) -> User { String::from("default"), ); + let mut actions = Capabilities::new(); + actions.with_actions_convert( + orbit_id.clone().to_resource(Some("kv".into()), None, None).to_string(), + ["put", "get", "del", "metadata", "list"].into_iter().map(|a| (format!("kv/{a}"), [])) + ).unwrap(); + let session_config = SessionConfig { - actions: [( - "kv".into(), - [( - "".into(), - vec![ - "put".into(), - "get".into(), - "del".into(), - "metadata".into(), - "list".into(), - ], - )] - .into(), - )] - .into(), + actions, address: wallet.address().into(), chain_id: 1, domain: "localhost".try_into().unwrap(), @@ -64,7 +56,7 @@ async fn new_user(wallet: LocalWallet, jwk: JWK) -> User { .unwrap(); let session = complete_session_setup(SignedSession { session: prepared_session, - signature: signature.to_vec().try_into().unwrap(), + signature: SIWESignature(signature.to_vec().try_into().unwrap()), }) .unwrap(); @@ -89,12 +81,10 @@ struct OrbitParams { async fn create_orbit( Path(id): Path, Json(params): Json, - Extension(jwk): Extension>, Extension(users): Extension>>>, ) -> Json { let reader = users.read().await; let user = reader.get(&id).unwrap(); - let message = generate_host_siwe_message(HostConfig { address: user.session_config.address, chain_id: user.session_config.chain_id, @@ -107,8 +97,8 @@ async fn create_orbit( let signature = user.wallet.sign_message(message.to_string()).await.unwrap(); let delegation = siwe_to_delegation_headers(SignedMessage { siwe: message, - signature: signature.to_vec().try_into().unwrap(), - }); + signature: SIWESignature(signature.to_vec().try_into().unwrap()), + }).unwrap(); Json(delegation) } @@ -143,6 +133,7 @@ async fn create_session( .clone(), ) } + async fn invoke_session( Path(id): Path, Json(params): Json, @@ -152,7 +143,6 @@ async fn invoke_session( users.read().await.get(&id).unwrap().session.clone(), vec![("kv".into(), params.name, params.action)] ) - .await .unwrap(); Json(headers) } From cde0b81a3b33f6717075dd7fb1446eae0b4966fe Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 16:15:53 +0200 Subject: [PATCH 19/24] fix orbit host check --- kepler-core/src/db.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index 88f3f892..6bb8e52f 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -419,7 +419,7 @@ pub(crate) async fn transact( .map(|e| (e.hash(), e)) .collect::>(); let event_orbits = event_orbits(db, &event_hashes).await?; - let host = Ability::new("kepler/host").unwrap(); + let host = Ability::new("orbit/host").unwrap(); let mut new_orbits = event_hashes .iter() .filter_map(|(_, e)| match e { From f0e7dca7b83d808c0c25fafcedc009ee5fb839d9 Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 16:41:51 +0200 Subject: [PATCH 20/24] fix supported action check --- kepler-core/src/models/mod.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index 560f7087..a12ff7c4 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -151,7 +151,8 @@ fn take_unauthorized<'a>( granted: HashMap, BTreeMap>, ) -> impl Iterator, HashSet<&'a Ability>)> { actioned.filter_map(move |(r, a)| { - a.keys() + let unsupported = a + .keys() .filter(|ab| { // get unsupported abilities !granted @@ -161,9 +162,12 @@ fn take_unauthorized<'a>( // and the ability is not supported .any(|ga| ga.contains_key(ab.as_ref())) }) - .map(Some) - .collect::>>() - .map(|ab| (r, ab)) + .collect::>(); + if unsupported.is_empty() { + None + } else { + Some((r, unsupported)) + } }) } From 8d509613982b65696cabf88f65bda9721d2bcd09 Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 17:17:06 +0200 Subject: [PATCH 21/24] remove obsolete test --- src/authorization.rs | 72 -------------------------------------------- 1 file changed, 72 deletions(-) diff --git a/src/authorization.rs b/src/authorization.rs index 3058fdc2..ce64497f 100644 --- a/src/authorization.rs +++ b/src/authorization.rs @@ -31,75 +31,3 @@ impl_fromreq!(Delegation, "Authorization"); // currently delegations and invocations are really the same type // impl_fromreq!(Invocation, "Authorization"); impl_fromreq!(Revocation, "Authorization"); - -#[cfg(test)] -mod test { - use kepler_lib::{ - libipld::cid::Cid, - resolver::DID_METHODS, - ssi::{ - did::{Document, Source}, - did_resolve::DIDResolver, - jwk::{Algorithm, JWK}, - jws::Header, - ucan::{Capability, Payload}, - vc::NumericDate, - }, - }; - - async fn gen( - iss: &JWK, - aud: String, - caps: Vec, - exp: f64, - prf: Vec, - ) -> (Document, Thing) { - let did = DID_METHODS - .generate(&Source::KeyAndPattern(iss, "key")) - .unwrap(); - ( - DID_METHODS - .resolve(&did, &Default::default()) - .await - .1 - .unwrap(), - gen_ucan((iss, did), aud, caps, exp, prf).await, - ) - } - async fn gen_ucan( - iss: (&JWK, String), - audience: String, - attenuation: Vec, - exp: f64, - proof: Vec, - ) -> Thing { - let p = Payload { - issuer: iss.1, - audience, - attenuation, - proof, - nonce: None, - not_before: None, - facts: None, - expiration: NumericDate::try_from_seconds(exp).unwrap(), - } - .sign(Algorithm::EdDSA, iss.0) - .unwrap(); - Thing { - token: p.encode().unwrap(), - payload: p.payload, - header: p.header, - } - } - - #[derive(serde::Serialize)] - struct Thing { - pub token: String, - pub payload: Payload, - pub header: Header, - } - #[test] - async fn basic() -> anyhow::Result<()> { - Ok(()) - } -} From 7de499e94fdd9130962d9778f4e43006daf8e94f Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 18:12:50 +0200 Subject: [PATCH 22/24] fix ci failures --- lib/src/authorization.rs | 4 +++- sdk-wasm/src/lib.rs | 3 +-- sdk/src/session.rs | 12 +++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/src/authorization.rs b/lib/src/authorization.rs index 79a1e415..641fc55f 100644 --- a/lib/src/authorization.rs +++ b/lib/src/authorization.rs @@ -16,10 +16,12 @@ pub trait HeaderEncode { Self: Sized; } +pub type ResourceIter = Map::Item) -> O>; + pub trait Resources<'a, RO: 'a = &'a UriStr, NB: 'a = serde_json::Value> { type Iter: Iterator>)>; fn grants(&'a self) -> Self::Iter; - fn resources(&'a self) -> Map::Item) -> RO> { + fn resources(&'a self) -> ResourceIter { self.grants().map(|(r, _)| r) } } diff --git a/sdk-wasm/src/lib.rs b/sdk-wasm/src/lib.rs index 064c7c23..b142a32b 100644 --- a/sdk-wasm/src/lib.rs +++ b/sdk-wasm/src/lib.rs @@ -75,7 +75,6 @@ pub fn invoke(session: String, service: String, path: String, action: String) -> serde_json::from_str(&session).map_err(authorization::Error::JSONDeserializing)?, vec![(service, path, action)], ) - .await .and_then(|headers| { serde_json::to_string(&headers).map_err(authorization::Error::JSONSerializing) }) @@ -99,7 +98,7 @@ pub fn siweToDelegationHeaders(signedSIWEMessage: String) -> Result Session { let config = json!({ - "actions": { "kv": { "path": vec!["put", "get", "list", "del", "metadata"] }, - "capabilities": { "": vec!["read"] }}, + "actions": { + "kepler:pkh:eip155:1:0x7BD63AA37326a64d458559F44432103e3d6eEDE9://default/kv/path": { + "kv/put": [{}], + "kv/get": [{}], + "kv/list": [{}], + "kv/del": [{}], + "kv/metadata": [{}], + }, + }, "address": "0x7BD63AA37326a64d458559F44432103e3d6eEDE9", "chainId": 1u8, "domain": "example.com", @@ -247,7 +254,6 @@ pub mod test { test_session() .await .invoke(vec![("kv".into(), "path".into(), "get".into())]) - .await .expect("failed to create invocation"); } } From bf0855cd77d6070e47e9725892e7845dff049d08 Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 19:09:22 +0200 Subject: [PATCH 23/24] clippy --- kepler-core/src/db.rs | 6 ++++-- kepler-core/src/models/delegation.rs | 19 ++++++++----------- kepler-core/src/models/invocation.rs | 7 +++---- kepler-core/src/models/mod.rs | 6 +++--- kepler-core/src/types/resource.rs | 2 +- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/kepler-core/src/db.rs b/kepler-core/src/db.rs index 6bb8e52f..5c7cfed8 100644 --- a/kepler-core/src/db.rs +++ b/kepler-core/src/db.rs @@ -589,7 +589,9 @@ pub(crate) async fn transact( for (hash, event) in event_hashes { match event { - Event::Delegation(d) => delegation::process(db, *d).await.map_err(|e| e.to_del())?, + Event::Delegation(d) => delegation::process(db, *d) + .await + .map_err(|e| e.into_del())?, Event::Invocation(i, ops) => invocation::process( db, *i, @@ -604,7 +606,7 @@ pub(crate) async fn transact( .collect(), ) .await - .map_err(|e| e.to_inv())?, + .map_err(|e| e.into_inv())?, Event::Revocation(r) => revocation::process(db, *r).await?, }; } diff --git a/kepler-core/src/models/delegation.rs b/kepler-core/src/models/delegation.rs index b1f28752..6e3c9e16 100644 --- a/kepler-core/src/models/delegation.rs +++ b/kepler-core/src/models/delegation.rs @@ -202,17 +202,14 @@ async fn save( // save abilities if !delegation.capabilities().is_empty() { let abilities = Resources::<'_, AnyResource>::grants(&delegation) - .map(|(resource, abilities)| { - abilities - .into_iter() - .map(move |(ability, c)| abilities::Model { - delegation: hash, - resource: resource.clone().into(), - ability: ability.clone().into(), - caveats: c.clone().into(), - }) + .flat_map(|(resource, abilities)| { + abilities.iter().map(move |(ability, c)| abilities::Model { + delegation: hash, + resource: resource.clone().into(), + ability: ability.clone().into(), + caveats: c.clone().into(), + }) }) - .flatten() .map(abilities::ActiveModel::from) .collect::>(); abilities::Entity::insert_many(abilities).exec(db).await?; @@ -220,7 +217,7 @@ async fn save( // save parent relationships if let Some(prf) = delegation.proof().filter(|p| !p.is_empty()) { - parent_delegations::Entity::insert_many(prf.into_iter().map(|p| { + parent_delegations::Entity::insert_many(prf.iter().map(|p| { parent_delegations::ActiveModel::from(parent_delegations::Model { child: hash, parent: (*p).into(), diff --git a/kepler-core/src/models/invocation.rs b/kepler-core/src/models/invocation.rs index a4f73b5d..0079405a 100644 --- a/kepler-core/src/models/invocation.rs +++ b/kepler-core/src/models/invocation.rs @@ -98,8 +98,8 @@ async fn save( // save invoked abilities if !invocation.capabilities().is_empty() { let invoked = Resources::<'_, AnyResource>::grants(&invocation) - .map(|(resource, actions)| { - actions.into_iter().map(move |(action, _)| { + .flat_map(|(resource, actions)| { + actions.iter().map(move |(action, _)| { invoked_abilities::ActiveModel::from(invoked_abilities::Model { invocation: hash, resource: resource.clone().into(), @@ -107,7 +107,6 @@ async fn save( }) }) }) - .flatten() .collect::>(); invoked_abilities::Entity::insert_many(invoked) .exec(db) @@ -116,7 +115,7 @@ async fn save( // save parent relationships if let Some(prf) = invocation.proof().filter(|p| !p.is_empty()) { - parent_delegations::Entity::insert_many(prf.into_iter().map(|p| { + parent_delegations::Entity::insert_many(prf.iter().map(|p| { parent_delegations::ActiveModel::from(parent_delegations::Model { child: hash, parent: (*p).into(), diff --git a/kepler-core/src/models/mod.rs b/kepler-core/src/models/mod.rs index a12ff7c4..190aa352 100644 --- a/kepler-core/src/models/mod.rs +++ b/kepler-core/src/models/mod.rs @@ -40,7 +40,7 @@ pub enum EventProcessingError { } impl EventProcessingError { - pub(crate) fn to_del(self) -> TxError { + pub(crate) fn into_del(self) -> TxError { match self { EventProcessingError::Db(e) => TxError::Db(e), EventProcessingError::InvalidMessage(e) => TxError::InvalidDelegation(e), @@ -50,7 +50,7 @@ impl EventProcessingError { } } } - pub(crate) fn to_inv(self) -> TxError { + pub(crate) fn into_inv(self) -> TxError { match self { EventProcessingError::Db(e) => TxError::Db(e), EventProcessingError::InvalidMessage(e) => TxError::InvalidInvocation(e), @@ -202,7 +202,7 @@ async fn get_granted( .await? .into_iter() // valid issuer - .filter(|p| &p.delegatee == &issuer) + .filter(|p| p.delegatee == issuer) // valid time bounds .filter(|p| p.validate_bounds(nbf, exp)) // extra check diff --git a/kepler-core/src/types/resource.rs b/kepler-core/src/types/resource.rs index 03714791..c8fa837c 100644 --- a/kepler-core/src/types/resource.rs +++ b/kepler-core/src/types/resource.rs @@ -51,7 +51,7 @@ impl From<&UriStr> for Resource { impl From> for Resource { fn from(id: AnyResource) -> Self { - Resource(id.into()) + Resource(id) } } From 43f9b44572444f06da17d754bcb488f8432b4655 Mon Sep 17 00:00:00 2001 From: chunningham Date: Fri, 22 Sep 2023 19:10:03 +0200 Subject: [PATCH 24/24] more clippy --- sdk/src/session.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/src/session.rs b/sdk/src/session.rs index 3e54881a..69ca55df 100644 --- a/sdk/src/session.rs +++ b/sdk/src/session.rs @@ -181,7 +181,7 @@ pub fn complete_session_setup(signed_session: SignedSession) -> Result