xref: /aosp_15_r20/external/tink/python/examples/envelope_aead/BUILD.bazel (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1load("@rules_python//python:defs.bzl", "py_binary")
2load("@pip_deps//:requirements.bzl", "requirement")
3
4package(default_visibility = ["//visibility:private"])
5
6licenses(["notice"])
7
8py_binary(
9    name = "envelope",
10    srcs = ["envelope.py"],
11    python_version = "PY3",
12    deps = [
13        requirement("absl-py"),
14        "@tink_py//tink:tink_python",
15        "@tink_py//tink/integration/gcpkms",
16    ],
17)
18
19# In order to run this test, use your own Cloud KMS key and credential:
20sh_test(
21    name = "envelope_test",
22    size = "small",
23    srcs = ["envelope_test.sh"],
24    args = [
25        "$(rootpath :envelope)",
26        # Change this to your key.
27        "gcp-kms://projects/tink-test-infrastructure/locations/global/keyRings/unit-and-integration-testing/cryptoKeys/aead-key",
28        # Change this to your credential.
29        "$(rootpath //testdata/gcp:credential.json)",
30    ],
31    data = [
32        ":envelope",
33        "@google_root_pem//file",
34        # Change this to your credential.
35        "//testdata/gcp:credential.json",
36    ],
37    tags = ["manual"],
38)
39
40# This runs the previous test, assuming the Tink python package has been
41# installed previously with pip3 install.
42sh_test(
43    name = "envelope_test_package",
44    size = "small",
45    srcs = ["envelope_test.sh"],
46    args = [
47        "'python3 $(rootpath :envelope.py)'",
48        # Change this to your key.
49        "gcp-kms://projects/tink-test-infrastructure/locations/global/keyRings/unit-and-integration-testing/cryptoKeys/aead-key",
50        # Change this to your credential.
51        "$(rootpath //testdata/gcp:credential.json)",
52    ],
53    data = [
54        ":envelope.py",
55        "@google_root_pem//file",
56        # Change this to your credential.
57        "//testdata/gcp:credential.json",
58    ],
59    tags = ["manual"],
60)
61