Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk
Go SDK for Fingerprint Pro Server API
https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk
audio-fingerprinting browser browser-fingerprint browser-fingerprinting detection fingerprint fingerprinting fingerprintjs fingerprintjs-pro fraud fraud-detection golang identification visitor-identification
Last synced: 9 days ago
JSON representation
Go SDK for Fingerprint Pro Server API
- Host: GitHub
- URL: https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk
- Owner: fingerprintjs
- License: mit
- Created: 2022-08-10T11:51:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T13:16:59.000Z (20 days ago)
- Last Synced: 2024-10-29T15:22:28.582Z (20 days ago)
- Topics: audio-fingerprinting, browser, browser-fingerprint, browser-fingerprinting, detection, fingerprint, fingerprinting, fingerprintjs, fingerprintjs-pro, fraud, fraud-detection, golang, identification, visitor-identification
- Language: Go
- Homepage:
- Size: 19.9 MB
- Stars: 10
- Watchers: 10
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: contributing.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Fingerprint Pro Server Go SDK
[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering 99.5% accurate visitor identification.
Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.This Go package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 3
- Package version: 7.0.0-test.0
- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen## Requirements
Go Lang 1.21 or higher
We keep the [Go support policy](https://go.dev/doc/devel/release) and support the last two major versions of Go.
## Installation & Usage
1. Get the package from GitHub:
```shell
go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk
```2. Import and use the library:
```go
package mainimport (
"context"
"fmt"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk"
"log"
)func main() {
cfg := sdk.NewConfiguration()
client := sdk.NewAPIClient(cfg)// You can also use sdk.RegionUS or sdk.RegionAsia. Default one is sdk.RegionUS
//cfg.ChangeRegion(sdk.RegionEU)// Configure authorization, in our case with API Key
auth := context.WithValue(context.Background(), sdk.ContextAPIKey, sdk.APIKey{
Key: "SECRET_API_KEY",
})
// Usually this data will come from your frontend app
visitorId := "VISITOR_ID"
opts := sdk.FingerprintApiGetVisitsOpts{
RequestId: "REQUEST_ID_",
}
response, httpRes, err := client.FingerprintApi.GetVisits(auth, visitorId, &opts)
fmt.Printf("%+v\n", httpRes)if err != nil {
var tooManyRequestsError *sdk.TooManyRequestsErrorif errors.As(err, &tooManyRequestsError) {
log.Fatalf("Too many requests, retry after %d seconds", tooManyRequestsError.RetryAfter())
} else {
log.Fatal(err)
}
}fmt.Printf("Got response with visitorId: %s", response.VisitorId)
}
```> **Note**
> You can also check examples located in [example](./example) directory.
> To run the examples:
> ```shell
> cd example && FINGERPRINT_API_KEY=SECRET_API_KEY VISITOR_ID=VISITOR_ID_EXAMPLE go run getVisits.go
> ```
> Alternatively, you can define your environment variables inside `example/.env` file and run the examples without passing them as arguments.
> If your subscription region is not the “Global/US” region, use `REGION=eu` or `REGION=ap` in the line above or in your local `.env` file.### Region
If your subscription is in region other than US, you need to change the region in the configuration:
```goimport (
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk"
)func main() {
cfg := sdk.NewConfiguration()cfg.ChangeRegion(sdk.RegionEU) // or sdk.RegionAsia
}
```## Sealed results
This SDK provides utility methods for decoding [sealed results](https://dev.fingerprint.com/docs/sealed-client-results).
Install the sealed results dependency as below:
```shell
go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk/sealed
```
Then you can use below code to unseal results:
```go
package mainimport (
"encoding/base64"
"fmt"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk/sealed"
"os"
)// Utility function to decode base64 string
func base64Decode(input string) []byte {
output, err := base64.StdEncoding.DecodeString(input)
if err != nil {
panic(err)
}
return output
}func main() {
// Sealed result from the frontend.
sealedResult := base64Decode(os.Getenv("BASE64_SEALED_RESULT"))
// Base64 encoded key generated in the dashboard.
key := base64Decode(os.Getenv("BASE64_SEALED_RESULT_KEY"))keys := []sealed.DecryptionKey{
// You can provide more than one key to support key rotation. The SDK will try to decrypt the result with each key.
{
Key: key,
Algorithm: sealed.AlgorithmAES256GCM,
},
}
unsealedResponse, err := sealed.UnsealEventsResponse(sealedResult, keys)if err != nil {
panic(err)
}// Do something with unsealed response, e.g: send it back to the frontend.
fmt.Println(unsealedResponse)
}
```## Webhook signing
This SDK provides utility method for verifing the HMAC signature of the incoming [webhook](https://dev.fingerprint.com/docs/webhooks) request.
Install the webhook dependency as below:
```shell
go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk/webhook
```Then you can use below code to verify signature:
```go
package mainimport (
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk/webhook"
)func main() {
// Your webhook signing secret.
secret := "secret"// Request data. In real life scenario this will be the body of incoming request
data := []byte("data")// Value of the "fpjs-event-signature" header.
header := "v1=1b2c16b75bd2a870c114153ccda5bcfca63314bc722fa160d690de133ccbb9db"isValid := webhook.IsValidWebhookSignature(header, data, secret)
if !isValid {
panic("Invalid signature")
}
}
```To learn more, refer to example located in [example/sealedResults.go](./example/sealedResults.go).
## Documentation for API Endpoints
All URIs are relative to *https://api.fpjs.io*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*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* | [**GetRelatedVisitors**](docs/FingerprintApi.md#getrelatedvisitors) | **Get** /related-visitors | Get Related Visitors
*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## Documentation For Models
- [Asn](docs/Asn.md)
- [BotdDetectionResult](docs/BotdDetectionResult.md)
- [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)
- [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)
- [IdentificationError](docs/IdentificationError.md)
- [IncognitoResult](docs/IncognitoResult.md)
- [IpBlockListResult](docs/IpBlockListResult.md)
- [IpBlockListResultDetails](docs/IpBlockListResultDetails.md)
- [IpInfoResult](docs/IpInfoResult.md)
- [IpInfoResultV4](docs/IpInfoResultV4.md)
- [IpInfoResultV6](docs/IpInfoResultV6.md)
- [IpLocation](docs/IpLocation.md)
- [IpLocationCity](docs/IpLocationCity.md)
- [JailbrokenResult](docs/JailbrokenResult.md)
- [Location](docs/Location.md)
- [LocationSpoofingResult](docs/LocationSpoofingResult.md)
- [PrivacySettingsResult](docs/PrivacySettingsResult.md)
- [ProductError](docs/ProductError.md)
- [ProductsResponse](docs/ProductsResponse.md)
- [ProductsResponseBotd](docs/ProductsResponseBotd.md)
- [ProductsResponseIdentification](docs/ProductsResponseIdentification.md)
- [ProductsResponseIdentificationData](docs/ProductsResponseIdentificationData.md)
- [ProxyResult](docs/ProxyResult.md)
- [RelatedVisitor](docs/RelatedVisitor.md)
- [RelatedVisitorsResponse](docs/RelatedVisitorsResponse.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)
- [SignalResponseHighActivity](docs/SignalResponseHighActivity.md)
- [SignalResponseIncognito](docs/SignalResponseIncognito.md)
- [SignalResponseIpBlocklist](docs/SignalResponseIpBlocklist.md)
- [SignalResponseIpInfo](docs/SignalResponseIpInfo.md)
- [SignalResponseJailbroken](docs/SignalResponseJailbroken.md)
- [SignalResponseLocationSpoofing](docs/SignalResponseLocationSpoofing.md)
- [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)
- [VpnResult](docs/VpnResult.md)
- [VpnResultMethods](docs/VpnResultMethods.md)
- [WebhookVisit](docs/WebhookVisit.md)## Documentation For Authorization
## ApiKeyHeader
- **Type**: API key
- **API key parameter name**: Auth-API-Key
- **Location**: HTTP header## ApiKeyQuery
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: URL query string## Documentation for sealed results
- [SealedResults](docs/SealedResults.md)
- [DecryptionKey](docs/DecryptionKey.md)## Documentation for webhooks
- [DecryptionKey](docs/Webhook.md)
## Author
## Support and feedback
To report problems, ask questions or provide feedback, please use [Issues](https://github.com/fingerprintjs/fingerprintjs-pro-server-api-go-sdk/issues). If you need private support, you can email us at [[email protected]](mailto:[email protected]).
## License
This project is licensed under the [MIT license](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/blob/main/LICENSE).