Created
July 15, 2015 11:35
-
-
Save PaddeK/646555ea524a884c650a to your computer and use it in GitHub Desktop.
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
if (null != mAdapterProvisions.getItem(position) && | |
null != ((NymiDevice) mAdapterProvisions.getItem(position)).getKeys() && | |
!((NymiDevice) mAdapterProvisions.getItem(position)).getKeys().isEmpty()) { | |
((NymiDevice) mAdapterProvisions.getItem(position)).sign("Message to be signed", | |
((NymiDevice) mAdapterProvisions.getItem(position)).getKeys().get(0), new NymiDevice.NymiSignCallback() { | |
@Override | |
public void onMessageSigned(int status, String signature) { | |
if (status == NymiDevice.NymiSignCallback.SIGN_LOCAL_SUCCESS) { | |
// Of course your code will want to make use of this value otherwise. | |
// This code intends to demonstrate flow. | |
Toast.makeText(MainActivity.this, "Sign (on a dummy message) returned: " + signature, Toast.LENGTH_SHORT).show(); | |
} else { | |
Toast.makeText(MainActivity.this, "Sign failed", Toast.LENGTH_SHORT).show(); | |
} | |
} | |
}); | |
} else { | |
Toast.makeText(MainActivity.this, "Error retrieving keys", Toast.LENGTH_SHORT).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment