Skip to content

Feature/upgrade sdk and deps #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7557b24
chore: sync schema
Jul 21, 2024
e554290
ci: update Gradle to 8.9
Jul 21, 2024
7625912
ci: use Gradle plugin for openapi
Jul 21, 2024
2ed85b9
chore: update Gradle build and configs
Jul 21, 2024
ebf0658
chore: update functional tests
Jul 22, 2024
c29c9a0
ci: adjust Gradle build for new generation approach
Jul 22, 2024
b078dff
test: update tests according to regenerated schema
Jul 22, 2024
2731921
chore: update sources after new Gradle build
Jul 22, 2024
93bf4f9
chore: remove java 8 from test runs
Jul 25, 2024
b9e9a00
ci: use java 11 for release build
Jul 25, 2024
316d928
chore: update Gradle build
Jul 25, 2024
5c8def3
chore: use jersey3 templates
Jul 25, 2024
25708e2
ci: update open api generator
Jul 25, 2024
33080ac
ci: use jersey3 library
Jul 25, 2024
d96b858
test: update tests
Jul 25, 2024
ac41c7a
ci: update jakarta annotation api to 2.0.0
Jul 25, 2024
d365708
ci: update swagger annotations api
Jul 25, 2024
c5752fc
ci: remove jsr305
Jul 25, 2024
22a1f6b
chore: add model definition
Jul 25, 2024
f76c4cf
chore: use swagger 3 annotations
Jul 25, 2024
df489a2
chore: add regenerated sources
Jul 25, 2024
da0fd6e
chore: remove java 8 from test runs
Jul 25, 2024
3157324
chore: trigger tests
Jul 26, 2024
eaffa7e
chore: update path to mocks
Jul 31, 2024
b68ace6
ci: update version replacer
Jul 31, 2024
5648a7f
feat: add `remoteControl`, `velocity` and `developerTools` signals
Jul 31, 2024
db4832f
feat: add DELETE API
Jul 31, 2024
4f39547
ci: fix version replacement for linux
Aug 5, 2024
033a98f
feat: add `Webhook.IsValidWebhookSignature` function for validating w…
Aug 5, 2024
367b195
chore: update readme
Aug 5, 2024
37ac852
ci: task to copy generated readme
Aug 5, 2024
5fa6215
ci: fix warning
Aug 5, 2024
45e1aee
test: add tests for webhook
Aug 5, 2024
97afe90
chore: add webhook sample
Aug 5, 2024
85993c5
ci: fix build dir
Aug 5, 2024
20a6195
chore: add samples to README
Aug 5, 2024
57ae425
test: add tests for event update
Aug 5, 2024
970969c
test: test for deleting visitor data
Aug 5, 2024
2c92755
chore: add more samples in readme
Aug 6, 2024
a44bba9
chore: set correct script path
Aug 7, 2024
92d9e17
ci: adjust jitpack config for java 11
Aug 7, 2024
924984f
ci: remove java 8 from tests
Aug 8, 2024
1d025ae
chore: add @ilfa to codeowners
Aug 8, 2024
43eb8a0
ci: remove java 8 from tests
Aug 8, 2024
46b5f8f
chore: add @ilfa to codeowners
Aug 8, 2024
ac4a3f4
ci: update workflow
Aug 8, 2024
3b046f4
ci: remove docs before generation
Aug 8, 2024
49f8b46
chore: remove old docs
Aug 8, 2024
e17031c
ci: remove classes before generation
Aug 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
with:
distribution: 'zulu'
java-version: '${{ matrix.java }}'
cache: 'gradle'
- run: ./gradlew runFunctionalTests
env:
FPJS_API_SECRET: "${{ secrets.FPJS_API_SECRET }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
appId: ${{ vars.APP_ID }}
language: java
language-version: '8'
java-version: '8'
language-version: '11'
java-version: '11'
secrets:
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ jobs:
with:
distribution: 'zulu'
java-version: '${{ matrix.java }}'
cache: 'gradle'
- run: ./gradlew test
2 changes: 0 additions & 2 deletions .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ module.exports = {
"README.md",
"config.json",
"build.gradle",
"pom.xml",
"config.yaml",
"./scripts/generate.sh",
"docs/**/*",
"src/**/*"
]
Expand Down
104 changes: 74 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,6 @@ Then manually install the following JARs:

- `target/fingerprint-pro-server-api-sdk-5.1.1.jar`

## Usage

To add a HTTP proxy for the API client, use `ClientConfig`:
```java

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import com.fingerprint.sdk.*;
import com.fingerprint.api.FingerprintApi;

...

ApiClient defaultClient = Configuration.getDefaultApiClient();
ClientConfig clientConfig = defaultClient.getClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here");
clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username");
clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password");
defaultClient.setClientConfig(clientConfig);

FingerprintApi apiInstance = new FingerprintApi(defaultClient);

```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:
Expand Down Expand Up @@ -160,6 +135,16 @@ public class FingerprintApiExample {
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
}

