Skip to content

Instantly share code, notes, and snippets.

@PaddeK
Created July 15, 2015 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaddeK/646555ea524a884c650a to your computer and use it in GitHub Desktop.
Save PaddeK/646555ea524a884c650a to your computer and use it in GitHub Desktop.
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