Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): various fixes #44

Merged
merged 3 commits into from Jan 23, 2020
Merged

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Dec 19, 2019

  • Refactor decryption method
  • Handle invalidated keys
TEST CASE
var TouchID = require('ti.identity');
    keychainItem = TouchID.createKeychainItem({
        identifier: 'test_key',
        accessibilityMode: TouchID.ACCESSIBLE_WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
        //accessControlMode: TouchID.ACCESS_CONTROL_TOUCH_ID_ANY // remove this to save without fingerprint authentication
    }),
    win = Ti.UI.createWindow({backgroundColor: 'white', layout: 'vertical'});
    queue = [],
    callback = function(e) {
        if (queue.length) {
            queue.shift().close();
        }
        alert(JSON.stringify(e, null, 1));
    };

// require device to passcode protected when determining deviceCanAuthenticate()
TouchID.authenticationPolicy = TouchID.AUTHENTICATION_POLICY_PASSCODE;
 
keychainItem.addEventListener('save', callback);
keychainItem.addEventListener('read', callback);
keychainItem.addEventListener('reset', callback);
keychainItem.addEventListener('update', callback);
 
button('SAVE', function() {
    showFingerprint();
    keychainItem.save('test_save');
});
button('READ', function() {
    showFingerprint();
    keychainItem.read();
});
button('RESET', function() {
    showFingerprint();
    keychainItem.reset();
});
button('UPDATE', function() {
    showFingerprint();
    keychainItem.update('test_update');
});
button('CAN AUTHENTICATE', function() {
    alert(JSON.stringify(TouchID.deviceCanAuthenticate(), null, 1));
});
button('INVALIDATE', function() {
    TouchID.invalidate();
});
 
win.open();
 
function showFingerprint() {
    if (keychainItem.accessControlMode !== TouchID.ACCESS_CONTROL_TOUCH_ID_ANY) return;
    var win = Ti.UI.createWindow({backgroundColor: 'white'}),
        img = Ti.UI.createImageView({image: 'http://bit.ly/2ur2X4u', width: 64, height: 64});
    queue.push(win);
    win.add(img);
    win.open();
}
function button(title, click) {
    var btn = Ti.UI.createButton({title: title, width: Ti.UI.FILL});
    btn.addEventListener('click', click);
    win.add(btn);
}

JIRA Ticket

@build
Copy link

build commented Dec 19, 2019

Messages
📖

💾 Here are the artifacts produced:

📖

✅ All tests are passing
Nice one! All 61 tests are passing.

Generated by 🚫 dangerJS against a1a2a35

@garymathews garymathews merged commit c3d6b8e into tidev:master Jan 23, 2020
@hansemannn
Copy link
Contributor

@garymathews It seems like this is a breaking change thats breaks every app that used the module before. Is there a way to migrate saved tokens here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants