diff --git a/.gitignore b/.gitignore index c1909e1..c39ef75 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ .dfx/ # generated files -**/declarations/ +# **/declarations/ # rust target/ diff --git a/Cargo.lock b/Cargo.lock index 30b9df4..fa44939 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -36,7 +36,7 @@ dependencies = [ "candid", "ciborium", "getrandom", - "ic-cdk 0.15.1", + "ic-cdk", "ic-cdk-timers", "ic-oss-can", "ic-oss-types", @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arrayvec" @@ -158,17 +158,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -282,9 +282,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cached" @@ -331,14 +331,14 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "cc" -version = "1.1.13" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "shlex", ] @@ -404,9 +404,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -414,9 +414,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -426,14 +426,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -491,9 +491,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -565,7 +565,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -755,9 +755,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ff" @@ -871,7 +871,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -928,9 +928,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "group" @@ -1142,9 +1142,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", @@ -1173,9 +1173,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -1186,7 +1186,6 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] @@ -1208,9 +1207,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1272,25 +1271,12 @@ dependencies = [ [[package]] name = "ic-cdk" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cff1a3c3db565e3384c9c9d6d676b0a3f89a0886f4f787294d9c946d844369f" -dependencies = [ - "candid", - "ic-cdk-macros 0.14.0", - "ic0", - "serde", - "serde_bytes", -] - -[[package]] -name = "ic-cdk" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038ff230bf0fc8630943e3c52e989d248a7c89834ccb65da408fabc5817a475b" +checksum = "dd8ecacd682fa05a985253592963306cb9799622d7b1cce4b1edb89c6ec85be1" dependencies = [ "candid", - "ic-cdk-macros 0.15.0", + "ic-cdk-macros", "ic0", "serde", "serde_bytes", @@ -1298,40 +1284,26 @@ dependencies = [ [[package]] name = "ic-cdk-macros" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01dc6bc425ec048d6ac4137c7c0f2cfbd6f8b0be8efc568feae2b265f566117c" -dependencies = [ - "candid", - "proc-macro2", - "quote", - "serde", - "serde_tokenstream", - "syn 2.0.75", -] - -[[package]] -name = "ic-cdk-macros" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af44fb4ec3a4b18831c9d3303ca8fa2ace846c4022d50cb8df4122635d3782e" +checksum = "0d4d857135deef20cc7ea8f3869a30cd9cfeb1392b3a81043790b2cd82adc3e0" dependencies = [ "candid", "proc-macro2", "quote", "serde", "serde_tokenstream", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "ic-cdk-timers" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4a42e669e47cf58fc18e071898e67922c81aa480edbf930ed1468dd53f44ee" +checksum = "0c7c528bbb3d4d934b43a364855995d318649217c7510f40f92ad52eba3ff7be" dependencies = [ "futures", - "ic-cdk 0.14.1", + "ic-cdk", "ic0", "serde", "serde_bytes", @@ -1367,7 +1339,7 @@ dependencies = [ [[package]] name = "ic-oss" -version = "0.8.0" +version = "0.8.1" dependencies = [ "bytes", "candid", @@ -1384,11 +1356,11 @@ dependencies = [ [[package]] name = "ic-oss-can" -version = "0.8.0" +version = "0.8.1" dependencies = [ "candid", "ciborium", - "ic-cdk 0.15.1", + "ic-cdk", "ic-oss-types", "ic-stable-structures", "serde", @@ -1397,7 +1369,7 @@ dependencies = [ [[package]] name = "ic-oss-cli" -version = "0.8.0" +version = "0.8.1" dependencies = [ "anyhow", "candid", @@ -1418,7 +1390,7 @@ dependencies = [ [[package]] name = "ic-oss-types" -version = "0.8.0" +version = "0.8.1" dependencies = [ "base64 0.21.7", "candid", @@ -1492,7 +1464,7 @@ checksum = "8de254dd67bbd58073e23dc1c8553ba12fa1dc610a19de94ad2bbcd0460c067f" [[package]] name = "ic_oss_bucket" -version = "0.8.0" +version = "0.8.1" dependencies = [ "base64 0.21.7", "candid", @@ -1500,7 +1472,7 @@ dependencies = [ "getrandom", "hex", "hyperx", - "ic-cdk 0.15.1", + "ic-cdk", "ic-http-certification", "ic-oss-types", "ic-stable-structures", @@ -1512,14 +1484,14 @@ dependencies = [ [[package]] name = "ic_oss_cluster" -version = "0.8.0" +version = "0.8.1" dependencies = [ "candid", "ciborium", "futures", "getrandom", "hex", - "ic-cdk 0.15.1", + "ic-cdk", "ic-cdk-timers", "ic-oss-types", "ic-stable-structures", @@ -1572,9 +1544,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", @@ -1600,9 +1572,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "is_terminal_polyfill" @@ -1636,9 +1608,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -1677,9 +1649,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libm" @@ -1734,11 +1706,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -1808,9 +1780,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -1850,7 +1822,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -1894,9 +1866,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -1962,26 +1934,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2006,9 +1958,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "powerfmt" @@ -2056,18 +2008,18 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" dependencies = [ "cc", ] [[package]] name = "quinn" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" dependencies = [ "bytes", "pin-project-lite", @@ -2083,9 +2035,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.6" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba92fb39ec7ad06ca2582c0ca834dfeadcaf06ddfc8e635c80aa7e1c05315fdd" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" dependencies = [ "bytes", "rand", @@ -2100,15 +2052,15 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" dependencies = [ "libc", "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2158,9 +2110,9 @@ checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684" [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" dependencies = [ "bitflags 2.6.0", ] @@ -2289,18 +2241,18 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -2311,14 +2263,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.6", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] @@ -2360,9 +2312,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -2383,11 +2335,11 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2425,9 +2377,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -2441,9 +2393,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -2469,20 +2421,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -2498,7 +2450,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -2510,7 +2462,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -2648,15 +2600,15 @@ dependencies = [ [[package]] name = "stacker" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a5daa25ea337c85ed954c0496e3bdd2c7308cc3b24cf7b50d04876654c579f" +checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" dependencies = [ "cc", "cfg-if", "libc", "psm", - "windows-sys 0.36.1", + "windows-sys 0.59.0", ] [[package]] @@ -2684,7 +2636,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -2712,9 +2664,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.75" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -2772,22 +2724,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -2838,9 +2790,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.3" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -2862,7 +2814,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] @@ -2888,9 +2840,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -2899,9 +2851,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -2910,27 +2862,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - [[package]] name = "tower-service" version = "0.3.3" @@ -2991,24 +2922,24 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "untrusted" @@ -3094,7 +3025,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", "wasm-bindgen-shared", ] @@ -3128,7 +3059,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3164,9 +3095,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] @@ -3210,19 +3141,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -3293,12 +3211,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -3311,12 +3223,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -3335,12 +3241,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -3353,12 +3253,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -3383,12 +3277,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -3429,7 +3317,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.77", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 74abcaa..e6bfc88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ strip = true opt-level = 's' [workspace.package] -version = "0.8.0" +version = "0.8.1" edition = "2021" repository = "https://github.com/ldclabs/ic-oss" keywords = ["file", "storage", "oss", "s3", "icp"] @@ -41,10 +41,10 @@ hex = "0.4" sha2 = "0.10" sha3 = "0.10" num-traits = "0.2" -ic-cdk = "0.15" -ic-cdk-timers = "0.8" +ic-cdk = "0.16" +ic-cdk-timers = "0.10" ic-stable-structures = "0.6" -icrc-ledger-types = "0.1.6" +icrc-ledger-types = "0.1" ic-http-certification = { version = "2.5", features = ["serde"] } anyhow = "1" crc32fast = "1.4" diff --git a/src/declarations/ic_oss_bucket/ic_oss_bucket.did b/src/declarations/ic_oss_bucket/ic_oss_bucket.did new file mode 100644 index 0000000..82a0df2 --- /dev/null +++ b/src/declarations/ic_oss_bucket/ic_oss_bucket.did @@ -0,0 +1,184 @@ +type BucketInfo = record { + status : int8; + total_chunks : nat64; + trusted_eddsa_pub_keys : vec blob; + managers : vec principal; + name : text; + max_custom_data_size : nat16; + auditors : vec principal; + total_files : nat64; + max_children : nat16; + enable_hash_index : bool; + max_file_size : nat64; + folder_id : nat32; + visibility : nat8; + max_folder_depth : nat8; + trusted_ecdsa_pub_keys : vec blob; + total_folders : nat64; + file_id : nat32; +}; +type CanisterArgs = variant { Upgrade : UpgradeArgs; Init : InitArgs }; +type CanisterStatusResponse = record { + status : CanisterStatusType; + memory_size : nat; + cycles : nat; + settings : DefiniteCanisterSettings; + query_stats : QueryStats; + idle_cycles_burned_per_day : nat; + module_hash : opt blob; + reserved_cycles : nat; +}; +type CanisterStatusType = variant { stopped; stopping; running }; +type CreateFileInput = record { + dek : opt blob; + status : opt int8; + content : opt blob; + custom : opt vec record { text; MetadataValue }; + hash : opt blob; + name : text; + crc32 : opt nat32; + size : opt nat64; + content_type : text; + parent : nat32; +}; +type CreateFileOutput = record { id : nat32; created_at : nat64 }; +type CreateFolderInput = record { name : text; parent : nat32 }; +type DefiniteCanisterSettings = record { + freezing_threshold : nat; + controllers : vec principal; + reserved_cycles_limit : nat; + log_visibility : LogVisibility; + wasm_memory_limit : nat; + memory_allocation : nat; + compute_allocation : nat; +}; +type FileInfo = record { + ex : opt vec record { text; MetadataValue }; + id : nat32; + dek : opt blob; + status : int8; + updated_at : nat64; + custom : opt vec record { text; MetadataValue }; + hash : opt blob; + name : text; + size : nat64; + content_type : text; + created_at : nat64; + filled : nat64; + chunks : nat32; + parent : nat32; +}; +type FolderInfo = record { + id : nat32; + files : vec nat32; + status : int8; + updated_at : nat64; + name : text; + folders : vec nat32; + created_at : nat64; + parent : nat32; +}; +type FolderName = record { id : nat32; name : text }; +type InitArgs = record { + name : text; + max_custom_data_size : nat16; + max_children : nat16; + enable_hash_index : bool; + max_file_size : nat64; + visibility : nat8; + max_folder_depth : nat8; + file_id : nat32; +}; +type LogVisibility = variant { controllers; public }; +type MetadataValue = variant { Int : int; Nat : nat; Blob : blob; Text : text }; +type MoveInput = record { id : nat32; to : nat32; from : nat32 }; +type QueryStats = record { + response_payload_bytes_total : nat; + num_instructions_total : nat; + num_calls_total : nat; + request_payload_bytes_total : nat; +}; +type Result = variant { Ok; Err : text }; +type Result_1 = variant { Ok : vec nat32; Err : text }; +type Result_10 = variant { Ok : vec FileInfo; Err : text }; +type Result_11 = variant { Ok : vec FolderInfo; Err : text }; +type Result_12 = variant { Ok : UpdateFileOutput; Err : text }; +type Result_13 = variant { Ok : UpdateFileChunkOutput; Err : text }; +type Result_14 = variant { Ok : text; Err : text }; +type Result_2 = variant { Ok : CreateFileOutput; Err : text }; +type Result_3 = variant { Ok : bool; Err : text }; +type Result_4 = variant { Ok : BucketInfo; Err : text }; +type Result_5 = variant { Ok : CanisterStatusResponse; Err : text }; +type Result_6 = variant { Ok : vec FolderName; Err : text }; +type Result_7 = variant { Ok : vec record { nat32; blob }; Err : text }; +type Result_8 = variant { Ok : FileInfo; Err : text }; +type Result_9 = variant { Ok : FolderInfo; Err : text }; +type UpdateBucketInput = record { + status : opt int8; + trusted_eddsa_pub_keys : opt vec blob; + name : opt text; + max_custom_data_size : opt nat16; + max_children : opt nat16; + enable_hash_index : opt bool; + max_file_size : opt nat64; + visibility : opt nat8; + max_folder_depth : opt nat8; + trusted_ecdsa_pub_keys : opt vec blob; +}; +type UpdateFileChunkInput = record { + id : nat32; + chunk_index : nat32; + content : blob; + crc32 : opt nat32; +}; +type UpdateFileChunkOutput = record { updated_at : nat64; filled : nat64 }; +type UpdateFileInput = record { + id : nat32; + status : opt int8; + custom : opt vec record { text; MetadataValue }; + hash : opt blob; + name : opt text; + content_type : opt text; +}; +type UpdateFileOutput = record { updated_at : nat64 }; +type UpdateFolderInput = record { + id : nat32; + status : opt int8; + name : opt text; +}; +type UpgradeArgs = record { + max_custom_data_size : opt nat16; + max_children : opt nat16; + enable_hash_index : opt bool; + max_file_size : opt nat64; + max_folder_depth : opt nat8; +}; +service : (opt CanisterArgs) -> { + admin_set_auditors : (vec principal) -> (Result); + admin_set_managers : (vec principal) -> (Result); + admin_update_bucket : (UpdateBucketInput) -> (Result); + api_version : () -> (nat16) query; + batch_delete_subfiles : (nat32, vec nat32, opt blob) -> (Result_1); + create_file : (CreateFileInput, opt blob) -> (Result_2); + create_folder : (CreateFolderInput, opt blob) -> (Result_2); + delete_file : (nat32, opt blob) -> (Result_3); + delete_folder : (nat32, opt blob) -> (Result_3); + get_bucket_info : (opt blob) -> (Result_4) query; + get_canister_status : () -> (Result_5); + get_file_ancestors : (nat32, opt blob) -> (Result_6) query; + get_file_chunks : (nat32, nat32, opt nat32, opt blob) -> (Result_7) query; + get_file_info : (nat32, opt blob) -> (Result_8) query; + get_file_info_by_hash : (blob, opt blob) -> (Result_8) query; + get_folder_ancestors : (nat32, opt blob) -> (Result_6) query; + get_folder_info : (nat32, opt blob) -> (Result_9) query; + list_files : (nat32, opt nat32, opt nat32, opt blob) -> (Result_10) query; + list_folders : (nat32, opt nat32, opt nat32, opt blob) -> (Result_11) query; + move_file : (MoveInput, opt blob) -> (Result_12); + move_folder : (MoveInput, opt blob) -> (Result_12); + update_file_chunk : (UpdateFileChunkInput, opt blob) -> (Result_13); + update_file_info : (UpdateFileInput, opt blob) -> (Result_12); + update_folder_info : (UpdateFolderInput, opt blob) -> (Result_12); + validate2_admin_set_auditors : (vec principal) -> (Result_14); + validate2_admin_set_managers : (vec principal) -> (Result_14); + validate2_admin_update_bucket : (UpdateBucketInput) -> (Result_14); +} diff --git a/src/declarations/ic_oss_bucket/ic_oss_bucket.did.d.ts b/src/declarations/ic_oss_bucket/ic_oss_bucket.did.d.ts new file mode 100644 index 0000000..8308f71 --- /dev/null +++ b/src/declarations/ic_oss_bucket/ic_oss_bucket.did.d.ts @@ -0,0 +1,266 @@ +import type { Principal } from '@dfinity/principal'; +import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; + +export interface BucketInfo { + 'status' : number, + 'total_chunks' : bigint, + 'trusted_eddsa_pub_keys' : Array, + 'managers' : Array, + 'name' : string, + 'max_custom_data_size' : number, + 'auditors' : Array, + 'total_files' : bigint, + 'max_children' : number, + 'enable_hash_index' : boolean, + 'max_file_size' : bigint, + 'folder_id' : number, + 'visibility' : number, + 'max_folder_depth' : number, + 'trusted_ecdsa_pub_keys' : Array, + 'total_folders' : bigint, + 'file_id' : number, +} +export type CanisterArgs = { 'Upgrade' : UpgradeArgs } | + { 'Init' : InitArgs }; +export interface CanisterStatusResponse { + 'status' : CanisterStatusType, + 'memory_size' : bigint, + 'cycles' : bigint, + 'settings' : DefiniteCanisterSettings, + 'query_stats' : QueryStats, + 'idle_cycles_burned_per_day' : bigint, + 'module_hash' : [] | [Uint8Array | number[]], + 'reserved_cycles' : bigint, +} +export type CanisterStatusType = { 'stopped' : null } | + { 'stopping' : null } | + { 'running' : null }; +export interface CreateFileInput { + 'dek' : [] | [Uint8Array | number[]], + 'status' : [] | [number], + 'content' : [] | [Uint8Array | number[]], + 'custom' : [] | [Array<[string, MetadataValue]>], + 'hash' : [] | [Uint8Array | number[]], + 'name' : string, + 'crc32' : [] | [number], + 'size' : [] | [bigint], + 'content_type' : string, + 'parent' : number, +} +export interface CreateFileOutput { 'id' : number, 'created_at' : bigint } +export interface CreateFolderInput { 'name' : string, 'parent' : number } +export interface DefiniteCanisterSettings { + 'freezing_threshold' : bigint, + 'controllers' : Array, + 'reserved_cycles_limit' : bigint, + 'log_visibility' : LogVisibility, + 'wasm_memory_limit' : bigint, + 'memory_allocation' : bigint, + 'compute_allocation' : bigint, +} +export interface FileInfo { + 'ex' : [] | [Array<[string, MetadataValue]>], + 'id' : number, + 'dek' : [] | [Uint8Array | number[]], + 'status' : number, + 'updated_at' : bigint, + 'custom' : [] | [Array<[string, MetadataValue]>], + 'hash' : [] | [Uint8Array | number[]], + 'name' : string, + 'size' : bigint, + 'content_type' : string, + 'created_at' : bigint, + 'filled' : bigint, + 'chunks' : number, + 'parent' : number, +} +export interface FolderInfo { + 'id' : number, + 'files' : Uint32Array | number[], + 'status' : number, + 'updated_at' : bigint, + 'name' : string, + 'folders' : Uint32Array | number[], + 'created_at' : bigint, + 'parent' : number, +} +export interface FolderName { 'id' : number, 'name' : string } +export interface InitArgs { + 'name' : string, + 'max_custom_data_size' : number, + 'max_children' : number, + 'enable_hash_index' : boolean, + 'max_file_size' : bigint, + 'visibility' : number, + 'max_folder_depth' : number, + 'file_id' : number, +} +export type LogVisibility = { 'controllers' : null } | + { 'public' : null }; +export type MetadataValue = { 'Int' : bigint } | + { 'Nat' : bigint } | + { 'Blob' : Uint8Array | number[] } | + { 'Text' : string }; +export interface MoveInput { 'id' : number, 'to' : number, 'from' : number } +export interface QueryStats { + 'response_payload_bytes_total' : bigint, + 'num_instructions_total' : bigint, + 'num_calls_total' : bigint, + 'request_payload_bytes_total' : bigint, +} +export type Result = { 'Ok' : null } | + { 'Err' : string }; +export type Result_1 = { 'Ok' : Uint32Array | number[] } | + { 'Err' : string }; +export type Result_10 = { 'Ok' : Array } | + { 'Err' : string }; +export type Result_11 = { 'Ok' : Array } | + { 'Err' : string }; +export type Result_12 = { 'Ok' : UpdateFileOutput } | + { 'Err' : string }; +export type Result_13 = { 'Ok' : UpdateFileChunkOutput } | + { 'Err' : string }; +export type Result_14 = { 'Ok' : string } | + { 'Err' : string }; +export type Result_2 = { 'Ok' : CreateFileOutput } | + { 'Err' : string }; +export type Result_3 = { 'Ok' : boolean } | + { 'Err' : string }; +export type Result_4 = { 'Ok' : BucketInfo } | + { 'Err' : string }; +export type Result_5 = { 'Ok' : CanisterStatusResponse } | + { 'Err' : string }; +export type Result_6 = { 'Ok' : Array } | + { 'Err' : string }; +export type Result_7 = { 'Ok' : Array<[number, Uint8Array | number[]]> } | + { 'Err' : string }; +export type Result_8 = { 'Ok' : FileInfo } | + { 'Err' : string }; +export type Result_9 = { 'Ok' : FolderInfo } | + { 'Err' : string }; +export interface UpdateBucketInput { + 'status' : [] | [number], + 'trusted_eddsa_pub_keys' : [] | [Array], + 'name' : [] | [string], + 'max_custom_data_size' : [] | [number], + 'max_children' : [] | [number], + 'enable_hash_index' : [] | [boolean], + 'max_file_size' : [] | [bigint], + 'visibility' : [] | [number], + 'max_folder_depth' : [] | [number], + 'trusted_ecdsa_pub_keys' : [] | [Array], +} +export interface UpdateFileChunkInput { + 'id' : number, + 'chunk_index' : number, + 'content' : Uint8Array | number[], + 'crc32' : [] | [number], +} +export interface UpdateFileChunkOutput { + 'updated_at' : bigint, + 'filled' : bigint, +} +export interface UpdateFileInput { + 'id' : number, + 'status' : [] | [number], + 'custom' : [] | [Array<[string, MetadataValue]>], + 'hash' : [] | [Uint8Array | number[]], + 'name' : [] | [string], + 'content_type' : [] | [string], +} +export interface UpdateFileOutput { 'updated_at' : bigint } +export interface UpdateFolderInput { + 'id' : number, + 'status' : [] | [number], + 'name' : [] | [string], +} +export interface UpgradeArgs { + 'max_custom_data_size' : [] | [number], + 'max_children' : [] | [number], + 'enable_hash_index' : [] | [boolean], + 'max_file_size' : [] | [bigint], + 'max_folder_depth' : [] | [number], +} +export interface _SERVICE { + 'admin_set_auditors' : ActorMethod<[Array], Result>, + 'admin_set_managers' : ActorMethod<[Array], Result>, + 'admin_update_bucket' : ActorMethod<[UpdateBucketInput], Result>, + 'api_version' : ActorMethod<[], number>, + 'batch_delete_subfiles' : ActorMethod< + [number, Uint32Array | number[], [] | [Uint8Array | number[]]], + Result_1 + >, + 'create_file' : ActorMethod< + [CreateFileInput, [] | [Uint8Array | number[]]], + Result_2 + >, + 'create_folder' : ActorMethod< + [CreateFolderInput, [] | [Uint8Array | number[]]], + Result_2 + >, + 'delete_file' : ActorMethod<[number, [] | [Uint8Array | number[]]], Result_3>, + 'delete_folder' : ActorMethod< + [number, [] | [Uint8Array | number[]]], + Result_3 + >, + 'get_bucket_info' : ActorMethod<[[] | [Uint8Array | number[]]], Result_4>, + 'get_canister_status' : ActorMethod<[], Result_5>, + 'get_file_ancestors' : ActorMethod< + [number, [] | [Uint8Array | number[]]], + Result_6 + >, + 'get_file_chunks' : ActorMethod< + [number, number, [] | [number], [] | [Uint8Array | number[]]], + Result_7 + >, + 'get_file_info' : ActorMethod< + [number, [] | [Uint8Array | number[]]], + Result_8 + >, + 'get_file_info_by_hash' : ActorMethod< + [Uint8Array | number[], [] | [Uint8Array | number[]]], + Result_8 + >, + 'get_folder_ancestors' : ActorMethod< + [number, [] | [Uint8Array | number[]]], + Result_6 + >, + 'get_folder_info' : ActorMethod< + [number, [] | [Uint8Array | number[]]], + Result_9 + >, + 'list_files' : ActorMethod< + [number, [] | [number], [] | [number], [] | [Uint8Array | number[]]], + Result_10 + >, + 'list_folders' : ActorMethod< + [number, [] | [number], [] | [number], [] | [Uint8Array | number[]]], + Result_11 + >, + 'move_file' : ActorMethod< + [MoveInput, [] | [Uint8Array | number[]]], + Result_12 + >, + 'move_folder' : ActorMethod< + [MoveInput, [] | [Uint8Array | number[]]], + Result_12 + >, + 'update_file_chunk' : ActorMethod< + [UpdateFileChunkInput, [] | [Uint8Array | number[]]], + Result_13 + >, + 'update_file_info' : ActorMethod< + [UpdateFileInput, [] | [Uint8Array | number[]]], + Result_12 + >, + 'update_folder_info' : ActorMethod< + [UpdateFolderInput, [] | [Uint8Array | number[]]], + Result_12 + >, + 'validate2_admin_set_auditors' : ActorMethod<[Array], Result_14>, + 'validate2_admin_set_managers' : ActorMethod<[Array], Result_14>, + 'validate2_admin_update_bucket' : ActorMethod<[UpdateBucketInput], Result_14>, +} +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/src/declarations/ic_oss_bucket/ic_oss_bucket.did.js b/src/declarations/ic_oss_bucket/ic_oss_bucket.did.js new file mode 100644 index 0000000..a82721e --- /dev/null +++ b/src/declarations/ic_oss_bucket/ic_oss_bucket.did.js @@ -0,0 +1,351 @@ +export const idlFactory = ({ IDL }) => { + const UpgradeArgs = IDL.Record({ + 'max_custom_data_size' : IDL.Opt(IDL.Nat16), + 'max_children' : IDL.Opt(IDL.Nat16), + 'enable_hash_index' : IDL.Opt(IDL.Bool), + 'max_file_size' : IDL.Opt(IDL.Nat64), + 'max_folder_depth' : IDL.Opt(IDL.Nat8), + }); + const InitArgs = IDL.Record({ + 'name' : IDL.Text, + 'max_custom_data_size' : IDL.Nat16, + 'max_children' : IDL.Nat16, + 'enable_hash_index' : IDL.Bool, + 'max_file_size' : IDL.Nat64, + 'visibility' : IDL.Nat8, + 'max_folder_depth' : IDL.Nat8, + 'file_id' : IDL.Nat32, + }); + const CanisterArgs = IDL.Variant({ + 'Upgrade' : UpgradeArgs, + 'Init' : InitArgs, + }); + const Result = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : IDL.Text }); + const UpdateBucketInput = IDL.Record({ + 'status' : IDL.Opt(IDL.Int8), + 'trusted_eddsa_pub_keys' : IDL.Opt(IDL.Vec(IDL.Vec(IDL.Nat8))), + 'name' : IDL.Opt(IDL.Text), + 'max_custom_data_size' : IDL.Opt(IDL.Nat16), + 'max_children' : IDL.Opt(IDL.Nat16), + 'enable_hash_index' : IDL.Opt(IDL.Bool), + 'max_file_size' : IDL.Opt(IDL.Nat64), + 'visibility' : IDL.Opt(IDL.Nat8), + 'max_folder_depth' : IDL.Opt(IDL.Nat8), + 'trusted_ecdsa_pub_keys' : IDL.Opt(IDL.Vec(IDL.Vec(IDL.Nat8))), + }); + const Result_1 = IDL.Variant({ 'Ok' : IDL.Vec(IDL.Nat32), 'Err' : IDL.Text }); + const MetadataValue = IDL.Variant({ + 'Int' : IDL.Int, + 'Nat' : IDL.Nat, + 'Blob' : IDL.Vec(IDL.Nat8), + 'Text' : IDL.Text, + }); + const CreateFileInput = IDL.Record({ + 'dek' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'status' : IDL.Opt(IDL.Int8), + 'content' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'custom' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))), + 'hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'name' : IDL.Text, + 'crc32' : IDL.Opt(IDL.Nat32), + 'size' : IDL.Opt(IDL.Nat64), + 'content_type' : IDL.Text, + 'parent' : IDL.Nat32, + }); + const CreateFileOutput = IDL.Record({ + 'id' : IDL.Nat32, + 'created_at' : IDL.Nat64, + }); + const Result_2 = IDL.Variant({ 'Ok' : CreateFileOutput, 'Err' : IDL.Text }); + const CreateFolderInput = IDL.Record({ + 'name' : IDL.Text, + 'parent' : IDL.Nat32, + }); + const Result_3 = IDL.Variant({ 'Ok' : IDL.Bool, 'Err' : IDL.Text }); + const BucketInfo = IDL.Record({ + 'status' : IDL.Int8, + 'total_chunks' : IDL.Nat64, + 'trusted_eddsa_pub_keys' : IDL.Vec(IDL.Vec(IDL.Nat8)), + 'managers' : IDL.Vec(IDL.Principal), + 'name' : IDL.Text, + 'max_custom_data_size' : IDL.Nat16, + 'auditors' : IDL.Vec(IDL.Principal), + 'total_files' : IDL.Nat64, + 'max_children' : IDL.Nat16, + 'enable_hash_index' : IDL.Bool, + 'max_file_size' : IDL.Nat64, + 'folder_id' : IDL.Nat32, + 'visibility' : IDL.Nat8, + 'max_folder_depth' : IDL.Nat8, + 'trusted_ecdsa_pub_keys' : IDL.Vec(IDL.Vec(IDL.Nat8)), + 'total_folders' : IDL.Nat64, + 'file_id' : IDL.Nat32, + }); + const Result_4 = IDL.Variant({ 'Ok' : BucketInfo, 'Err' : IDL.Text }); + const CanisterStatusType = IDL.Variant({ + 'stopped' : IDL.Null, + 'stopping' : IDL.Null, + 'running' : IDL.Null, + }); + const LogVisibility = IDL.Variant({ + 'controllers' : IDL.Null, + 'public' : IDL.Null, + }); + const DefiniteCanisterSettings = IDL.Record({ + 'freezing_threshold' : IDL.Nat, + 'controllers' : IDL.Vec(IDL.Principal), + 'reserved_cycles_limit' : IDL.Nat, + 'log_visibility' : LogVisibility, + 'wasm_memory_limit' : IDL.Nat, + 'memory_allocation' : IDL.Nat, + 'compute_allocation' : IDL.Nat, + }); + const QueryStats = IDL.Record({ + 'response_payload_bytes_total' : IDL.Nat, + 'num_instructions_total' : IDL.Nat, + 'num_calls_total' : IDL.Nat, + 'request_payload_bytes_total' : IDL.Nat, + }); + const CanisterStatusResponse = IDL.Record({ + 'status' : CanisterStatusType, + 'memory_size' : IDL.Nat, + 'cycles' : IDL.Nat, + 'settings' : DefiniteCanisterSettings, + 'query_stats' : QueryStats, + 'idle_cycles_burned_per_day' : IDL.Nat, + 'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'reserved_cycles' : IDL.Nat, + }); + const Result_5 = IDL.Variant({ + 'Ok' : CanisterStatusResponse, + 'Err' : IDL.Text, + }); + const FolderName = IDL.Record({ 'id' : IDL.Nat32, 'name' : IDL.Text }); + const Result_6 = IDL.Variant({ + 'Ok' : IDL.Vec(FolderName), + 'Err' : IDL.Text, + }); + const Result_7 = IDL.Variant({ + 'Ok' : IDL.Vec(IDL.Tuple(IDL.Nat32, IDL.Vec(IDL.Nat8))), + 'Err' : IDL.Text, + }); + const FileInfo = IDL.Record({ + 'ex' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))), + 'id' : IDL.Nat32, + 'dek' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'status' : IDL.Int8, + 'updated_at' : IDL.Nat64, + 'custom' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))), + 'hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'name' : IDL.Text, + 'size' : IDL.Nat64, + 'content_type' : IDL.Text, + 'created_at' : IDL.Nat64, + 'filled' : IDL.Nat64, + 'chunks' : IDL.Nat32, + 'parent' : IDL.Nat32, + }); + const Result_8 = IDL.Variant({ 'Ok' : FileInfo, 'Err' : IDL.Text }); + const FolderInfo = IDL.Record({ + 'id' : IDL.Nat32, + 'files' : IDL.Vec(IDL.Nat32), + 'status' : IDL.Int8, + 'updated_at' : IDL.Nat64, + 'name' : IDL.Text, + 'folders' : IDL.Vec(IDL.Nat32), + 'created_at' : IDL.Nat64, + 'parent' : IDL.Nat32, + }); + const Result_9 = IDL.Variant({ 'Ok' : FolderInfo, 'Err' : IDL.Text }); + const Result_10 = IDL.Variant({ 'Ok' : IDL.Vec(FileInfo), 'Err' : IDL.Text }); + const Result_11 = IDL.Variant({ + 'Ok' : IDL.Vec(FolderInfo), + 'Err' : IDL.Text, + }); + const MoveInput = IDL.Record({ + 'id' : IDL.Nat32, + 'to' : IDL.Nat32, + 'from' : IDL.Nat32, + }); + const UpdateFileOutput = IDL.Record({ 'updated_at' : IDL.Nat64 }); + const Result_12 = IDL.Variant({ 'Ok' : UpdateFileOutput, 'Err' : IDL.Text }); + const UpdateFileChunkInput = IDL.Record({ + 'id' : IDL.Nat32, + 'chunk_index' : IDL.Nat32, + 'content' : IDL.Vec(IDL.Nat8), + 'crc32' : IDL.Opt(IDL.Nat32), + }); + const UpdateFileChunkOutput = IDL.Record({ + 'updated_at' : IDL.Nat64, + 'filled' : IDL.Nat64, + }); + const Result_13 = IDL.Variant({ + 'Ok' : UpdateFileChunkOutput, + 'Err' : IDL.Text, + }); + const UpdateFileInput = IDL.Record({ + 'id' : IDL.Nat32, + 'status' : IDL.Opt(IDL.Int8), + 'custom' : IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, MetadataValue))), + 'hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'name' : IDL.Opt(IDL.Text), + 'content_type' : IDL.Opt(IDL.Text), + }); + const UpdateFolderInput = IDL.Record({ + 'id' : IDL.Nat32, + 'status' : IDL.Opt(IDL.Int8), + 'name' : IDL.Opt(IDL.Text), + }); + const Result_14 = IDL.Variant({ 'Ok' : IDL.Text, 'Err' : IDL.Text }); + return IDL.Service({ + 'admin_set_auditors' : IDL.Func([IDL.Vec(IDL.Principal)], [Result], []), + 'admin_set_managers' : IDL.Func([IDL.Vec(IDL.Principal)], [Result], []), + 'admin_update_bucket' : IDL.Func([UpdateBucketInput], [Result], []), + 'api_version' : IDL.Func([], [IDL.Nat16], ['query']), + 'batch_delete_subfiles' : IDL.Func( + [IDL.Nat32, IDL.Vec(IDL.Nat32), IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_1], + [], + ), + 'create_file' : IDL.Func( + [CreateFileInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_2], + [], + ), + 'create_folder' : IDL.Func( + [CreateFolderInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_2], + [], + ), + 'delete_file' : IDL.Func( + [IDL.Nat32, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_3], + [], + ), + 'delete_folder' : IDL.Func( + [IDL.Nat32, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_3], + [], + ), + 'get_bucket_info' : IDL.Func( + [IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_4], + ['query'], + ), + 'get_canister_status' : IDL.Func([], [Result_5], []), + 'get_file_ancestors' : IDL.Func( + [IDL.Nat32, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_6], + ['query'], + ), + 'get_file_chunks' : IDL.Func( + [IDL.Nat32, IDL.Nat32, IDL.Opt(IDL.Nat32), IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_7], + ['query'], + ), + 'get_file_info' : IDL.Func( + [IDL.Nat32, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_8], + ['query'], + ), + 'get_file_info_by_hash' : IDL.Func( + [IDL.Vec(IDL.Nat8), IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_8], + ['query'], + ), + 'get_folder_ancestors' : IDL.Func( + [IDL.Nat32, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_6], + ['query'], + ), + 'get_folder_info' : IDL.Func( + [IDL.Nat32, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_9], + ['query'], + ), + 'list_files' : IDL.Func( + [ + IDL.Nat32, + IDL.Opt(IDL.Nat32), + IDL.Opt(IDL.Nat32), + IDL.Opt(IDL.Vec(IDL.Nat8)), + ], + [Result_10], + ['query'], + ), + 'list_folders' : IDL.Func( + [ + IDL.Nat32, + IDL.Opt(IDL.Nat32), + IDL.Opt(IDL.Nat32), + IDL.Opt(IDL.Vec(IDL.Nat8)), + ], + [Result_11], + ['query'], + ), + 'move_file' : IDL.Func( + [MoveInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_12], + [], + ), + 'move_folder' : IDL.Func( + [MoveInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_12], + [], + ), + 'update_file_chunk' : IDL.Func( + [UpdateFileChunkInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_13], + [], + ), + 'update_file_info' : IDL.Func( + [UpdateFileInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_12], + [], + ), + 'update_folder_info' : IDL.Func( + [UpdateFolderInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_12], + [], + ), + 'validate2_admin_set_auditors' : IDL.Func( + [IDL.Vec(IDL.Principal)], + [Result_14], + [], + ), + 'validate2_admin_set_managers' : IDL.Func( + [IDL.Vec(IDL.Principal)], + [Result_14], + [], + ), + 'validate2_admin_update_bucket' : IDL.Func( + [UpdateBucketInput], + [Result_14], + [], + ), + }); +}; +export const init = ({ IDL }) => { + const UpgradeArgs = IDL.Record({ + 'max_custom_data_size' : IDL.Opt(IDL.Nat16), + 'max_children' : IDL.Opt(IDL.Nat16), + 'enable_hash_index' : IDL.Opt(IDL.Bool), + 'max_file_size' : IDL.Opt(IDL.Nat64), + 'max_folder_depth' : IDL.Opt(IDL.Nat8), + }); + const InitArgs = IDL.Record({ + 'name' : IDL.Text, + 'max_custom_data_size' : IDL.Nat16, + 'max_children' : IDL.Nat16, + 'enable_hash_index' : IDL.Bool, + 'max_file_size' : IDL.Nat64, + 'visibility' : IDL.Nat8, + 'max_folder_depth' : IDL.Nat8, + 'file_id' : IDL.Nat32, + }); + const CanisterArgs = IDL.Variant({ + 'Upgrade' : UpgradeArgs, + 'Init' : InitArgs, + }); + return [IDL.Opt(CanisterArgs)]; +}; diff --git a/src/declarations/ic_oss_bucket/index.d.ts b/src/declarations/ic_oss_bucket/index.d.ts new file mode 100644 index 0000000..bd1fa71 --- /dev/null +++ b/src/declarations/ic_oss_bucket/index.d.ts @@ -0,0 +1,50 @@ +import type { + ActorSubclass, + HttpAgentOptions, + ActorConfig, + Agent, +} from "@dfinity/agent"; +import type { Principal } from "@dfinity/principal"; +import type { IDL } from "@dfinity/candid"; + +import { _SERVICE } from './ic_oss_bucket.did'; + +export declare const idlFactory: IDL.InterfaceFactory; +export declare const canisterId: string; + +export declare interface CreateActorOptions { + /** + * @see {@link Agent} + */ + agent?: Agent; + /** + * @see {@link HttpAgentOptions} + */ + agentOptions?: HttpAgentOptions; + /** + * @see {@link ActorConfig} + */ + actorOptions?: ActorConfig; +} + +/** + * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister. + * @constructs {@link ActorSubClass} + * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to + * @param {CreateActorOptions} options - see {@link CreateActorOptions} + * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions + * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent + * @see {@link HttpAgentOptions} + * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor + * @see {@link ActorConfig} + */ +export declare const createActor: ( + canisterId: string | Principal, + options?: CreateActorOptions +) => ActorSubclass<_SERVICE>; + +/** + * Intialized Actor using default settings, ready to talk to a canister using its candid interface + * @constructs {@link ActorSubClass} + */ +export declare const ic_oss_bucket: ActorSubclass<_SERVICE>; diff --git a/src/declarations/ic_oss_bucket/index.js b/src/declarations/ic_oss_bucket/index.js new file mode 100644 index 0000000..f7ac924 --- /dev/null +++ b/src/declarations/ic_oss_bucket/index.js @@ -0,0 +1,40 @@ +import { Actor, HttpAgent } from "@dfinity/agent"; + +// Imports and re-exports candid interface +import { idlFactory } from "./ic_oss_bucket.did.js"; +export { idlFactory } from "./ic_oss_bucket.did.js"; + +/* CANISTER_ID is replaced by webpack based on node environment + * Note: canister environment variable will be standardized as + * process.env.CANISTER_ID_ + * beginning in dfx 0.15.0 + */ +export const canisterId = + process.env.CANISTER_ID_IC_OSS_BUCKET; + +export const createActor = (canisterId, options = {}) => { + const agent = options.agent || new HttpAgent({ ...options.agentOptions }); + + if (options.agent && options.agentOptions) { + console.warn( + "Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent." + ); + } + + // Fetch root key for certificate validation during development + if (process.env.DFX_NETWORK !== "ic") { + agent.fetchRootKey().catch((err) => { + console.warn( + "Unable to fetch root key. Check to ensure that your local replica is running" + ); + console.error(err); + }); + } + + // Creates an actor with using the candid interface and the HttpAgent + return Actor.createActor(idlFactory, { + agent, + canisterId, + ...options.actorOptions, + }); +}; diff --git a/src/declarations/ic_oss_cluster/ic_oss_cluster.did b/src/declarations/ic_oss_cluster/ic_oss_cluster.did new file mode 100644 index 0000000..c5ac806 --- /dev/null +++ b/src/declarations/ic_oss_cluster/ic_oss_cluster.did @@ -0,0 +1,83 @@ +type AddWasmInput = record { wasm : blob; description : text }; +type BucketDeploymentInfo = record { + args : opt blob; + prev_hash : blob; + error : opt text; + deploy_at : nat64; + canister : principal; + wasm_hash : blob; +}; +type ChainArgs = variant { Upgrade : UpgradeArgs; Init : InitArgs }; +type ClusterInfo = record { + ecdsa_token_public_key : text; + bucket_wasm_total : nat64; + ecdsa_key_name : text; + managers : vec principal; + name : text; + bucket_deployed_total : nat64; + token_expiration : nat64; + bucket_latest_version : blob; + bucket_deployment_logs : nat64; + subject_authz_total : nat64; +}; +type DeployWasmInput = record { args : opt blob; canister : principal }; +type InitArgs = record { + ecdsa_key_name : text; + name : text; + token_expiration : nat64; + bucket_topup_threshold : nat; + bucket_topup_amount : nat; +}; +type Result = variant { Ok : blob; Err : text }; +type Result_1 = variant { Ok; Err : text }; +type Result_2 = variant { Ok : vec blob; Err : text }; +type Result_3 = variant { Ok : nat; Err : text }; +type Result_4 = variant { Ok : vec BucketDeploymentInfo; Err : text }; +type Result_5 = variant { Ok : WasmInfo; Err : text }; +type Result_6 = variant { Ok : vec principal; Err : text }; +type Result_7 = variant { Ok : ClusterInfo; Err : text }; +type Result_8 = variant { Ok : vec record { principal; text }; Err : text }; +type Result_9 = variant { Ok : text; Err : text }; +type Token = record { + subject : principal; + audience : principal; + policies : text; +}; +type UpgradeArgs = record { + name : opt text; + token_expiration : opt nat64; + bucket_topup_threshold : opt nat; + bucket_topup_amount : opt nat; +}; +type WasmInfo = record { + hash : blob; + wasm : blob; + description : text; + created_at : nat64; + created_by : principal; +}; +service : (opt ChainArgs) -> { + access_token : (principal) -> (Result); + admin_add_wasm : (AddWasmInput, opt blob) -> (Result_1); + admin_attach_policies : (Token) -> (Result_1); + admin_batch_call_buckets : (vec principal, text, opt blob) -> (Result_2); + admin_deploy_bucket : (DeployWasmInput, opt blob) -> (Result_1); + admin_detach_policies : (Token) -> (Result_1); + admin_set_managers : (vec principal) -> (Result_1); + admin_sign_access_token : (Token) -> (Result); + admin_topup_all_buckets : () -> (Result_3); + admin_upgrade_all_buckets : (opt blob) -> (Result_1); + bucket_deployment_logs : (opt nat, opt nat) -> (Result_4) query; + get_bucket_wasm : (blob) -> (Result_5) query; + get_buckets : () -> (Result_6) query; + get_cluster_info : () -> (Result_7) query; + get_deployed_buckets : () -> (Result_4) query; + get_subject_policies : (principal) -> (Result_8) query; + validate2_admin_add_wasm : (AddWasmInput, opt blob) -> (Result_9); + validate2_admin_batch_call_buckets : (vec principal, text, opt blob) -> ( + Result_9, + ); + validate2_admin_deploy_bucket : (DeployWasmInput, opt blob) -> (Result_9); + validate2_admin_set_managers : (vec principal) -> (Result_9); + validate2_admin_upgrade_all_buckets : (opt blob) -> (Result_9); +} diff --git a/src/declarations/ic_oss_cluster/ic_oss_cluster.did.d.ts b/src/declarations/ic_oss_cluster/ic_oss_cluster.did.d.ts new file mode 100644 index 0000000..f4dd9d4 --- /dev/null +++ b/src/declarations/ic_oss_cluster/ic_oss_cluster.did.d.ts @@ -0,0 +1,131 @@ +import type { Principal } from '@dfinity/principal'; +import type { ActorMethod } from '@dfinity/agent'; +import type { IDL } from '@dfinity/candid'; + +export interface AddWasmInput { + 'wasm' : Uint8Array | number[], + 'description' : string, +} +export interface BucketDeploymentInfo { + 'args' : [] | [Uint8Array | number[]], + 'prev_hash' : Uint8Array | number[], + 'error' : [] | [string], + 'deploy_at' : bigint, + 'canister' : Principal, + 'wasm_hash' : Uint8Array | number[], +} +export type ChainArgs = { 'Upgrade' : UpgradeArgs } | + { 'Init' : InitArgs }; +export interface ClusterInfo { + 'ecdsa_token_public_key' : string, + 'bucket_wasm_total' : bigint, + 'ecdsa_key_name' : string, + 'managers' : Array, + 'name' : string, + 'bucket_deployed_total' : bigint, + 'token_expiration' : bigint, + 'bucket_latest_version' : Uint8Array | number[], + 'bucket_deployment_logs' : bigint, + 'subject_authz_total' : bigint, +} +export interface DeployWasmInput { + 'args' : [] | [Uint8Array | number[]], + 'canister' : Principal, +} +export interface InitArgs { + 'ecdsa_key_name' : string, + 'name' : string, + 'token_expiration' : bigint, + 'bucket_topup_threshold' : bigint, + 'bucket_topup_amount' : bigint, +} +export type Result = { 'Ok' : Uint8Array | number[] } | + { 'Err' : string }; +export type Result_1 = { 'Ok' : null } | + { 'Err' : string }; +export type Result_2 = { 'Ok' : Array } | + { 'Err' : string }; +export type Result_3 = { 'Ok' : bigint } | + { 'Err' : string }; +export type Result_4 = { 'Ok' : Array } | + { 'Err' : string }; +export type Result_5 = { 'Ok' : WasmInfo } | + { 'Err' : string }; +export type Result_6 = { 'Ok' : Array } | + { 'Err' : string }; +export type Result_7 = { 'Ok' : ClusterInfo } | + { 'Err' : string }; +export type Result_8 = { 'Ok' : Array<[Principal, string]> } | + { 'Err' : string }; +export type Result_9 = { 'Ok' : string } | + { 'Err' : string }; +export interface Token { + 'subject' : Principal, + 'audience' : Principal, + 'policies' : string, +} +export interface UpgradeArgs { + 'name' : [] | [string], + 'token_expiration' : [] | [bigint], + 'bucket_topup_threshold' : [] | [bigint], + 'bucket_topup_amount' : [] | [bigint], +} +export interface WasmInfo { + 'hash' : Uint8Array | number[], + 'wasm' : Uint8Array | number[], + 'description' : string, + 'created_at' : bigint, + 'created_by' : Principal, +} +export interface _SERVICE { + 'access_token' : ActorMethod<[Principal], Result>, + 'admin_add_wasm' : ActorMethod< + [AddWasmInput, [] | [Uint8Array | number[]]], + Result_1 + >, + 'admin_attach_policies' : ActorMethod<[Token], Result_1>, + 'admin_batch_call_buckets' : ActorMethod< + [Array, string, [] | [Uint8Array | number[]]], + Result_2 + >, + 'admin_deploy_bucket' : ActorMethod< + [DeployWasmInput, [] | [Uint8Array | number[]]], + Result_1 + >, + 'admin_detach_policies' : ActorMethod<[Token], Result_1>, + 'admin_set_managers' : ActorMethod<[Array], Result_1>, + 'admin_sign_access_token' : ActorMethod<[Token], Result>, + 'admin_topup_all_buckets' : ActorMethod<[], Result_3>, + 'admin_upgrade_all_buckets' : ActorMethod< + [[] | [Uint8Array | number[]]], + Result_1 + >, + 'bucket_deployment_logs' : ActorMethod< + [[] | [bigint], [] | [bigint]], + Result_4 + >, + 'get_bucket_wasm' : ActorMethod<[Uint8Array | number[]], Result_5>, + 'get_buckets' : ActorMethod<[], Result_6>, + 'get_cluster_info' : ActorMethod<[], Result_7>, + 'get_deployed_buckets' : ActorMethod<[], Result_4>, + 'get_subject_policies' : ActorMethod<[Principal], Result_8>, + 'validate2_admin_add_wasm' : ActorMethod< + [AddWasmInput, [] | [Uint8Array | number[]]], + Result_9 + >, + 'validate2_admin_batch_call_buckets' : ActorMethod< + [Array, string, [] | [Uint8Array | number[]]], + Result_9 + >, + 'validate2_admin_deploy_bucket' : ActorMethod< + [DeployWasmInput, [] | [Uint8Array | number[]]], + Result_9 + >, + 'validate2_admin_set_managers' : ActorMethod<[Array], Result_9>, + 'validate2_admin_upgrade_all_buckets' : ActorMethod< + [[] | [Uint8Array | number[]]], + Result_9 + >, +} +export declare const idlFactory: IDL.InterfaceFactory; +export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[]; diff --git a/src/declarations/ic_oss_cluster/ic_oss_cluster.did.js b/src/declarations/ic_oss_cluster/ic_oss_cluster.did.js new file mode 100644 index 0000000..4b4973e --- /dev/null +++ b/src/declarations/ic_oss_cluster/ic_oss_cluster.did.js @@ -0,0 +1,158 @@ +export const idlFactory = ({ IDL }) => { + const UpgradeArgs = IDL.Record({ + 'name' : IDL.Opt(IDL.Text), + 'token_expiration' : IDL.Opt(IDL.Nat64), + 'bucket_topup_threshold' : IDL.Opt(IDL.Nat), + 'bucket_topup_amount' : IDL.Opt(IDL.Nat), + }); + const InitArgs = IDL.Record({ + 'ecdsa_key_name' : IDL.Text, + 'name' : IDL.Text, + 'token_expiration' : IDL.Nat64, + 'bucket_topup_threshold' : IDL.Nat, + 'bucket_topup_amount' : IDL.Nat, + }); + const ChainArgs = IDL.Variant({ 'Upgrade' : UpgradeArgs, 'Init' : InitArgs }); + const Result = IDL.Variant({ 'Ok' : IDL.Vec(IDL.Nat8), 'Err' : IDL.Text }); + const AddWasmInput = IDL.Record({ + 'wasm' : IDL.Vec(IDL.Nat8), + 'description' : IDL.Text, + }); + const Result_1 = IDL.Variant({ 'Ok' : IDL.Null, 'Err' : IDL.Text }); + const Token = IDL.Record({ + 'subject' : IDL.Principal, + 'audience' : IDL.Principal, + 'policies' : IDL.Text, + }); + const Result_2 = IDL.Variant({ + 'Ok' : IDL.Vec(IDL.Vec(IDL.Nat8)), + 'Err' : IDL.Text, + }); + const DeployWasmInput = IDL.Record({ + 'args' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'canister' : IDL.Principal, + }); + const Result_3 = IDL.Variant({ 'Ok' : IDL.Nat, 'Err' : IDL.Text }); + const BucketDeploymentInfo = IDL.Record({ + 'args' : IDL.Opt(IDL.Vec(IDL.Nat8)), + 'prev_hash' : IDL.Vec(IDL.Nat8), + 'error' : IDL.Opt(IDL.Text), + 'deploy_at' : IDL.Nat64, + 'canister' : IDL.Principal, + 'wasm_hash' : IDL.Vec(IDL.Nat8), + }); + const Result_4 = IDL.Variant({ + 'Ok' : IDL.Vec(BucketDeploymentInfo), + 'Err' : IDL.Text, + }); + const WasmInfo = IDL.Record({ + 'hash' : IDL.Vec(IDL.Nat8), + 'wasm' : IDL.Vec(IDL.Nat8), + 'description' : IDL.Text, + 'created_at' : IDL.Nat64, + 'created_by' : IDL.Principal, + }); + const Result_5 = IDL.Variant({ 'Ok' : WasmInfo, 'Err' : IDL.Text }); + const Result_6 = IDL.Variant({ + 'Ok' : IDL.Vec(IDL.Principal), + 'Err' : IDL.Text, + }); + const ClusterInfo = IDL.Record({ + 'ecdsa_token_public_key' : IDL.Text, + 'bucket_wasm_total' : IDL.Nat64, + 'ecdsa_key_name' : IDL.Text, + 'managers' : IDL.Vec(IDL.Principal), + 'name' : IDL.Text, + 'bucket_deployed_total' : IDL.Nat64, + 'token_expiration' : IDL.Nat64, + 'bucket_latest_version' : IDL.Vec(IDL.Nat8), + 'bucket_deployment_logs' : IDL.Nat64, + 'subject_authz_total' : IDL.Nat64, + }); + const Result_7 = IDL.Variant({ 'Ok' : ClusterInfo, 'Err' : IDL.Text }); + const Result_8 = IDL.Variant({ + 'Ok' : IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Text)), + 'Err' : IDL.Text, + }); + const Result_9 = IDL.Variant({ 'Ok' : IDL.Text, 'Err' : IDL.Text }); + return IDL.Service({ + 'access_token' : IDL.Func([IDL.Principal], [Result], []), + 'admin_add_wasm' : IDL.Func( + [AddWasmInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_1], + [], + ), + 'admin_attach_policies' : IDL.Func([Token], [Result_1], []), + 'admin_batch_call_buckets' : IDL.Func( + [IDL.Vec(IDL.Principal), IDL.Text, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_2], + [], + ), + 'admin_deploy_bucket' : IDL.Func( + [DeployWasmInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_1], + [], + ), + 'admin_detach_policies' : IDL.Func([Token], [Result_1], []), + 'admin_set_managers' : IDL.Func([IDL.Vec(IDL.Principal)], [Result_1], []), + 'admin_sign_access_token' : IDL.Func([Token], [Result], []), + 'admin_topup_all_buckets' : IDL.Func([], [Result_3], []), + 'admin_upgrade_all_buckets' : IDL.Func( + [IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_1], + [], + ), + 'bucket_deployment_logs' : IDL.Func( + [IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)], + [Result_4], + ['query'], + ), + 'get_bucket_wasm' : IDL.Func([IDL.Vec(IDL.Nat8)], [Result_5], ['query']), + 'get_buckets' : IDL.Func([], [Result_6], ['query']), + 'get_cluster_info' : IDL.Func([], [Result_7], ['query']), + 'get_deployed_buckets' : IDL.Func([], [Result_4], ['query']), + 'get_subject_policies' : IDL.Func([IDL.Principal], [Result_8], ['query']), + 'validate2_admin_add_wasm' : IDL.Func( + [AddWasmInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_9], + [], + ), + 'validate2_admin_batch_call_buckets' : IDL.Func( + [IDL.Vec(IDL.Principal), IDL.Text, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_9], + [], + ), + 'validate2_admin_deploy_bucket' : IDL.Func( + [DeployWasmInput, IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_9], + [], + ), + 'validate2_admin_set_managers' : IDL.Func( + [IDL.Vec(IDL.Principal)], + [Result_9], + [], + ), + 'validate2_admin_upgrade_all_buckets' : IDL.Func( + [IDL.Opt(IDL.Vec(IDL.Nat8))], + [Result_9], + [], + ), + }); +}; +export const init = ({ IDL }) => { + const UpgradeArgs = IDL.Record({ + 'name' : IDL.Opt(IDL.Text), + 'token_expiration' : IDL.Opt(IDL.Nat64), + 'bucket_topup_threshold' : IDL.Opt(IDL.Nat), + 'bucket_topup_amount' : IDL.Opt(IDL.Nat), + }); + const InitArgs = IDL.Record({ + 'ecdsa_key_name' : IDL.Text, + 'name' : IDL.Text, + 'token_expiration' : IDL.Nat64, + 'bucket_topup_threshold' : IDL.Nat, + 'bucket_topup_amount' : IDL.Nat, + }); + const ChainArgs = IDL.Variant({ 'Upgrade' : UpgradeArgs, 'Init' : InitArgs }); + return [IDL.Opt(ChainArgs)]; +}; diff --git a/src/declarations/ic_oss_cluster/index.d.ts b/src/declarations/ic_oss_cluster/index.d.ts new file mode 100644 index 0000000..e144d11 --- /dev/null +++ b/src/declarations/ic_oss_cluster/index.d.ts @@ -0,0 +1,50 @@ +import type { + ActorSubclass, + HttpAgentOptions, + ActorConfig, + Agent, +} from "@dfinity/agent"; +import type { Principal } from "@dfinity/principal"; +import type { IDL } from "@dfinity/candid"; + +import { _SERVICE } from './ic_oss_cluster.did'; + +export declare const idlFactory: IDL.InterfaceFactory; +export declare const canisterId: string; + +export declare interface CreateActorOptions { + /** + * @see {@link Agent} + */ + agent?: Agent; + /** + * @see {@link HttpAgentOptions} + */ + agentOptions?: HttpAgentOptions; + /** + * @see {@link ActorConfig} + */ + actorOptions?: ActorConfig; +} + +/** + * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister. + * @constructs {@link ActorSubClass} + * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to + * @param {CreateActorOptions} options - see {@link CreateActorOptions} + * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions + * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent + * @see {@link HttpAgentOptions} + * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor + * @see {@link ActorConfig} + */ +export declare const createActor: ( + canisterId: string | Principal, + options?: CreateActorOptions +) => ActorSubclass<_SERVICE>; + +/** + * Intialized Actor using default settings, ready to talk to a canister using its candid interface + * @constructs {@link ActorSubClass} + */ +export declare const ic_oss_cluster: ActorSubclass<_SERVICE>; diff --git a/src/declarations/ic_oss_cluster/index.js b/src/declarations/ic_oss_cluster/index.js new file mode 100644 index 0000000..a58c154 --- /dev/null +++ b/src/declarations/ic_oss_cluster/index.js @@ -0,0 +1,40 @@ +import { Actor, HttpAgent } from "@dfinity/agent"; + +// Imports and re-exports candid interface +import { idlFactory } from "./ic_oss_cluster.did.js"; +export { idlFactory } from "./ic_oss_cluster.did.js"; + +/* CANISTER_ID is replaced by webpack based on node environment + * Note: canister environment variable will be standardized as + * process.env.CANISTER_ID_ + * beginning in dfx 0.15.0 + */ +export const canisterId = + process.env.CANISTER_ID_IC_OSS_CLUSTER; + +export const createActor = (canisterId, options = {}) => { + const agent = options.agent || new HttpAgent({ ...options.agentOptions }); + + if (options.agent && options.agentOptions) { + console.warn( + "Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent." + ); + } + + // Fetch root key for certificate validation during development + if (process.env.DFX_NETWORK !== "ic") { + agent.fetchRootKey().catch((err) => { + console.warn( + "Unable to fetch root key. Check to ensure that your local replica is running" + ); + console.error(err); + }); + } + + // Creates an actor with using the candid interface and the HttpAgent + return Actor.createActor(idlFactory, { + agent, + canisterId, + ...options.actorOptions, + }); +}; diff --git a/src/ic_oss_bucket/ic_oss_bucket.did b/src/ic_oss_bucket/ic_oss_bucket.did index c1d9a48..82a0df2 100644 --- a/src/ic_oss_bucket/ic_oss_bucket.did +++ b/src/ic_oss_bucket/ic_oss_bucket.did @@ -104,6 +104,7 @@ type Result_10 = variant { Ok : vec FileInfo; Err : text }; type Result_11 = variant { Ok : vec FolderInfo; Err : text }; type Result_12 = variant { Ok : UpdateFileOutput; Err : text }; type Result_13 = variant { Ok : UpdateFileChunkOutput; Err : text }; +type Result_14 = variant { Ok : text; Err : text }; type Result_2 = variant { Ok : CreateFileOutput; Err : text }; type Result_3 = variant { Ok : bool; Err : text }; type Result_4 = variant { Ok : BucketInfo; Err : text }; @@ -177,7 +178,7 @@ service : (opt CanisterArgs) -> { update_file_chunk : (UpdateFileChunkInput, opt blob) -> (Result_13); update_file_info : (UpdateFileInput, opt blob) -> (Result_12); update_folder_info : (UpdateFolderInput, opt blob) -> (Result_12); - validate_admin_set_auditors : (vec principal) -> (Result); - validate_admin_set_managers : (vec principal) -> (Result); - validate_admin_update_bucket : (UpdateBucketInput) -> (Result); + validate2_admin_set_auditors : (vec principal) -> (Result_14); + validate2_admin_set_managers : (vec principal) -> (Result_14); + validate2_admin_update_bucket : (UpdateBucketInput) -> (Result_14); } diff --git a/src/ic_oss_bucket/src/api_admin.rs b/src/ic_oss_bucket/src/api_admin.rs index 393eeeb..3384b9d 100644 --- a/src/ic_oss_bucket/src/api_admin.rs +++ b/src/ic_oss_bucket/src/api_admin.rs @@ -13,17 +13,6 @@ fn admin_set_managers(args: BTreeSet) -> Result<(), String> { Ok(()) } -#[ic_cdk::update] -fn validate_admin_set_managers(args: BTreeSet) -> Result<(), String> { - if args.is_empty() { - return Err("managers cannot be empty".to_string()); - } - if args.contains(&ANONYMOUS) { - return Err("anonymous user is not allowed".to_string()); - } - Ok(()) -} - #[ic_cdk::update(guard = "is_controller")] fn admin_set_auditors(args: BTreeSet) -> Result<(), String> { validate_admin_set_auditors(args.clone())?; @@ -33,17 +22,6 @@ fn admin_set_auditors(args: BTreeSet) -> Result<(), String> { Ok(()) } -#[ic_cdk::update] -fn validate_admin_set_auditors(args: BTreeSet) -> Result<(), String> { - if args.is_empty() { - return Err("auditors cannot be empty".to_string()); - } - if args.contains(&ANONYMOUS) { - return Err("anonymous user is not allowed".to_string()); - } - Ok(()) -} - #[ic_cdk::update(guard = "is_controller")] fn admin_update_bucket(args: UpdateBucketInput) -> Result<(), String> { args.validate()?; @@ -82,7 +60,59 @@ fn admin_update_bucket(args: UpdateBucketInput) -> Result<(), String> { Ok(()) } +// ----- Use validate2_xxxxxx instead of validate_xxxxxx ----- + +#[ic_cdk::update(hidden = true)] +fn validate_admin_set_managers(args: BTreeSet) -> Result<(), String> { + if args.is_empty() { + return Err("managers cannot be empty".to_string()); + } + if args.contains(&ANONYMOUS) { + return Err("anonymous user is not allowed".to_string()); + } + Ok(()) +} + +#[ic_cdk::update] +fn validate2_admin_set_managers(args: BTreeSet) -> Result { + if args.is_empty() { + return Err("managers cannot be empty".to_string()); + } + if args.contains(&ANONYMOUS) { + return Err("anonymous user is not allowed".to_string()); + } + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] +fn validate_admin_set_auditors(args: BTreeSet) -> Result<(), String> { + if args.is_empty() { + return Err("auditors cannot be empty".to_string()); + } + if args.contains(&ANONYMOUS) { + return Err("anonymous user is not allowed".to_string()); + } + Ok(()) +} + #[ic_cdk::update] +fn validate2_admin_set_auditors(args: BTreeSet) -> Result { + if args.is_empty() { + return Err("auditors cannot be empty".to_string()); + } + if args.contains(&ANONYMOUS) { + return Err("anonymous user is not allowed".to_string()); + } + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] fn validate_admin_update_bucket(args: UpdateBucketInput) -> Result<(), String> { args.validate() } + +#[ic_cdk::update] +fn validate2_admin_update_bucket(args: UpdateBucketInput) -> Result { + args.validate()?; + Ok("ok".to_string()) +} diff --git a/src/ic_oss_cluster/ic_oss_cluster.did b/src/ic_oss_cluster/ic_oss_cluster.did index 99dde1a..c5ac806 100644 --- a/src/ic_oss_cluster/ic_oss_cluster.did +++ b/src/ic_oss_cluster/ic_oss_cluster.did @@ -37,6 +37,7 @@ type Result_5 = variant { Ok : WasmInfo; Err : text }; type Result_6 = variant { Ok : vec principal; Err : text }; type Result_7 = variant { Ok : ClusterInfo; Err : text }; type Result_8 = variant { Ok : vec record { principal; text }; Err : text }; +type Result_9 = variant { Ok : text; Err : text }; type Token = record { subject : principal; audience : principal; @@ -72,11 +73,11 @@ service : (opt ChainArgs) -> { get_cluster_info : () -> (Result_7) query; get_deployed_buckets : () -> (Result_4) query; get_subject_policies : (principal) -> (Result_8) query; - validate_admin_add_wasm : (AddWasmInput, opt blob) -> (Result_1); - validate_admin_batch_call_buckets : (vec principal, text, opt blob) -> ( - Result_2, + validate2_admin_add_wasm : (AddWasmInput, opt blob) -> (Result_9); + validate2_admin_batch_call_buckets : (vec principal, text, opt blob) -> ( + Result_9, ); - validate_admin_deploy_bucket : (DeployWasmInput, opt blob) -> (Result_1); - validate_admin_set_managers : (vec principal) -> (Result_1); - validate_admin_upgrade_all_buckets : (opt blob) -> (Result_1); + validate2_admin_deploy_bucket : (DeployWasmInput, opt blob) -> (Result_9); + validate2_admin_set_managers : (vec principal) -> (Result_9); + validate2_admin_upgrade_all_buckets : (opt blob) -> (Result_9); } diff --git a/src/ic_oss_cluster/src/api_admin.rs b/src/ic_oss_cluster/src/api_admin.rs index a7e196d..9f3fb01 100644 --- a/src/ic_oss_cluster/src/api_admin.rs +++ b/src/ic_oss_cluster/src/api_admin.rs @@ -32,6 +32,12 @@ fn admin_set_managers(args: BTreeSet) -> Result<(), String> { } #[ic_cdk::update] +fn validate2_admin_set_managers(args: BTreeSet) -> Result { + validate_admin_set_managers(args)?; + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] fn validate_admin_set_managers(args: BTreeSet) -> Result<(), String> { if args.is_empty() { return Err("managers cannot be empty".to_string()); @@ -93,6 +99,15 @@ async fn admin_add_wasm( } #[ic_cdk::update] +async fn validate2_admin_add_wasm( + args: AddWasmInput, + force_prev_hash: Option>, +) -> Result { + validate_admin_add_wasm(args, force_prev_hash).await?; + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] async fn validate_admin_add_wasm( args: AddWasmInput, force_prev_hash: Option>, @@ -184,6 +199,15 @@ async fn admin_deploy_bucket( } #[ic_cdk::update] +async fn validate2_admin_deploy_bucket( + args: DeployWasmInput, + ignore_prev_hash: Option>, +) -> Result { + validate_admin_deploy_bucket(args, ignore_prev_hash).await?; + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] async fn validate_admin_deploy_bucket( args: DeployWasmInput, ignore_prev_hash: Option>, @@ -313,11 +337,25 @@ async fn admin_topup_all_buckets() -> Result { } #[ic_cdk::update] +async fn validate2_admin_upgrade_all_buckets(_args: Option) -> Result { + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] async fn validate_admin_upgrade_all_buckets(_args: Option) -> Result<(), String> { Ok(()) } #[ic_cdk::update] +async fn validate2_admin_batch_call_buckets( + _buckets: BTreeSet, + _method: String, + _args: Option, +) -> Result { + Ok("ok".to_string()) +} + +#[ic_cdk::update(hidden = true)] async fn validate_admin_batch_call_buckets( _buckets: BTreeSet, _method: String,