This repository was archived by the owner on May 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Implement code signing for client android SDK #966
Merged
sergey-akhalkov
merged 11 commits into
microsoft:master
from
ruslan-bikkinin:code-signing-new
Sep 13, 2017
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f005432
Add new optional way to create CodePush instance based on builder pat…
ruslan-bikkinin 2acdc87
Adapt changes from old code-signing branch
ruslan-bikkinin ea15d6d
Non-breaking change of CodePush constructor, downgrade jwt library
ruslan-bikkinin 53a933b
Make code signing optional
26aca17
Add small improvements
226cf8c
Rename method verifyJWT with verifyAndDecodeJWT
ruslan-bikkinin 1f1bb59
Add minor fixes
ruslan-bikkinin ba08800
Fix constructors
ruslan-bikkinin e4d5685
Fix constructors bug
ruslan-bikkinin fe43f3e
Fix log messages
ruslan-bikkinin 6945e4b
Merge branch 'master' into code-signing-new
sergey-akhalkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think if we ever need this
if blockhere due to we can move thislogstatement (and this is the only thing that this block is doing now) to Line 255 right after newif (isDiffUpdate)block begins.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@max-mironov no, we can't, because logging should be executed anyway regardless signature verification enabled or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha! May be we can also state what kind of update is applying currently with
isDiffUpdate ? CodePushUtils.log("Applying diff update.") : CodePushUtils.log("Applying full update.")but that is completely up to you.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@max-mironov, good proposition, i think i'll do it your way ☝️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@max-mironov changes added, thx!