Skip to content

Commit

Permalink
Version bump, Release to mavenCentral, update README.md, misc.
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzNotABug committed Jul 26, 2021
1 parent 6a5455e commit 13a6dd1
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 145 deletions.
56 changes: 22 additions & 34 deletions README.md
Expand Up @@ -7,8 +7,7 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/bb126216417b45668b81e08090d2d081)](https://www.codacy.com/gh/ItzNotABug/CheckoutVerifier/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ItzNotABug/CheckoutVerifier&utm_campaign=Badge_Grade)

CheckoutVerifier helps you Verify your In-App Purchase receipts & protect your Apps from hacking, patching used by Piracy Apps like Lucky Patcher.
<br/>Since I was using these classes in every project,\
the copy / pasting of classes was annoying so thought of releasing it as a library which might be of help to others too!
<br/>Since I was using these classes in every project, the copy / pasting of classes was annoying so thought of releasing it as a library which might be of help to others too!


## How does it work?
Expand All @@ -27,43 +26,32 @@ Just a create a File & name it as `verify.php` or anything you want.

```php
<?php
// get jsonResponse
$data = $_GET['jsonResponse'];

// get signature
$signature = $_GET['signature'];

// get key
$key_64 = "YOUR BASE64 KEY THAT YOU GOT FROM DEVELOPER CONSOLE, THERE SHOULD BE NO SPACES!";


$key = "-----BEGIN PUBLIC KEY-----\n".
chunk_split($key_64, 64,"\n").
'-----END PUBLIC KEY-----';

//using PHP to create an RSA key
$key = openssl_get_publickey($key);


// state whether signature is okay or not
$ok = openssl_verify($data, base64_decode($signature), $key, OPENSSL_ALGO_SHA1);
if ($ok == 1) {
echo "verified";
} elseif ($ok == 0) {
echo "unverified";
} else {
die ("fault, error checking signature");
}

// free the key from memory
openssl_free_key($key);
$data = $_GET['jsonResponse'];
$signature = $_GET['signature'];
$key_64 = "YOUR BASE64 KEY THAT YOU GOT FROM DEVELOPER CONSOLE, THERE SHOULD BE NO SPACES!";

$key = "-----BEGIN PUBLIC KEY-----\n".
chunk_split($key_64, 64,"\n").
"-----END PUBLIC KEY-----";

$key = openssl_get_publickey($key);

$ok = openssl_verify($data, base64_decode($signature), $key, OPENSSL_ALGO_SHA1);
if ($ok == 1) {
echo "verified";
} elseif ($ok == 0) {
echo "unverified";
} else {
die ("fault, error checking signature");
}

openssl_free_key($key);
?>
```

#### * Implementing Library (Gradle)
library_version: [![Download](https://api.bintray.com/packages/itznotabug/Maven/CheckoutVerifier/images/download.svg)](https://bintray.com/itznotabug/Maven/CheckoutVerifier/_latestVersion)
<br/>
Note: Add `mavenCentral()` in `repositories` block.

```gradle
dependencies {
// CheckoutVerifier now internally uses Kotlin Coroutines.
Expand Down
46 changes: 0 additions & 46 deletions bintray.gradle

This file was deleted.

18 changes: 12 additions & 6 deletions build.gradle
@@ -1,23 +1,29 @@
buildscript {
ext.kotlin_version = '1.4.21'
ext.kotlin_version = '1.5.21'

repositories {
google()
jcenter()
mavenCentral()
}

ext {
RELEASE_REPOSITORY_URL = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
SNAPSHOT_REPOSITORY_URL = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

classpath 'com.vanniktech:gradle-maven-publish-plugin:0.13.0'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
kotlin.code.style=official
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Sep 28 15:30:00 IST 2020
#Mon Jul 26 13:39:22 IST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
44 changes: 0 additions & 44 deletions install.gradle

This file was deleted.

1 change: 1 addition & 0 deletions library/.gitignore
@@ -1 +1,2 @@
/build
/gradle.properties
24 changes: 16 additions & 8 deletions library/build.gradle
@@ -1,27 +1,35 @@
apply plugin: 'com.android.library'
apply plugin: 'com.vanniktech.maven.publish'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 14
targetSdkVersion 30
versionCode 108
versionName "1.8"
versionCode 200
versionName "2.0.0"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
}

apply from: '../install.gradle'
apply from: '../bintray.gradle'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1'
}
Expand Up @@ -4,6 +4,8 @@ package com.lazygeniouz.checkoutverifier

import com.lazygeniouz.checkoutverifier.bundle.PurchaseBundle
import com.lazygeniouz.checkoutverifier.helper.CheckoutHelper
import com.lazygeniouz.checkoutverifier.results.CompletionResult
import com.lazygeniouz.checkoutverifier.results.ErrorResult
import com.lazygeniouz.checkoutverifier.results.Result
import org.jetbrains.annotations.NotNull

Expand All @@ -17,9 +19,9 @@ import org.jetbrains.annotations.NotNull
class CheckoutVerifier(@NotNull private val purchaseBundle: PurchaseBundle) {

/**
* An **ErrorResult** if an exception was caught,
* An [ErrorResult] if an exception was caught,
*
* A **CompletionResult** otherwise.
* A [CompletionResult] otherwise.
*
* @return [Result]
*/
Expand All @@ -34,5 +36,4 @@ class CheckoutVerifier(@NotNull private val purchaseBundle: PurchaseBundle) {
&& purchaseBundle.verifyingUrl.startsWith("http")
&& purchaseBundle.jsonResponse.trim().isNotEmpty()
&& purchaseBundle.signature.trim().isNotEmpty()

}

0 comments on commit 13a6dd1

Please sign in to comment.