HostValidator.Builder
class HostValidator.Builder
Builder of HostValidator.
Allows applications to customize the HostValidator that will be used to verify whether a caller is a valid templates host.
Summary
Public functions |
|
|---|---|
HostValidator.Builder |
addAllowedHost(packageName: String, digest: String)Adds a host to the allow list. |
HostValidator.Builder |
addAllowedHosts(allowListedHostsRes: @ArrayRes Int)Adds a hosts to the allow list. |
HostValidator |
build()Returns a new |
Public constructors
Public functions
addAllowedHost
fun addAllowedHost(packageName: String, digest: String): HostValidator.Builder
Adds a host to the allow list.
| Parameters | |
|---|---|
packageName: String |
host package name (as reported by |
digest: String |
SHA256 digest of the DER encoding of the allow-listed host certificate, formatted as 32 lowercase 2 digits hexadecimal values separated by colon (e.g.:"000102030405060708090a0b0c0d0e0f101112131415 161718191a1b1c1d1e1f"). When using signature rotation, this digest should correspond to the initial signing certificate |
addAllowedHosts
fun addAllowedHosts(allowListedHostsRes: @ArrayRes Int): HostValidator.Builder
Adds a hosts to the allow list.
Allow-listed hosts are retrieved from a string-array resource, encoded as [digest,package-name] pairs separated by comma. See addAllowedHost for details on signature digest and package-name formatting.
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the provided resource doesn't exist or if the entries in the given resource are not formatted as expected |