HostValidator.Builder
public
static
final
class
HostValidator.Builder
extends Object
java.lang.Object | |
↳ | androidx.car.app.validation.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 constructors | |
---|---|
Builder(Context context)
Returns an empty |
Public methods | |
---|---|
HostValidator.Builder
|
addAllowedHost(String packageName, String digest)
Adds a host to the allow list. |
HostValidator.Builder
|
addAllowedHosts(int allowListedHostsRes)
Adds a hosts to the allow list. |
HostValidator
|
build()
Returns a new |
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (Context context)
Returns an empty HostValidator.Builder
instance.
Parameters | |
---|---|
context |
Context |
Public methods
addAllowedHost
public HostValidator.Builder addAllowedHost (String packageName, String digest)
Adds a host to the allow list.
Parameters | |
---|---|
packageName |
String : host package name (as reported by PackageManager ) |
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
|
Returns | |
---|---|
HostValidator.Builder |
addAllowedHosts
public HostValidator.Builder addAllowedHosts (int allowListedHostsRes)
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(String, String)
for details on signature digest and
package-name formatting.
Parameters | |
---|---|
allowListedHostsRes |
int : string-array resource identifier |
Returns | |
---|---|
HostValidator.Builder |
Throws | |
---|---|
IllegalArgumentException |
if the provided resource doesn't exist or if the entries in the given resource are not formatted as expected |