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

oncall("secure_pipes")

cpp_library(
    name = "crypto",
    srcs = [
        "Crypto.cpp",
    ],
    headers = [
        "Crypto.h",
    ],
    exported_deps = [
        "//folly:range",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "hkdf",
    srcs = [
        "Hkdf.cpp",
    ],
    headers = [
        "Hkdf.h",
    ],
    exported_deps = [
        ":crypto",
        ":hasher",
        "//folly/io:iobuf",
    ],
)

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

cpp_library(
    name = "hasher",
    srcs = [
        "Hasher.cpp",
        "Hmac.cpp",
    ],
    headers = [
        "Hasher.h",
        "Hmac.h",
    ],
    exported_deps = [
        "fbcode//fizz/crypto:crypto",
        "fbcode//folly/io:iobuf",
    ],
)

cpp_library(
    name = "random",
    headers = [
        "RandomGenerator.h",
    ],
    exported_deps = [
        "//folly/io:iobuf",
    ],
    exported_external_deps = [
        ("libsodium", None, "sodium"),
    ],
)

cpp_library(
    name = "utils",
    srcs = [
        "Utils.cpp",
    ],
    headers = [
        "Utils.h",
    ],
    exported_deps = [
        "//folly:range",
    ],
    external_deps = [
        ("libsodium", None, "sodium"),
    ],
)
