Skip to content

Commit

Permalink
hide classes that are not relevant for external usage (#5)
Browse files Browse the repository at this point in the history
hide classes that are not relevant for external usage
  • Loading branch information
Mauin authored Aug 7, 2016
1 parent edf71c9 commit 28f7582
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mtramin.rxfingerprint.data;
package com.mtramin.rxfingerprint;

import android.util.Base64;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.utils;
package com.mtramin.rxfingerprint;

import android.content.Context;

/**
* Utility methods for {@link Context}s
*/
public class ContextUtils {
class ContextUtils {

/**
* Returns the package name of the current application using this library
*
* @param context current context
* @return Package name of the application
*/
public static String getPackageName(Context context) {
static String getPackageName(Context context) {
return context.getPackageName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.data;
package com.mtramin.rxfingerprint;

import android.support.annotation.NonNull;
import android.util.Base64;

/**
* Data of a cryptographic operation with RxFingerprint.
*/
public class CryptoData {
class CryptoData {
private static final String SEPARATOR = "-_-";

private final String messageEncoded;
Expand All @@ -44,7 +44,7 @@ private CryptoData(String message, String iv) {
* @param input input string that was previously encrypted by RxFingerprint
* @return parsed data
*/
public static CryptoData fromString(String input) {
static CryptoData fromString(String input) {
if (input == null) {
throw new NullPointerException("Input for decryption is null. Make sure to provide a valid, encrypted String for decryption.");
}
Expand All @@ -64,7 +64,7 @@ public static CryptoData fromString(String input) {
* @param ivBytes initialization vector in bytes
* @return parsed data
*/
public static CryptoData fromBytes(byte[] messageBytes, byte[] ivBytes) {
static CryptoData fromBytes(byte[] messageBytes, byte[] ivBytes) {
return new CryptoData(messageBytes, ivBytes);
}

Expand All @@ -76,18 +76,18 @@ public String toString() {
/**
* @return initialization vector of the crypto operation
*/
public byte[] getIv() {
byte[] getIv() {
return decode(ivEncoded);
}

/**
* @return message of the crypto operation
*/
public byte[] getMessage() {
byte[] getMessage() {
return decode(messageEncoded);
}

private byte[] decode(String messageEncoded) {
byte[] decode(String messageEncoded) {
return Base64.decode(messageEncoded, Base64.DEFAULT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.utils;
package com.mtramin.rxfingerprint;

import android.annotation.TargetApi;
import android.content.Context;
Expand Down Expand Up @@ -45,7 +45,7 @@
* Provider class for cryptographic elements used in the encryption/decryption
* of {@link com.mtramin.rxfingerprint.RxFingerprint}
*/
public class CryptoProvider {
class CryptoProvider {

private static final String ANDROID_KEY_STORE = "AndroidKeyStore";
private static final String DEFAULT_KEY_NAME = "rxfingerprint_default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.observables;
package com.mtramin.rxfingerprint;

import android.content.Context;
import android.support.annotation.Nullable;
Expand All @@ -29,7 +29,7 @@
/**
* Authenticates the user with his fingerprint.
*/
public class FingerprintAuthenticationObservable extends FingerprintObservable<FingerprintAuthenticationResult> {
class FingerprintAuthenticationObservable extends FingerprintObservable<FingerprintAuthenticationResult> {

private FingerprintAuthenticationObservable(Context context) {
super(context);
Expand All @@ -42,7 +42,7 @@ private FingerprintAuthenticationObservable(Context context) {
* @param context context to use
* @return Observable {@link FingerprintAuthenticationResult}
*/
public static Observable<FingerprintAuthenticationResult> create(Context context) {
static Observable<FingerprintAuthenticationResult> create(Context context) {
return Observable.create(new FingerprintAuthenticationObservable(context));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.observables;
package com.mtramin.rxfingerprint;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;

import com.mtramin.rxfingerprint.data.CryptoData;
import com.mtramin.rxfingerprint.data.FingerprintDecryptionResult;
import com.mtramin.rxfingerprint.data.FingerprintEncryptionResult;
import com.mtramin.rxfingerprint.data.FingerprintResult;
import com.mtramin.rxfingerprint.utils.CryptoProvider;

import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
Expand All @@ -49,7 +47,7 @@
* <p/>
* The date handed in must be previously encrypted by a {@link FingerprintEncryptionObservable}.
*/
public class FingerprintDecryptionObservable extends FingerprintObservable<FingerprintDecryptionResult> {
class FingerprintDecryptionObservable extends FingerprintObservable<FingerprintDecryptionResult> {

private final String keyName;
private final CryptoData encryptedData;
Expand All @@ -69,7 +67,7 @@ private FingerprintDecryptionObservable(Context context, String keyName, String
* @param encrypted data to encrypt @return Observable {@link FingerprintEncryptionResult}
* @return Observable result of the decryption
*/
public static Observable<FingerprintDecryptionResult> create(Context context, String keyName, String encrypted) {
static Observable<FingerprintDecryptionResult> create(Context context, String keyName, String encrypted) {
return Observable.create(new FingerprintDecryptionObservable(context, keyName, encrypted));
}

Expand All @@ -81,7 +79,7 @@ public static Observable<FingerprintDecryptionResult> create(Context context, St
* @param encrypted data to encrypt @return Observable {@link FingerprintEncryptionResult}
* @return Observable result of the decryption
*/
public static Observable<FingerprintDecryptionResult> create(Context context, String encrypted) {
static Observable<FingerprintDecryptionResult> create(Context context, String encrypted) {
return Observable.create(new FingerprintDecryptionObservable(context, null, encrypted));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.observables;
package com.mtramin.rxfingerprint;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;

import com.mtramin.rxfingerprint.data.CryptoData;
import com.mtramin.rxfingerprint.data.FingerprintEncryptionResult;
import com.mtramin.rxfingerprint.data.FingerprintResult;
import com.mtramin.rxfingerprint.utils.CryptoProvider;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
Expand All @@ -50,7 +48,7 @@
* can only be used with fingerprint authentication and uses it once authentication was successful
* to encrypt the given data.
*/
public class FingerprintEncryptionObservable extends FingerprintObservable<FingerprintEncryptionResult> {
class FingerprintEncryptionObservable extends FingerprintObservable<FingerprintEncryptionResult> {

private final String keyName;
private final String toEncrypt;
Expand All @@ -73,7 +71,7 @@ private FingerprintEncryptionObservable(Context context, String keyName, String
* @param keyName name of the key in the keystore
*@param toEncrypt data to encrypt @return Observable {@link FingerprintEncryptionResult}
*/
public static Observable<FingerprintEncryptionResult> create(Context context, String keyName, String toEncrypt) {
static Observable<FingerprintEncryptionResult> create(Context context, String keyName, String toEncrypt) {
return Observable.create(new FingerprintEncryptionObservable(context, keyName, toEncrypt));
}

Expand All @@ -84,7 +82,7 @@ public static Observable<FingerprintEncryptionResult> create(Context context, St
* @param context context to use
*@param toEncrypt data to encrypt @return Observable {@link FingerprintEncryptionResult}
*/
public static Observable<FingerprintEncryptionResult> create(Context context, String toEncrypt) {
static Observable<FingerprintEncryptionResult> create(Context context, String toEncrypt) {
return Observable.create(new FingerprintEncryptionObservable(context, null, toEncrypt));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.mtramin.rxfingerprint.observables;
package com.mtramin.rxfingerprint;

import android.content.Context;
import android.support.annotation.NonNull;
Expand All @@ -23,7 +23,6 @@
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat.AuthenticationCallback;
import android.support.v4.os.CancellationSignal;

import com.mtramin.rxfingerprint.RxFingerprint;
import com.mtramin.rxfingerprint.data.FingerprintAuthenticationException;

import rx.Observable;
Expand All @@ -34,7 +33,7 @@
* Base observable for Fingerprint authentication. Provides abstract methods that allow
* to alter the input and result of the authentication.
*/
public abstract class FingerprintObservable<T> implements Observable.OnSubscribe<T> {
abstract class FingerprintObservable<T> implements Observable.OnSubscribe<T> {

protected final Context context;
private CancellationSignal cancellationSignal;
Expand All @@ -44,7 +43,7 @@ public abstract class FingerprintObservable<T> implements Observable.OnSubscribe
*
* @param context Context to be used for the fingerprint authentication
*/
protected FingerprintObservable(Context context) {
FingerprintObservable(Context context) {
this.context = context.getApplicationContext();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
import com.mtramin.rxfingerprint.data.FingerprintAuthenticationResult;
import com.mtramin.rxfingerprint.data.FingerprintDecryptionResult;
import com.mtramin.rxfingerprint.data.FingerprintEncryptionResult;
import com.mtramin.rxfingerprint.observables.FingerprintAuthenticationObservable;
import com.mtramin.rxfingerprint.observables.FingerprintDecryptionObservable;
import com.mtramin.rxfingerprint.observables.FingerprintEncryptionObservable;

import rx.Observable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mtramin.rxfingerprint.utils;
package com.mtramin.rxfingerprint;

import android.content.Context;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.mtramin.rxfingerprint.observables;
package com.mtramin.rxfingerprint;

import android.content.Context;
import android.os.Handler;
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
import android.support.v4.os.CancellationSignal;

import com.mtramin.rxfingerprint.RxFingerprint;
import com.mtramin.rxfingerprint.data.FingerprintAuthenticationException;
import com.mtramin.rxfingerprint.data.FingerprintAuthenticationResult;
import com.mtramin.rxfingerprint.data.FingerprintResult;
Expand Down

0 comments on commit 28f7582

Please sign in to comment.