Package com.vivokey.chipscanlib
Class VivoAPI
- java.lang.Object
-
- com.vivokey.chipscanlib.VivoAPI
-
public class VivoAPI extends Object
Handles connections to the VivoKey API.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
apikey
protected cz.msebera.android.httpclient.impl.client.HttpClientBuilder
clientBuilder
protected cz.msebera.android.httpclient.client.HttpClient
httpClient
protected cz.msebera.android.httpclient.client.methods.HttpPost
postCheckResponse
protected cz.msebera.android.httpclient.client.methods.HttpPost
postGetChall
protected cz.msebera.android.httpclient.client.methods.HttpPost
postPcdChallenge
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VivoAuthResult
checkResponse(String uid, String chall, String chipResp)
Checks a chip response against the response provided.String
getChallenge()
Gets a challenge from the API using the specified key.String
pcdChallenge(String uid, String chall, String chipResp)
Get a Spark 2/Apex PCD challenge.
-
-
-
Field Detail
-
httpClient
protected cz.msebera.android.httpclient.client.HttpClient httpClient
-
clientBuilder
protected final cz.msebera.android.httpclient.impl.client.HttpClientBuilder clientBuilder
-
postGetChall
protected final cz.msebera.android.httpclient.client.methods.HttpPost postGetChall
-
postPcdChallenge
protected final cz.msebera.android.httpclient.client.methods.HttpPost postPcdChallenge
-
postCheckResponse
protected final cz.msebera.android.httpclient.client.methods.HttpPost postCheckResponse
-
apikey
protected String apikey
-
-
Constructor Detail
-
VivoAPI
public VivoAPI(String apikey)
Constructor. Creates the required parts to send commands. Requires an API key.- Parameters:
apikey
- API key for the VivoKey API.
-
-
Method Detail
-
getChallenge
public String getChallenge()
Gets a challenge from the API using the specified key.- Returns:
- a hex string of the challenge provided
-
pcdChallenge
public String pcdChallenge(String uid, String chall, String chipResp)
Get a Spark 2/Apex PCD challenge.- Parameters:
uid
- chip uid in hex string formatchall
- a challenge from the API in hex string formatchipResp
- the chip response to AuthenticatePart1- Returns:
- the PCD response
-
checkResponse
public VivoAuthResult checkResponse(String uid, String chall, String chipResp)
Checks a chip response against the response provided.- Parameters:
chipResp
- the hex string from the chip.uid
- chip UID in hex string format.chall
- challenge from earlier API call in hex string format.- Returns:
- the VivoAuthResult representing this chip authentication. Returns null on failure.
-
-