load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("secure_pipes")

cpp_library(
    name = "utils",
    srcs = [
        "Utils.cpp",
    ],
    headers = [
        "Utils.h",
    ],
    exported_deps = [
        ":types",
        "//fizz/crypto:crypto",
        "//fizz/protocol:types",
        "//folly:optional",
    ],
)

cpp_library(
    name = "hkdf",
    srcs = [
        "Hkdf.cpp",
    ],
    headers = [
        "Hkdf.h",
    ],
    deps = [
        "//fizz/record:record",
    ],
    exported_deps = [
        "//fizz/crypto:hasher",
        "//fizz/crypto:hkdf",
    ],
)

cpp_library(
    name = "dhkem",
    srcs = [
        "DHKEM.cpp",
    ],
    headers = [
        "DHKEM.h",
    ],
    deps = [
        "//folly/io:iobuf",
    ],
    exported_deps = [
        ":hkdf",
        ":types",
        "//fizz/crypto/exchange:key_exchange",
        "//fizz/record:record",
    ],
)

cpp_library(
    name = "types",
    headers = [
        "Types.h",
    ],
    exported_deps = [
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "context",
    srcs = [
        "Context.cpp",
    ],
    headers = [
        "Context.h",
    ],
    deps = [
        ":utils",
    ],
    exported_deps = [
        "fbcode//fizz/crypto/aead:aead",
        "fbcode//fizz/crypto/hpke:hkdf",
        "fbcode//fizz/crypto/hpke:types",
        "fbcode//fizz/protocol:types",
    ],
)

cpp_library(
    name = "hpke",
    srcs = [
        "Hpke.cpp",
    ],
    headers = [
        "Hpke.h",
    ],
    deps = [
        ":types",
    ],
    exported_deps = [
        ":context",
        ":dhkem",
        "//fizz/crypto/aead:aead",
    ],
)
