mithril-security / blindai

Confidential AI deployment with secure enclaves :lock:
https://www.mithrilsecurity.io/
Apache License 2.0
500 stars 35 forks source link

Merge hardware and software in notebook examples #53

Closed cchudant closed 2 years ago

cchudant commented 2 years ago

Description

Merge hardware and software in notebook examples

Something like

client = BlindAiClient()

# Comment this line for hardware mode
client.connect_server(addr="localhost", simulation=True)

# Comment this line for simulation mode
client.connect_server(
    addr="localhost",
    policy="policy.toml",
    certificate="host_server.pem"
)

Why this modification is needed?

Make the notebooks clearer, and less redundant

What documents need to be updated

Additional Information

None

Checklist

dhuynh95 commented 2 years ago

One person I talked to suggested we read information from an environment variable to know if the client should discuss with a simulation or hardware backend. I think default behavior should be simulation so that it always works but with a warning.

If the user wants to talk to a hardware backend, we could ask them to specify an environment variable like _BLINDAICERTIFICATES which could point to a folder where there is a certificate and a policy file. If this environment variable does not exist or the folder is empty, it would go to simulation mode.

This way we can provide the same API everywhere.

What do you guys think @cchudant @JoFrost ?

cchudant commented 2 years ago

I don't know whether this is a good idea. This feels strange to me and not typical of library like that.

I think it's better to have simulation=True/False on connect?

As for the notebook examples, I think we should remove the hardware one and just have a comment where you need to change True to False?

dhuynh95 commented 2 years ago

Ok yeah true, maybe just remove hardware / software notebooks and put comments.

What do you think of getting the certificate and policy from env variable?

clauverjat commented 2 years ago

Closing since #56 solves the issue