// Update an event with a given requestId
try {
EventUpdateRequest request = new EventUpdateRequest();
request.setLinkedId("myNewLinkedId");
api.updateEvent(FPJS_REQUEST_ID, request);
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.updateEvent:" + e.getMessage());
}

// Get a specific visitor's all visits
try {
// Fetch all visits with a given visitorId, with a page limit
Expand All @@ -186,6 +171,13 @@ public class FingerprintApiExample {
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.getVisits:" + e.getMessage());
}

// Delete visitor data with a given visitorID
try {
api.deleteVisitorData(FPJS_VISITOR_ID);
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.deleteVisitorData:" + e.getMessage());
}
}
}
```
Expand Down Expand Up @@ -227,14 +219,47 @@ public class SealedResults {
```
To learn more, refer to example located in [src/examples/java/com/fingerprint/example/SealedResults.java](src/examples/java/com/fingerprint/example/SealedResults.java).

## Webhook signature validation
This SDK provides utility method for verifying the HMAC signature of the incoming webhook request.
```java

@RestController
class WebhookController {

@PostMapping("/api/webhook")
@ResponseBody
public String webhookHandler(@RequestBody String webhook, @RequestHeader HttpHeaders headers) {
final String secret = System.getenv("WEBHOOK_SIGNATURE_SECRET");
if (secret == null || secret.isEmpty()) {
return new ResponseEntity<String>("Secret key is not configured", HttpStatus.INTERNAL_SERVER_ERROR);
}

final String header = headers.get("fpjs-event-signature");
if (header == null || header.size == 0) {
return new ResponseEntity<String>("Missing fpjs-event-signature header", HttpStatus.BAD_REQUEST);
}
final String signature = header[0];

final boolean isValidSignature = Webhook.isValidWebhookSignature(signature, data.getBytes(StandardCharsets.UTF_8), secret);
if (!isValidSignature) {
return new ResponseEntity<String>("Webhook signature is not valid", HttpStatus.BAD_REQUEST);
}

return new ResponseEntity<String>("Webhook received", HttpStatus.OK);
}
}
```

## Documentation for API Endpoints

