buhe / langchain-swift

🚀 LangChain for Swift. Optimized for iOS, macOS, watchOS (part) and visionOS.(beta)
https://buhe.dev
Apache License 2.0
323 stars 35 forks source link

env.txt Security #30

Closed nbmisen closed 1 year ago

nbmisen commented 1 year ago

大佬能不能把API Key改成初始化注入之类的形式,在工程文件里感觉不安全啊,怕被人解包什么的,谢谢

buhe commented 1 year ago

Sorry, please use English, although I am also a Chinese, but hope this project is international.

Ask, how to inject safer? In the form of a string?

buhe commented 1 year ago

Like:

env["some_key"] = xxx

?

BR

buhe

nbmisen commented 1 year ago

Sorry about my Chinese description. Yeah, you can make env a struct or class, we can configure it and make it safer by ourselves.

buhe commented 1 year ago

OK, thank you for the advice.

buhe commented 1 year ago

Please use >=0.25.0

Env.initSet(["some_key": "some_value"])

// As some as before

Will merge env.txt when has it, otherwise use variable.