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

Made "getPlainText" a public method for use in native code #84

Merged
merged 1 commit into from
Aug 9, 2020
Merged

Conversation

crutchcorn
Copy link
Contributor

Currently, there is no easy way to access a secure token from the native code of an app. However, there are instances where this may be useful.

This PR makes the getPlainText method public so that we're able to use it in Java native interop code:

public class GitModule extends ReactContextBaseJavaModule {
    private static ReactApplicationContext reactContext;

    GitModule(ReactApplicationContext context) {
        super(context);
        reactContext = context;
    }

    @ReactMethod
    public void clone(
        String uri,
        String path,
        Promise promise
    ) {

        RNSecureKeyStoreModule keyStoreModule = new RNSecureKeyStoreModule(reactContext);

        String ghToken = "";
        try {
            ghToken = keyStoreModule.getPlainText("ghToken");
        } catch (Throwable e) {
            e.printStackTrace();
            promise.reject(e);
        }
    }
}

This would be the answered question for #35

@pradeep1991singh pradeep1991singh merged commit 133a1a9 into pradeep1991singh:master Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants