nvs ext inspect, nvs ext verify and nvs ext pin
nvs ext inspect, nvs ext verify and nvs ext pin read a .nvsx file before you load it.
nvs ext inspect <file> prints the class of the extension, its methods with their help, and the folders and hosts it asks for. --source also prints the Novis source files inside it. nvs ext verify <file> runs every check that loading the file runs, and says if the file passes. nvs ext pin <file> prints the [[extension]] entry for nvs.toml, with the file's sha256.
None of the three commands runs code from the file. nvs ext inspect also works for a file that does not load.
Good to know: the entry from nvs ext pin has no grants, so the extension may not read files or connect to hosts. You add the folders and hosts you allow after you read nvs ext inspect. nvs ext pin prints nothing for a file that does not pass the checks.
Examples
The examples below run with this configuration file.
# This is the entry that `nvs ext pin` printed for the extension `Geo\Atlas`.# `nvs ext pin` prints an absolute `path`. Here it is relative to this file.# The entry has no `grants`, so the extension may not read files or connect to hosts.[[extension]]path = "../../config/extension-grants-what-a-component-may-reach/atlas.nvsx"sha256 = "8bb2081b5d76340eb1cdc2cf22b0eaa2144bb7851b83abb5662c1b369ce9694b"
# The program in this folder may read the folder `data/`.[capabilities.fs]read = ["data/"]An entry with no grants
<?nvs// Shows a program that uses an extension through the entry that `nvs ext pin` printed.
use Geo\Atlas;
// This program may read `cities.txt`, so this prints `Vienna` and `Graz`.echo Core\IO::read('data/cities.txt');
// The entry has no `grants`, so the extension may not read the same file.// The call throws a `RuntimeError`, and this prints `no folder is granted`.try { echo Atlas::read('cities.txt');} catch (RuntimeError $denied) { echo $denied->message, "\n";}ViennaGrazno folder is granted