Tink Python 库 tink-py 支持 macOS(x86-64 和 ARM64)、Linux(x86-64 和 ARM64)和 Windows(x86-64)上的 Python 3.9 或更高版本。最新版本为 1.13.0。可以使用 Pip 在本地安装,也可以与 Bazel 搭配使用。
Tink Python 可与 AWS KMS、Google Cloud KMS 和 HashiCorp Vault 集成。
画中画
您可以运行以下命令,从 PyPI 为您的系统安装 Tink Python 二进制版本:
pip3 install tink==1.13.0
# Core Tink + Google Cloud KMS extension.
pip3 install tink[gcpkms]==1.13.0
# Core Tink + AWS KMS extension.
pip3 install tink[awskms]==1.13.0
# Core Tink + HashiCorp Vault KMS extension.
pip3 install tink[hcvault]==1.13.0
# Core Tink + all the KMS extensions.
pip3 install tink[all]==1.13.0
如果未针对您的环境发布二进制软件包,pip 会自动改用发布到 PyPI 的源代码分发来构建项目。如果是这种情况,您需要安装 Bazel 或 Bazelisk 以及 protobuf 编译器,才能成功构建项目。
Bazel
Bazel 用户可以使用 Tink Python 作为 pip 依赖项(使用 rules_python 的 pip_parse 宏),也可以在 MODULE.bazel 中使用 Tink Python 作为 Bazel 依赖项:
bazel_dep(name = "tink_py")
archive_override(
module_name = "tink_py",
urls = ["https://github.com/tink-crypto/tink-py/releases/download/v1.13.0/tink-py-1.13.0.zip"],
strip_prefix = "tink-py-1.13.0",
sha256 = "874a9837022d6124e3d28785cf40f0a9495637ab5e91fda5392412b200f0cced",
)
注意:我们不会在 Bazel 中央注册表中发布 Tink Python。
后续步骤
完成 Tink 设置后,请继续执行标准 Tink 使用步骤: