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

oncall("secure_pipes")

cpp_library(
    name = "token_binding",
    srcs = [
        "Types.cpp",
    ],
    headers = [
        "Types.h",
    ],
    deps = [
        "//folly:string",
        "//folly/io:iobuf",
    ],
    exported_deps = [
        "//fizz/record:record",
        "//folly:optional",
    ],
)

cpp_library(
    name = "token_binding_server_extension",
    headers = [
        "TokenBindingServerExtension.h",
    ],
    exported_deps = [
        ":token_binding",
        ":token_binding_context",
        "//fizz/server:negotiator",
        "//fizz/server:server_extensions",
    ],
)

cpp_library(
    name = "token_binding_client_extension",
    srcs = [
        "TokenBindingClientExtension.cpp",
    ],
    headers = [
        "TokenBindingClientExtension.h",
    ],
    exported_deps = [
        ":token_binding",
        ":token_binding_context",
        "//fizz/client:client_extensions",
        "//folly:optional",
    ],
)

cpp_library(
    name = "token_binding_context",
    headers = [
        "TokenBindingContext.h",
    ],
    exported_deps = [
        ":token_binding",
    ],
)

cpp_library(
    name = "token_binding_validator",
    srcs = [
        "Validator.cpp",
    ],
    headers = [
        "Validator.h",
    ],
    deps = [
        ":utils",
        "//fizz/protocol:default_factory",
    ],
    exported_deps = [
        ":token_binding",
        "//fizz/backend:openssl",
        "//fizz/record:record",
    ],
)

cpp_library(
    name = "utils",
    headers = [
        "Utils.h",
    ],
    exported_deps = [
        ":token_binding",
    ],
)

cpp_library(
    name = "token_binding_constructor",
    srcs = [
        "TokenBindingConstructor.cpp",
    ],
    headers = [
        "TokenBindingConstructor.h",
    ],
    deps = [
        "fbcode//fizz/backend:openssl",
        "fbcode//fizz/extensions/tokenbinding:utils",
    ],
    exported_deps = [
        ":token_binding",
        "//folly/ssl:openssl_ptr_types",
    ],
)
