grant

voynich grant gives an enclave the key of a sealed model. It reads the model key from the owner key file, wraps it to the enclave's encryption key on this machine and sends grant_by_owner, signed by the owner's wallet. How the key moves is told in Grants. The same from code is grant. The owner takes a grant back with voynich model revoke.

Shell
voynich grant sketch-32 <enclave> --state owner.enc.json

Arguments and flags#

FieldMeaning
modelname or address, first argumentrequired

The model to grant.

enclaveenclave address or signing key, second argumentrequired

The enclave that receives the key. Both values are in voynich enclaves.

--statefile pathrequired

The owner key file that voynich seal wrote for this model.

The command asks for the owner key file's password the way seal does, or reads it from VOYNICH_PASSWORD. The wallet is chosen as told in Install and has to be the model's owner.

What it checks first#

The model key is wrapped only after the enclave has been checked against the chain. The CLI reads the accounts itself, through the RPC the API names, and stops at the first check that fails:

  1. The owner key file opens with the password, and the model it was written for is the model named.
  2. The API names the Voynich program the CLI was built with.
  3. The Config, the Model and the Enclave exist and are owned by the program.
  4. The Model's address is the one derived from its name, and the Enclave's address is the one derived from its signing key.
  5. The Model's status is sealed or live.
  6. The signing wallet is the Model's owner.
  7. The enclave's attestation record is at the address derived from its signing key and is owned by the attestation program the Config names.
  8. The record has the Config's layout, names the enclave's signing key, and states the hardware type and measurement the Enclave holds.
  9. The record is in force at the current slot: recorded at or before it, expiring after it.
  10. The record's measurement is one of the model's allowed measurements.
  11. The enclave named on the command line is the enclave the API returned, by address or by signing key.

The encryption key the model key is wrapped to is the one read from the Enclave account in step 3.

What it prints#

The status of the granting transaction, as JSON on stdout:

FieldMeaning
idstring

The transaction's id at the API.

statusstring

confirmed or finalized.

signaturebase58 signature

The transaction's signature.

A first grant moves a sealed model to live.

Failures#

The command prints the code and the message to stderr as <code>: <message>, or the message alone where the table shows no code, and exits with code 1. The code is the one the SDK raises for the same failure.

CodeMessageCause
Supply --state.A missing flag or argument. The message names it: --state, model, enclave.
Set VOYNICH_PASSWORD when no interactive terminal is availableNo terminal to prompt on and no VOYNICH_PASSWORD.
Unsupported owner key file formatThe file at --state has another version or kdf.
The owner key file belongs to another modelThe file was written for a model other than the one named.
MODEL_NOT_FOUNDThe API's messageNo model has this name or address.
ENCLAVE_NOT_FOUNDThe API's messageNo enclave has this address or signing key.
PROGRAM_MISMATCHThe API does not name the canonical Voynich program.Check 2.
INVALID_CHAIN_ACCOUNTThe model, enclave or configuration account is missing or has an invalid owner.Check 3.
MODEL_MISMATCHThe chain accounts do not match the requested model and enclave.Check 4.
MODEL_NOT_LIVEThe model is not ready for this action.Check 5: the model is uploading or retired.
OWNER_REQUIREDOnly this model owner may wrap an owner grant.Check 6.
INVALID_ATTESTATIONThe enclave points to an invalid attestation record.Check 7: the record's address.
INVALID_ATTESTATIONThe attestation record owner does not match the chain configuration.Check 7: the record's owner.
INVALID_ATTESTATIONThe enclave record is expired or does not match the registered and allowed software.Checks 8 to 10.
ENCLAVE_MISMATCHThe enclave does not match the requested grant recipient.Check 11.
TRANSACTION_FAILEDThe failure's own message, or The transaction did not land.The transaction was refused. A refusal by the program carries one of its errors.
TRANSACTION_EXPIREDThe failure's own message, or The transaction did not land.The transaction did not land before its blockhash expired.

voynich model revoke#

Shell
voynich model revoke <model> <enclave>

Revokes one enclave's grant for a model with revoke_grant, signed by the owner's wallet. It needs no owner key file. What a revoked grant stops is told in Grants. The same from code is revoke.

FieldMeaning
modelname or address, first argumentrequired

The model whose grant is revoked.

enclaveenclave address or signing key, second argumentrequired

The enclave that holds the grant.

The wallet is chosen as told in Install and has to be the model's owner.

It prints the status of the transaction, as JSON on stdout: id, status (confirmed or finalized) and signature.

CodeMessageCause
Supply model. or Supply enclave.A missing argument.
ENCLAVE_NOT_FOUNDThe API's messageNo enclave has this address or signing key.
MODEL_NOT_FOUNDThe API's messageNo model has this name or address.
GRANT_REQUIREDThe API's messageThe enclave holds no grant for the model.
SIMULATION_FAILEDThe API's messageThe wallet is not the model's owner.
TRANSACTION_FAILED, TRANSACTION_EXPIREDThe failure's own message, or The transaction did not land.revoke_grant was refused, or did not land before its blockhash expired.