File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1515//!
1616pub use crate :: kinode:: process:: standard:: * ;
1717use serde:: { Deserialize , Serialize } ;
18+ use serde_json:: Value ;
1819
1920wit_bindgen:: generate!( {
2021 path: "kinode-wit" ,
@@ -204,10 +205,13 @@ pub fn can_message(address: &Address) -> bool {
204205}
205206
206207/// Get a capability in our store
207- /// NOTE unfortunatly this is O(n), not sure if wit let's us do any better
208208pub fn get_capability ( our : & Address , params : & str ) -> Option < Capability > {
209+ let params = serde_json:: from_str :: < Value > ( params) . unwrap_or_default ( ) ;
209210 crate :: our_capabilities ( )
210211 . iter ( )
211- . find ( |cap| cap. issuer == * our && cap. params == params)
212+ . find ( |cap| {
213+ let cap_params = serde_json:: from_str :: < Value > ( & cap. params ) . unwrap_or_default ( ) ;
214+ cap. issuer == * our && params == cap_params
215+ } )
212216 . cloned ( )
213217}
You can’t perform that action at this time.
0 commit comments