All URIs are relative to *https://api.fpjs.io*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FingerprintApi* | [**getEvent**](docs/FingerprintApi.md#getEvent) | **GET** /events/{request_id} | Get event by requestId
*FingerprintApi* | [**getVisits**](docs/FingerprintApi.md#getVisits) | **GET** /visitors/{visitor_id} | Get visits by visitorId
*FingerprintApi* | [**deleteVisitorData**](docs/FingerprintApi.md#deleteVisitorData) | **DELETE** /visitors/{visitor_id} | Delete data by visitor ID
*FingerprintApi* | [**getEvent**](docs/FingerprintApi.md#getEvent) | **GET** /events/{request_id} | Get event by request ID
*FingerprintApi* | [**getVisits**](docs/FingerprintApi.md#getVisits) | **GET** /visitors/{visitor_id} | Get visits by visitor ID
*FingerprintApi* | [**updateEvent**](docs/FingerprintApi.md#updateEvent) | **PUT** /events/{request_id} | Update an event with a given request ID
*FingerprintApi* | [**webhookTrace**](docs/FingerprintApi.md#webhookTrace) | **TRACE** /webhook |


Expand All @@ -245,18 +270,30 @@ Class | Method | HTTP request | Description
- [BotdResult](docs/BotdResult.md)
- [BrowserDetails](docs/BrowserDetails.md)
- [ClonedAppResult](docs/ClonedAppResult.md)
- [Common403ErrorResponse](docs/Common403ErrorResponse.md)
- [Confidence](docs/Confidence.md)
- [DataCenter](docs/DataCenter.md)
- [DeprecatedIPLocation](docs/DeprecatedIPLocation.md)
- [DeprecatedIPLocationCity](docs/DeprecatedIPLocationCity.md)
- [DeveloperToolsResult](docs/DeveloperToolsResult.md)
- [EmulatorResult](docs/EmulatorResult.md)
- [Error](docs/Error.md)
- [ErrorEvent403Response](docs/ErrorEvent403Response.md)
- [ErrorEvent403ResponseError](docs/ErrorEvent403ResponseError.md)
- [ErrorCommon403Response](docs/ErrorCommon403Response.md)
- [ErrorCommon429Response](docs/ErrorCommon429Response.md)
- [ErrorCommon429ResponseError](docs/ErrorCommon429ResponseError.md)
- [ErrorEvent404Response](docs/ErrorEvent404Response.md)
- [ErrorEvent404ResponseError](docs/ErrorEvent404ResponseError.md)
- [ErrorUpdateEvent400Response](docs/ErrorUpdateEvent400Response.md)
- [ErrorUpdateEvent400ResponseError](docs/ErrorUpdateEvent400ResponseError.md)
- [ErrorUpdateEvent409Response](docs/ErrorUpdateEvent409Response.md)
- [ErrorUpdateEvent409ResponseError](docs/ErrorUpdateEvent409ResponseError.md)
- [ErrorVisitor400Response](docs/ErrorVisitor400Response.md)
- [ErrorVisitor400ResponseError](docs/ErrorVisitor400ResponseError.md)
- [ErrorVisitor404Response](docs/ErrorVisitor404Response.md)
- [ErrorVisitor404ResponseError](docs/ErrorVisitor404ResponseError.md)
- [ErrorVisits403](docs/ErrorVisits403.md)
- [EventResponse](docs/EventResponse.md)
- [EventUpdateRequest](docs/EventUpdateRequest.md)
- [FactoryResetResult](docs/FactoryResetResult.md)
- [FridaResult](docs/FridaResult.md)
- [HighActivityResult](docs/HighActivityResult.md)
Expand All @@ -272,7 +309,6 @@ Class | Method | HTTP request | Description
- [JailbrokenResult](docs/JailbrokenResult.md)
- [Location](docs/Location.md)
- [LocationSpoofingResult](docs/LocationSpoofingResult.md)
- [ManyRequestsResponse](docs/ManyRequestsResponse.md)
- [PrivacySettingsResult](docs/PrivacySettingsResult.md)
- [ProductError](docs/ProductError.md)
- [ProductsResponse](docs/ProductsResponse.md)
Expand All @@ -281,11 +317,13 @@ Class | Method | HTTP request | Description
- [ProductsResponseIdentificationData](docs/ProductsResponseIdentificationData.md)
- [ProxyResult](docs/ProxyResult.md)
- [RawDeviceAttributesResultValue](docs/RawDeviceAttributesResultValue.md)
- [RemoteControlResult](docs/RemoteControlResult.md)
- [Response](docs/Response.md)
- [ResponseVisits](docs/ResponseVisits.md)
- [RootAppsResult](docs/RootAppsResult.md)
- [SeenAt](docs/SeenAt.md)
- [SignalResponseClonedApp](docs/SignalResponseClonedApp.md)
- [SignalResponseDeveloperTools](docs/SignalResponseDeveloperTools.md)
- [SignalResponseEmulator](docs/SignalResponseEmulator.md)
- [SignalResponseFactoryReset](docs/SignalResponseFactoryReset.md)
- [SignalResponseFrida](docs/SignalResponseFrida.md)
Expand All @@ -298,16 +336,22 @@ Class | Method | HTTP request | Description
- [SignalResponsePrivacySettings](docs/SignalResponsePrivacySettings.md)
- [SignalResponseProxy](docs/SignalResponseProxy.md)
- [SignalResponseRawDeviceAttributes](docs/SignalResponseRawDeviceAttributes.md)
- [SignalResponseRemoteControl](docs/SignalResponseRemoteControl.md)
- [SignalResponseRootApps](docs/SignalResponseRootApps.md)
- [SignalResponseSuspectScore](docs/SignalResponseSuspectScore.md)
- [SignalResponseTampering](docs/SignalResponseTampering.md)
- [SignalResponseTor](docs/SignalResponseTor.md)
- [SignalResponseVelocity](docs/SignalResponseVelocity.md)
- [SignalResponseVirtualMachine](docs/SignalResponseVirtualMachine.md)
- [SignalResponseVpn](docs/SignalResponseVpn.md)
- [Subdivision](docs/Subdivision.md)
- [SuspectScoreResult](docs/SuspectScoreResult.md)
- [TamperingResult](docs/TamperingResult.md)
- [TooManyRequestsResponse](docs/TooManyRequestsResponse.md)
- [TorResult](docs/TorResult.md)
- [VelocityIntervalResult](docs/VelocityIntervalResult.md)
- [VelocityIntervals](docs/VelocityIntervals.md)
- [VelocityResult](docs/VelocityResult.md)
- [VirtualMachineResult](docs/VirtualMachineResult.md)
- [Visit](docs/Visit.md)
- [VpnResult](docs/VpnResult.md)
Expand Down
Binary file removed bin/generator.jar
Binary file not shown.
145 changes: 0 additions & 145 deletions build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
val projectVersion: String by project

allprojects {
group = "com.fingerprint"
version = projectVersion
}

11 changes: 0 additions & 11 deletions config.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/BotdDetectionResult.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Stores bot detection result

| Name | Value |
|---- | ----- |
| NOTDETECTED | &quot;notDetected&quot; |
| NOT_DETECTED | &quot;notDetected&quot; |
| GOOD | &quot;good&quot; |
| BAD | &quot;bad&quot; |

Expand Down
Loading
Loading