@@ -184,7 +184,7 @@ async fn main() -> Result<(), Error> {
184
184
} else if cmd. starts_with ( "plugin" ) {
185
185
match cmd {
186
186
"pluginSign" => {
187
- let mut args = args. values_of ( "path " ) . unwrap ( ) ;
187
+ let mut args = args. values_of ( "name " ) . unwrap ( ) ;
188
188
let name = args. next ( ) . unwrap ( ) ;
189
189
let manifest = PluginManifest :: load ( name) . await ;
190
190
let manifest_path = PathBuf :: from ( format ! ( "plugins/{}/manifest.json" , name) ) ;
@@ -199,20 +199,8 @@ async fn main() -> Result<(), Error> {
199
199
"pluginVerify" => {
200
200
let mut args = args. values_of ( "name" ) . unwrap ( ) ;
201
201
let name = args. next ( ) . unwrap ( ) ;
202
- let manifest_path = PathBuf :: from ( format ! ( "plugins/{}/manifest.json" , name) ) ;
203
- let plugin_file = PathBuf :: from ( format ! ( "plugins/{name}/{name}.wasm" , name = name) ) ;
204
- let manifest_str = tokio:: fs:: read_to_string ( & manifest_path) . await . unwrap ( ) ;
205
- let manifest: PluginManifest = serde_json:: from_str ( & manifest_str) . unwrap ( ) ;
206
- let manifest_verified = manifest. verify ( ) . unwrap_or ( false ) ;
207
- let bytes = tokio:: fs:: read ( plugin_file) . await . unwrap ( ) ;
208
- let sign = manifest. plugin_signature ;
209
- let mut verified = manifest_verified;
210
- for key in manifest. signs . keys ( ) {
211
- if !manifest_verified {
212
- continue ;
213
- }
214
- verified = verified || zeronet_cryptography:: verify ( & * bytes, key, & sign) . is_ok ( ) ;
215
- }
202
+ let manifest = PluginManifest :: load ( name) . await . unwrap ( ) ;
203
+ let verified = manifest. verify_plugin ( ) . await . unwrap_or ( false ) ;
216
204
println ! ( "Plugin Verified : {}" , verified) ;
217
205
}
218
206
_ => {
0 commit comments