Skip to content

Commit

Permalink
restore changes to crypt.java
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Jul 10, 2017
1 parent 8c0ed55 commit f48def3
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions app/src/main/java/org/standardnotes/notes/comms/Crypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public void run() {
String stringToAuth = String.format("%d:%s", params.getPwCost(), params.getPwSalt());
String localAuth = createHash(stringToAuth, ak);

<<<<<<< HEAD
final Runnable signInBlock = new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -150,7 +149,9 @@ public void onFailure(Call<SigninResponse> call, Throwable t) {
"Login Anyway",
new Runnable() {
@Override
public void run() { signInBlock.run(); }
public void run() {
signInBlock.run();
}
},
new Runnable() {
@Override
Expand All @@ -165,17 +166,9 @@ public void run() {
}
}
);
=======
if(params.getPwAuth().length() == 0) {
// no pw_auth returned by server
// TODO Show alert:
// "Verification Tag Not Found"
// "Cannot verify authenticity of server parameters. Please visit standardnotes.org/verification to learn more. Do you wish to continue login?"
return;
>>>>>>> parent of e8cbd42... error decrypting flag
}

if(!localAuth.equals(params.getPwAuth())) {
else if(!localAuth.equals(params.getPwAuth())) {
// invalid parameters sent by server
showAlert(activity,
"Invalid Verification Tag",
Expand Down Expand Up @@ -215,7 +208,7 @@ public static void doRegister(final String email, final String password, final C
@Override
public void run() {
try {
AuthParamsResponse params = Crypt.getDefaultAuthParams(email);
final AuthParamsResponse params = Crypt.getDefaultAuthParams(email);
byte[] key = Crypt.generateKey(
password.getBytes(Charsets.UTF_8),
params.getPwSalt().getBytes(Charsets.UTF_8),
Expand All @@ -236,6 +229,7 @@ public void onResponse(Call<SigninResponse> call, Response<SigninResponse> respo
if (response.isSuccessful()) {
SApplication.Companion.getInstance().getValueStore().setTokenAndMasterKey(response.body().getToken(), mk, ak);
SApplication.Companion.getInstance().getValueStore().setEmail(email);
SApplication.Companion.getInstance().getValueStore().setAuthParams(params);
}
callback.onResponse(call, response);
}
Expand Down Expand Up @@ -382,6 +376,7 @@ public static EncryptedItem encrypt(EncryptableItem thing, String version) {
EncryptedItem item = new EncryptedItem();
copyInEncryptableItemFields(thing, item, version);
String contentJson = null;
item.setEncItemKey(Crypt.generateEncryptedKey(512, version, item.getUuid()));
Keys keys = Crypt.getItemKeys(item, version);
if (thing instanceof Note) {
item.setContentType(ContentType.Note.toString());
Expand Down

0 comments on commit f48def3

Please sign in to comment.