diff --git a/Cargo.lock b/Cargo.lock index 811857deca..982ccfe8f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -196,6 +196,41 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "agency_client" version = "0.61.0" @@ -320,6 +355,42 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + +[[package]] +name = "argon2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ba4cac0a46bc1d2912652a751c47f2a9f3a7fe89bcae2275d418f5270402f9" +dependencies = [ + "base64ct", + "blake2", + "cpufeatures", + "password-hash", +] + +[[package]] +name = "aries-askar" +version = "0.3.0" +source = "git+https://github.com/hyperledger/aries-askar.git?tag=v0.3.0#6543d01da953203482277271c0b31cb50260c740" +dependencies = [ + "askar-crypto", + "askar-storage", + "async-lock 3.1.0", + "env_logger 0.10.0", + "ffi-support", + "log", + "once_cell", + "serde", + "serde_cbor", + "serde_json", + "zeroize", +] + [[package]] name = "aries-vcx-agent" version = "0.61.0" @@ -381,7 +452,9 @@ name = "aries_vcx_core" version = "0.1.0" dependencies = [ "agency_client", + "aries-askar", "async-trait", + "bs58 0.5.0", "derive_builder", "futures", "indy-api-types", @@ -447,6 +520,74 @@ dependencies = [ "toml 0.5.11", ] +[[package]] +name = "askar-crypto" +version = "0.3.0" +source = "git+https://github.com/hyperledger/aries-askar.git?tag=v0.3.0#6543d01da953203482277271c0b31cb50260c740" +dependencies = [ + "aead", + "aes", + "aes-gcm", + "argon2", + "base64", + "blake2", + "block-modes", + "bls12_381", + "cbc", + "chacha20", + "chacha20poly1305", + "cipher", + "crypto_box", + "curve25519-dalek", + "digest", + "ed25519-dalek", + "elliptic-curve", + "group", + "hkdf", + "hmac", + "k256", + "p256", + "p384", + "rand 0.8.5", + "serde", + "serde-json-core", + "sha2", + "subtle", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "askar-storage" +version = "0.1.0" +source = "git+https://github.com/hyperledger/aries-askar.git?tag=v0.3.0#6543d01da953203482277271c0b31cb50260c740" +dependencies = [ + "arc-swap", + "askar-crypto", + "async-lock 3.1.0", + "async-stream", + "bs58 0.5.0", + "chrono", + "digest", + "futures-lite 2.0.0", + "hex", + "hmac", + "itertools 0.11.0", + "log", + "once_cell", + "percent-encoding", + "rmp-serde", + "serde", + "serde_cbor", + "serde_json", + "sha2", + "sqlx", + "tokio", + "url", + "uuid 1.5.0", + "zeroize", +] + [[package]] name = "async-attributes" version = "1.1.2" @@ -464,7 +605,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -474,11 +615,11 @@ version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c1da3ae8dabd9c00f453a329dfe1fb28da3c0a72e2478cdcd93171740c20499" dependencies = [ - "async-lock", + "async-lock 2.8.0", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite", + "futures-lite 1.13.0", "slab", ] @@ -491,9 +632,9 @@ dependencies = [ "async-channel", "async-executor", "async-io", - "async-lock", + "async-lock 2.8.0", "blocking", - "futures-lite", + "futures-lite 1.13.0", "once_cell", ] @@ -503,11 +644,11 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", "cfg-if", "concurrent-queue", - "futures-lite", + "futures-lite 1.13.0", "log", "parking", "polling", @@ -523,7 +664,18 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener", + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +dependencies = [ + "event-listener 3.1.0", + "event-listener-strategy", + "pin-project-lite", ] [[package]] @@ -536,12 +688,12 @@ dependencies = [ "async-channel", "async-global-executor", "async-io", - "async-lock", + "async-lock 2.8.0", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "gloo-timers", "kv-log-macro", "log", @@ -706,6 +858,12 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.21.4" @@ -751,6 +909,15 @@ dependencies = [ "serde", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -760,6 +927,21 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-modes" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2211b0817f061502a8dd9f11a37e879e79763e3c698d2418cf824d8cb2f21e" + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + [[package]] name = "blocking" version = "1.4.1" @@ -767,15 +949,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" dependencies = [ "async-channel", - "async-lock", + "async-lock 2.8.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "piper", "tracing", ] +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "group", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "brotli" version = "3.4.0" @@ -871,6 +1066,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + [[package]] name = "cc" version = "1.0.83" @@ -887,6 +1091,30 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.31" @@ -902,6 +1130,17 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + [[package]] name = "clap" version = "3.2.25" @@ -1130,6 +1369,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "crypto-bigint" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28f85c3514d2a6e64160359b45a3918c3b4178bcbf4ae5d03ab2d02e521c479a" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1137,9 +1388,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "crypto_box" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16182b4f39a82ec8a6851155cc4c0cda3065bb1db33651726a29e1951de0f009" +dependencies = [ + "aead", + "crypto_secretbox", + "curve25519-dalek", + "salsa20", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto_secretbox" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d6cf87adf719ddf43a805e92c6870a531aedda35ff640442cbaf8674e141e1" +dependencies = [ + "aead", + "cipher", + "generic-array", + "poly1305", + "salsa20", + "subtle", + "zeroize", +] + [[package]] name = "ctor" version = "0.2.5" @@ -1150,6 +1431,15 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "cursive" version = "0.20.0" @@ -1611,6 +1901,19 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", +] + [[package]] name = "ed25519" version = "2.2.2" @@ -1647,6 +1950,25 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562cc8504a01eb20c10fb154abd7c4baeb9beba2329cf85838ee2bd48a468b18" +[[package]] +name = "elliptic-curve" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "encoding_rs" version = "0.8.33" @@ -1780,6 +2102,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" +dependencies = [ + "event-listener 3.1.0", + "pin-project-lite", +] + [[package]] name = "failure" version = "0.1.8" @@ -1823,6 +2166,16 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "ffi-support" version = "0.4.4" @@ -1992,6 +2345,21 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c1155db57329dca6d018b61e76b1488ce9a2e5e44028cac420a5898f4fcef63" +dependencies = [ + "fastrand 2.0.1", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -2041,6 +2409,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -2067,6 +2436,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gimli" version = "0.28.0" @@ -2116,6 +2495,17 @@ dependencies = [ "scroll", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" version = "0.3.21" @@ -2135,6 +2525,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.12.3" @@ -2551,6 +2947,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] + [[package]] name = "instant" version = "0.1.12" @@ -2645,6 +3051,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha2", +] + [[package]] name = "keccak" version = "0.1.4" @@ -3296,6 +3714,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openssl" version = "0.10.57" @@ -3361,6 +3785,30 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "parking" version = "2.1.1" @@ -3390,6 +3838,17 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "paste" version = "1.0.14" @@ -3537,6 +3996,29 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -3573,6 +4055,15 @@ dependencies = [ "termtree", ] +[[package]] +name = "primeorder" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7dbe9ed3b56368bd99483eb32fe9c17fdd3730aebadc906918ce78d54c7eeb4" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3795,6 +4286,16 @@ dependencies = [ "winreg", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.16.20" @@ -3938,6 +4439,15 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + [[package]] name = "schannel" version = "0.1.22" @@ -3983,6 +4493,19 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "2.9.2" @@ -4024,6 +4547,26 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-json-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9e1ab533c0bc414c34920ec7e5f097101d126ed5eac1a1aac711222e0bbb33" +dependencies = [ + "ryu", + "serde", +] + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.189" @@ -4314,11 +4857,12 @@ dependencies = [ "atoi", "byteorder", "bytes", + "chrono", "crc", "crossbeam-queue", "dotenvy", "either", - "event-listener", + "event-listener 2.5.3", "futures-channel", "futures-core", "futures-intrusive", @@ -4378,6 +4922,7 @@ dependencies = [ "sha2", "sqlx-core", "sqlx-mysql", + "sqlx-postgres", "sqlx-sqlite", "syn 1.0.109", "tempfile", @@ -4396,6 +4941,7 @@ dependencies = [ "bitflags 2.4.0", "byteorder", "bytes", + "chrono", "crc", "digest", "dotenvy", @@ -4437,6 +4983,7 @@ dependencies = [ "base64", "bitflags 2.4.0", "byteorder", + "chrono", "crc", "dotenvy", "etcetera", @@ -4473,6 +5020,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f" dependencies = [ "atoi", + "chrono", "flume", "futures-channel", "futures-core", @@ -5183,6 +5731,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "unsigned-varint" version = "0.7.2" diff --git a/aries_vcx/src/errors/error.rs b/aries_vcx/src/errors/error.rs index fb6dc35da4..9eb75e7033 100644 --- a/aries_vcx/src/errors/error.rs +++ b/aries_vcx/src/errors/error.rs @@ -124,6 +124,25 @@ pub enum AriesVcxErrorKind { #[error("Attempted to add a DID to wallet when that DID already exists in wallet")] DuplicationDid, + #[error("An unexpected error from the store backend")] + AskarBackend, + #[error("The store backend was too busy to handle the request")] + AskarBusy, + #[error("A custom error type for external integrations")] + AskarCustom, + #[error("An insert operation failed due to a unique key conflict")] + AskarDuplicate, + #[error("An encryption or decryption operation failed")] + AskarEncryption, + #[error("The input parameters to the method were incorrect")] + AskarInput, + #[error("The requested record was not found")] + AskarNotFound, + #[error("An unexpected error occurred")] + AskarUnexpected, + #[error("An unsupported operation was requested")] + AskarUnsupported, + // Logger #[error("Logging Error")] LoggingError, diff --git a/aries_vcx/src/errors/mapping_others.rs b/aries_vcx/src/errors/mapping_others.rs index e680391d7e..b551a9eceb 100644 --- a/aries_vcx/src/errors/mapping_others.rs +++ b/aries_vcx/src/errors/mapping_others.rs @@ -109,6 +109,15 @@ impl From for AriesVcxError { AriesVcxErrorKind::DuplicationMasterSecret } AriesVcxCoreErrorKind::DuplicationDid => AriesVcxErrorKind::DuplicationDid, + AriesVcxCoreErrorKind::AskarBackend => AriesVcxErrorKind::AskarBackend, + AriesVcxCoreErrorKind::AskarBusy => AriesVcxErrorKind::AskarBusy, + AriesVcxCoreErrorKind::AskarCustom => AriesVcxErrorKind::AskarCustom, + AriesVcxCoreErrorKind::AskarDuplicate => AriesVcxErrorKind::AskarDuplicate, + AriesVcxCoreErrorKind::AskarEncryption => AriesVcxErrorKind::AskarEncryption, + AriesVcxCoreErrorKind::AskarInput => AriesVcxErrorKind::AskarInput, + AriesVcxCoreErrorKind::AskarNotFound => AriesVcxErrorKind::AskarNotFound, + AriesVcxCoreErrorKind::AskarUnexpected => AriesVcxErrorKind::AskarUnexpected, + AriesVcxCoreErrorKind::AskarUnsupported => AriesVcxErrorKind::AskarUnsupported, AriesVcxCoreErrorKind::LoggingError => AriesVcxErrorKind::LoggingError, AriesVcxCoreErrorKind::EncodeError => AriesVcxErrorKind::EncodeError, AriesVcxCoreErrorKind::UnknownError => AriesVcxErrorKind::UnknownError, @@ -206,6 +215,17 @@ impl From for AriesVcxCoreError { AriesVcxCoreErrorKind::DuplicationMasterSecret } AriesVcxErrorKind::DuplicationDid => AriesVcxCoreErrorKind::DuplicationDid, + + AriesVcxErrorKind::AskarBackend => AriesVcxCoreErrorKind::AskarBackend, + AriesVcxErrorKind::AskarBusy => AriesVcxCoreErrorKind::AskarBusy, + AriesVcxErrorKind::AskarCustom => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::AskarDuplicate => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::AskarEncryption => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::AskarInput => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::AskarNotFound => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::AskarUnexpected => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::AskarUnsupported => AriesVcxCoreErrorKind::ActionNotSupported, + AriesVcxErrorKind::LoggingError => AriesVcxCoreErrorKind::LoggingError, AriesVcxErrorKind::EncodeError => AriesVcxCoreErrorKind::EncodeError, AriesVcxErrorKind::UnknownError => AriesVcxCoreErrorKind::UnknownError, diff --git a/aries_vcx_core/Cargo.toml b/aries_vcx_core/Cargo.toml index b121fef3a6..b0f2ae0749 100644 --- a/aries_vcx_core/Cargo.toml +++ b/aries_vcx_core/Cargo.toml @@ -11,9 +11,12 @@ credx = ["dep:indy-credx"] vdr_proxy_ledger = ["credx", "dep:indy-vdr-proxy-client"] # Feature flag to allow legacy proof verification legacy_proof = [] +askar_tests = [] [dependencies] agency_client = { path = "../agency_client" } +aries-askar = { git = "https://github.com/hyperledger/aries-askar.git", tag = "v0.3.0" } +bs58 = { version = "0.5" } indy-vdr = { git = "https://github.com/hyperledger/indy-vdr.git", rev = "c143268", default-features = false, features = ["log"] } indy-credx = { git = "https://github.com/hyperledger/indy-shared-rs", tag = "v1.1.0", optional = true } libvdrtools = { path = "../libvdrtools", optional = true } diff --git a/aries_vcx_core/src/errors/error.rs b/aries_vcx_core/src/errors/error.rs index 340777557d..96506bf3a2 100644 --- a/aries_vcx_core/src/errors/error.rs +++ b/aries_vcx_core/src/errors/error.rs @@ -124,6 +124,25 @@ pub enum AriesVcxCoreErrorKind { #[error("Attempted to add a DID to wallet when that DID already exists in wallet")] DuplicationDid, + #[error("An unexpected error from the store backend")] + AskarBackend, + #[error("The store backend was too busy to handle the request")] + AskarBusy, + #[error("A custom error type for external integrations")] + AskarCustom, + #[error("An insert operation failed due to a unique key conflict")] + AskarDuplicate, + #[error("An encryption or decryption operation failed")] + AskarEncryption, + #[error("The input parameters to the method were incorrect")] + AskarInput, + #[error("The requested record was not found")] + AskarNotFound, + #[error("An unexpected error occurred")] + AskarUnexpected, + #[error("An unsupported operation was requested")] + AskarUnsupported, + // Logger #[error("Logging Error")] LoggingError, diff --git a/aries_vcx_core/src/errors/mapping_askar.rs b/aries_vcx_core/src/errors/mapping_askar.rs new file mode 100644 index 0000000000..e5b467a6ca --- /dev/null +++ b/aries_vcx_core/src/errors/mapping_askar.rs @@ -0,0 +1,33 @@ +use aries_askar::ErrorKind; + +use super::error::{AriesVcxCoreError, AriesVcxCoreErrorKind}; + +impl From for AriesVcxCoreError { + fn from(err: aries_askar::Error) -> Self { + match err.kind() { + ErrorKind::Backend => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarBackend, err) + } + ErrorKind::Busy => AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarBusy, err), + ErrorKind::Custom => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarCustom, err) + } + ErrorKind::Duplicate => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarDuplicate, err) + } + ErrorKind::Encryption => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarEncryption, err) + } + ErrorKind::Input => AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarInput, err), + ErrorKind::NotFound => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarNotFound, err) + } + ErrorKind::Unexpected => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarUnexpected, err) + } + ErrorKind::Unsupported => { + AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::AskarUnsupported, err) + } + } + } +} diff --git a/aries_vcx_core/src/errors/mod.rs b/aries_vcx_core/src/errors/mod.rs index 841ab45fe2..ab4c61d23e 100644 --- a/aries_vcx_core/src/errors/mod.rs +++ b/aries_vcx_core/src/errors/mod.rs @@ -1,5 +1,6 @@ pub mod error; mod mapping_agency_client; +mod mapping_askar; #[cfg(feature = "credx")] mod mapping_credx; #[cfg(feature = "vdrtools_wallet")] diff --git a/aries_vcx_core/src/wallet/askar/askar_wallet.rs b/aries_vcx_core/src/wallet/askar/askar_wallet.rs new file mode 100644 index 0000000000..7fede09469 --- /dev/null +++ b/aries_vcx_core/src/wallet/askar/askar_wallet.rs @@ -0,0 +1,288 @@ +use std::collections::HashMap; + +use aries_askar::{ + entry::EntryTag, + kms::{KeyAlg, KeyEntry, LocalKey}, + PassKey, Session, Store, StoreKeyMethod, +}; +use async_trait::async_trait; + +use super::rng_method::RngMethod; +#[cfg(feature = "vdrtools_wallet")] +use crate::WalletHandle; +use crate::{ + errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind, VcxCoreResult}, + utils::async_fn_iterator::AsyncFnIterator, + wallet::{base_wallet::BaseWallet, structs_io::UnpackMessageOutput}, +}; + +#[derive(Debug)] +pub struct AskarWallet { + pub backend: Store, + profile: Option, +} + +impl AskarWallet { + pub async fn create( + db_url: &str, + key_method: StoreKeyMethod, + pass_key: PassKey<'_>, + recreate: bool, + profile: Option, + ) -> Result { + let backend = + Store::provision(db_url, key_method, pass_key, profile.clone(), recreate).await?; + + Ok(Self { backend, profile }) + } + + pub async fn open( + db_url: &str, + key_method: Option, + pass_key: PassKey<'_>, + profile: Option, + ) -> Result { + let backend = Store::open(db_url, key_method, pass_key, profile.clone()).await?; + + Ok(Self { backend, profile }) + } + + pub async fn create_key( + &self, + name: &str, + alg: KeyAlg, + seed: &str, + rng_method: RngMethod, + metadata: Option<&str>, + tags: Option<&[EntryTag]>, + ) -> Result<(), AriesVcxCoreError> { + let mut session = self.backend.session(self.profile.clone()).await?; + + let key = LocalKey::from_seed(alg, seed.as_bytes(), rng_method.into())?; + Ok(session.insert_key(name, &key, metadata, tags, None).await?) + } + + pub async fn create_did( + &self, + key_name: &str, + ) -> Result<(), AriesVcxCoreError> { + let mut session = self.backend.session(self.profile.clone()).await?; + + let key_entry = self.fetch_key_entry(&mut session, key_name).await?; + + let local_key = key_entry.load_local_key()?; + + let did_bytes = &local_key.to_public_bytes()?[0..16]; + + let did = bs58::encode(did_bytes).into_string(); + Ok(session + .insert("aries-did", &did, &did_bytes, None, None) + .await?) + } + + async fn fetch_key_entry( + &self, + session: &mut Session, + key_name: &str, + ) -> Result { + session.fetch_key(key_name, false).await?.ok_or_else(|| { + AriesVcxCoreError::from_msg( + AriesVcxCoreErrorKind::WalletRecordNotFound, + format!("no key with name '{}' found in wallet", key_name), + ) + }) + } +} + +#[async_trait] +impl BaseWallet for AskarWallet { + #[cfg(feature = "vdrtools_wallet")] + fn get_wallet_handle(&self) -> WalletHandle { + todo!("Not yet implemented"); + } + + // ----- DIDs + async fn create_and_store_my_did( + &self, + seed: Option<&str>, + kdf_method_name: Option<&str>, + ) -> VcxCoreResult<(String, String)> { + todo!("Not yet implemented"); + } + + async fn key_for_local_did(&self, did: &str) -> VcxCoreResult { + todo!("Not yet implemented"); + } + + // returns new temp_verkey and remembers it internally + async fn replace_did_keys_start(&self, target_did: &str) -> VcxCoreResult { + todo!("Not yet implemented"); + } + + // replaces the `target_did`'s current verkey with the one last generated by + // `replace_did_keys_start` + async fn replace_did_keys_apply(&self, target_did: &str) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + // ---- records + + async fn add_wallet_record( + &self, + xtype: &str, + id: &str, + value: &str, + tags: Option>, + ) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + async fn get_wallet_record( + &self, + xtype: &str, + id: &str, + options: &str, + ) -> VcxCoreResult { + todo!("Not yet implemented"); + } + + async fn get_wallet_record_value(&self, xtype: &str, id: &str) -> VcxCoreResult { + todo!("Not yet implemented"); + } + + async fn delete_wallet_record(&self, xtype: &str, id: &str) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + async fn update_wallet_record_value( + &self, + xtype: &str, + id: &str, + value: &str, + ) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + async fn add_wallet_record_tags( + &self, + xtype: &str, + id: &str, + tags: HashMap, + ) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + async fn update_wallet_record_tags( + &self, + xtype: &str, + id: &str, + tags: HashMap, + ) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + async fn delete_wallet_record_tags( + &self, + xtype: &str, + id: &str, + tag_names: &str, + ) -> VcxCoreResult<()> { + todo!("Not yet implemented"); + } + + async fn iterate_wallet_records( + &self, + xtype: &str, + query: &str, + options: &str, + ) -> VcxCoreResult>>> { + todo!("Not yet implemented"); + } + + // ---- crypto + + async fn sign(&self, my_vk: &str, msg: &[u8]) -> VcxCoreResult> { + todo!("Not yet implemented"); + } + + async fn verify(&self, vk: &str, msg: &[u8], signature: &[u8]) -> VcxCoreResult { + todo!("Not yet implemented"); + } + + async fn pack_message( + &self, + sender_vk: Option<&str>, + receiver_keys: &str, + msg: &[u8], + ) -> VcxCoreResult> { + todo!("Not yet implemented"); + } + + async fn unpack_message(&self, msg: &[u8]) -> VcxCoreResult { + todo!("Not yet implemented"); + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[tokio::test] + #[cfg_attr(not(feature = "askar_tests"), ignore)] + async fn test_should_create_askar_wallet() { + let uri = "postgres://postgres:postgres@localhost/askar"; + + let profile = "foo".to_string(); + + let wallet = AskarWallet::create( + uri, + StoreKeyMethod::Unprotected, + None.into(), + true, + Some(profile.clone()), + ) + .await + .unwrap(); + + let active_profile = wallet.backend.get_active_profile(); + assert_eq!(profile, active_profile); + } + + #[tokio::test] + #[cfg_attr(not(feature = "askar_tests"), ignore)] + async fn test_should_open_askar_wallet() { + let uri = "postgres://postgres:postgres@localhost/askar"; + + AskarWallet::open(uri, Some(StoreKeyMethod::Unprotected), None.into(), None) + .await + .unwrap(); + } + + #[tokio::test] + #[cfg_attr(not(feature = "askar_tests"), ignore)] + async fn test_should_create_a_key_in_askar_wallet() { + let uri = "postgres://postgres:postgres@localhost/askar"; + + let wallet = AskarWallet::open(uri, Some(StoreKeyMethod::Unprotected), None.into(), None) + .await + .unwrap(); + + let key_name = "first-key"; + wallet + .create_key( + "first-key", + KeyAlg::Ed25519, + "seed", + RngMethod::RandomDet, + None, + None, + ) + .await + .unwrap(); + + let mut session = wallet.backend.session(None).await.unwrap(); + + let res = session.fetch_key(key_name, false).await.unwrap(); + res.map(|entry| assert_eq!(entry.name(), key_name)); + } +} diff --git a/aries_vcx_core/src/wallet/askar/mod.rs b/aries_vcx_core/src/wallet/askar/mod.rs new file mode 100644 index 0000000000..ccb4660fc4 --- /dev/null +++ b/aries_vcx_core/src/wallet/askar/mod.rs @@ -0,0 +1,2 @@ +pub mod askar_wallet; +pub mod rng_method; diff --git a/aries_vcx_core/src/wallet/askar/rng_method.rs b/aries_vcx_core/src/wallet/askar/rng_method.rs new file mode 100644 index 0000000000..a3d1801a96 --- /dev/null +++ b/aries_vcx_core/src/wallet/askar/rng_method.rs @@ -0,0 +1,13 @@ +pub enum RngMethod { + Bls, + RandomDet, +} + +impl From for Option<&str> { + fn from(value: RngMethod) -> Self { + match value { + RngMethod::RandomDet => None, + RngMethod::Bls => Some("bls_keygen"), + } + } +} diff --git a/aries_vcx_core/src/wallet/mod.rs b/aries_vcx_core/src/wallet/mod.rs index 32ede501ec..865e4b3d93 100644 --- a/aries_vcx_core/src/wallet/mod.rs +++ b/aries_vcx_core/src/wallet/mod.rs @@ -1,4 +1,5 @@ pub mod agency_client_wallet; +pub mod askar; pub mod base_wallet; #[cfg(feature = "vdrtools_wallet")] pub mod indy; diff --git a/libvcx_core/src/errors/error.rs b/libvcx_core/src/errors/error.rs index 4f0241e211..b0e4d317be 100644 --- a/libvcx_core/src/errors/error.rs +++ b/libvcx_core/src/errors/error.rs @@ -158,6 +158,26 @@ pub enum LibvcxErrorKind { #[error("Attempted to add a DID to wallet when that DID already exists in wallet")] DuplicationDid, + #[error("An unexpected error from the store backend")] + AskarBackend, + #[error("The store backend was too busy to handle the request")] + AskarBusy, + #[error("A custom error type for external integrations")] + AskarCustom, + #[error("An insert operation failed due to a unique key conflict")] + AskarDuplicate, + #[error("An encryption or decryption operation failed")] + AskarEncryption, + #[error("The input parameters to the method were incorrect")] + AskarInput, + #[error("The requested record was not found")] + AskarNotFound, + #[error("An unexpected error occurred")] + AskarUnexpected, + #[error("An unsupported operation was requested")] + AskarUnsupported, + + // Logger #[error("Logging Error")] LoggingError, diff --git a/libvcx_core/src/errors/mapping_from_ariesvcx.rs b/libvcx_core/src/errors/mapping_from_ariesvcx.rs index 8cfe0ce84c..a03ac2cdfd 100644 --- a/libvcx_core/src/errors/mapping_from_ariesvcx.rs +++ b/libvcx_core/src/errors/mapping_from_ariesvcx.rs @@ -73,6 +73,15 @@ impl From for LibvcxErrorKind { AriesVcxErrorKind::WalletAlreadyOpen => LibvcxErrorKind::WalletAlreadyOpen, AriesVcxErrorKind::DuplicationMasterSecret => LibvcxErrorKind::DuplicationMasterSecret, AriesVcxErrorKind::DuplicationDid => LibvcxErrorKind::DuplicationDid, + AriesVcxErrorKind::AskarBackend => LibvcxErrorKind::AskarBackend, + AriesVcxErrorKind::AskarBusy => LibvcxErrorKind::AskarBusy, + AriesVcxErrorKind::AskarCustom => LibvcxErrorKind::AskarCustom, + AriesVcxErrorKind::AskarDuplicate => LibvcxErrorKind::AskarDuplicate, + AriesVcxErrorKind::AskarEncryption => LibvcxErrorKind::AskarEncryption, + AriesVcxErrorKind::AskarInput => LibvcxErrorKind::AskarInput, + AriesVcxErrorKind::AskarNotFound => LibvcxErrorKind::AskarNotFound, + AriesVcxErrorKind::AskarUnexpected => LibvcxErrorKind::AskarUnexpected, + AriesVcxErrorKind::AskarUnsupported => LibvcxErrorKind::AskarUnsupported, AriesVcxErrorKind::LoggingError => LibvcxErrorKind::LoggingError, AriesVcxErrorKind::EncodeError => LibvcxErrorKind::EncodeError, AriesVcxErrorKind::UnknownError => LibvcxErrorKind::UnknownError, diff --git a/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs b/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs index 05ab64debf..1c45d1a5ca 100644 --- a/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs +++ b/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs @@ -85,6 +85,16 @@ impl From for LibvcxErrorKind { LibvcxErrorKind::DuplicationMasterSecret } AriesVcxCoreErrorKind::DuplicationDid => LibvcxErrorKind::DuplicationDid, + + AriesVcxCoreErrorKind::AskarBackend => LibvcxErrorKind::AskarBackend, + AriesVcxCoreErrorKind::AskarBusy => LibvcxErrorKind::AskarBusy, + AriesVcxCoreErrorKind::AskarCustom => LibvcxErrorKind::AskarCustom, + AriesVcxCoreErrorKind::AskarDuplicate => LibvcxErrorKind::AskarDuplicate, + AriesVcxCoreErrorKind::AskarEncryption => LibvcxErrorKind::AskarEncryption, + AriesVcxCoreErrorKind::AskarInput => LibvcxErrorKind::AskarInput, + AriesVcxCoreErrorKind::AskarNotFound => LibvcxErrorKind::AskarNotFound, + AriesVcxCoreErrorKind::AskarUnexpected => LibvcxErrorKind::AskarUnexpected, + AriesVcxCoreErrorKind::AskarUnsupported => LibvcxErrorKind::AskarUnsupported, AriesVcxCoreErrorKind::LoggingError => LibvcxErrorKind::LoggingError, AriesVcxCoreErrorKind::EncodeError => LibvcxErrorKind::EncodeError, AriesVcxCoreErrorKind::UnknownError => LibvcxErrorKind::UnknownError, diff --git a/libvdrtools/src/domain/crypto/did.rs b/libvdrtools/src/domain/crypto/did.rs index 9c48c7cf08..f76f9058d1 100644 --- a/libvdrtools/src/domain/crypto/did.rs +++ b/libvdrtools/src/domain/crypto/did.rs @@ -15,6 +15,16 @@ pub struct MyDidInfo { pub ledger_type: Option, } +impl MyDidInfo { + pub fn new(method_name: Option<&str>, seed: Option<&str>) -> Self { + Self { + method_name: method_name.map(|item| DidMethod(item.into())), + seed: seed.map(|item| item.into()), + ..Self::default() + } + } +} + #[derive(Debug, Serialize, Deserialize, Clone)] pub struct TheirDidInfo { pub did: DidValue,