Retrieve Secret
Retrieve secret strings, integers, and arrays from the network.
retrieve_secret
returns a tuple containing two elements: the first element is the name of the secret represented as a UUID (Universally Unique Identifier), and the second element is the actual secret value.
tip
Open the Nillion Python Client Reference in another tab to search for available Nillion Client classes.
Retrieve a SecretBlob
Get a quote to retrieve a value, pay to retrieve a value, get a payment receipt, and finally retrieve the SecretBlob
examples_and_tutorials/core_concept_store_and_retrieve_secrets/store_and_retrieve_blob.py
decoded_secret_value = value.value.decode("utf-8")
print(f"The secret value is '{decoded_secret_value}'")
balance = await client.balance()
print(f"💰 Final client balance: {balance.balance} Credits")
client.close()
return decoded_secret_value
if __name__ == "__main__":
asyncio.run(main())
@pytest.mark.asyncio
async def test_main():
result = await main()
assert result == "gm, builder!"
Retrieve a SecretInteger
Get a quote to retrieve a value, pay to retrieve a value, get a payment receipt, and finally retrieve the SecretInteger
examples_and_tutorials/core_concept_store_and_retrieve_secrets/store_and_retrieve_integer.py
print(f"💰 Final client balance: {balance.balance} Credits")
client.close()
return value.value
if __name__ == "__main__":
asyncio.run(main())
@pytest.mark.asyncio
async def test_main():
result = await main()
assert result == 100