forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement code signing for client android SDK (microsoft#966)
* Add new optional way to create CodePush instance based on builder pattern Add constructor with additional option PublicKeyFilePath * Adapt changes from old code-signing branch Add `com.auth0:java-jwt:3.2.0` to deps Adapt changes from code-signing branch Fix errors appeared due to jwt library update. * Non-breaking change of CodePush constructor, downgrade jwt library Replace publicKey by publicKeyResourceDescriptor in CodePush constructor Downgrade jwt library to 2.2.2 due to issue with base64 decoding * Make code signing optional * Add small improvements Replace CodePushUnknownException catch with CodePushInvalidPublicKeyException in certain places Make mPublicKey static Add additional log for applying updates * Rename method verifyJWT with verifyAndDecodeJWT * Add minor fixes Add additional checking for potential problems with code-signing integration Fix Public Key parsing from strings.xml * Fix constructors * Fix constructors bug * Fix log messages
- Loading branch information
1 parent
4ab0e5e
commit 5e332bb
Showing
8 changed files
with
260 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.microsoft.codepush.react; | ||
|
||
import android.content.Context; | ||
|
||
public class CodePushBuilder { | ||
private String mDeploymentKey; | ||
private Context mContext; | ||
|
||
private boolean mIsDebugMode; | ||
private String mServerUrl; | ||
private Integer mPublicKeyResourceDescriptor; | ||
|
||
public CodePushBuilder(String deploymentKey, Context context) { | ||
this.mDeploymentKey = deploymentKey; | ||
this.mContext = context; | ||
this.mServerUrl = CodePush.getServiceUrl(); | ||
} | ||
|
||
public CodePushBuilder setIsDebugMode(boolean isDebugMode) { | ||
this.mIsDebugMode = isDebugMode; | ||
return this; | ||
} | ||
|
||
public CodePushBuilder setServerUrl(String serverUrl) { | ||
this.mServerUrl = serverUrl; | ||
return this; | ||
} | ||
|
||
public CodePushBuilder setPublicKeyResourceDescriptor(int publicKeyResourceDescriptor) { | ||
this.mPublicKeyResourceDescriptor = publicKeyResourceDescriptor; | ||
return this; | ||
} | ||
|
||
public CodePush build() { | ||
return new CodePush(this.mDeploymentKey, this.mContext, this.mIsDebugMode, this.mServerUrl, this.mPublicKeyResourceDescriptor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...oid/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.microsoft.codepush.react; | ||
|
||
class CodePushInvalidPublicKeyException extends RuntimeException { | ||
|
||
public CodePushInvalidPublicKeyException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public CodePushInvalidPublicKeyException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.