Skip to content

Commit

Permalink
feat(cordova-secure-storage-echo): add extra options interface (#3295)
Browse files Browse the repository at this point in the history
  • Loading branch information
BorntraegerMarc authored and danielsogl committed Jan 27, 2020
1 parent 799cf94 commit 95a67a8
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions src/@ionic-native/plugins/secure-storage-echo/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import { Injectable } from '@angular/core';
import { CordovaCheck, CordovaInstance, IonicNativePlugin, Plugin, getPromise } from '@ionic-native/core';
import { CordovaCheck, CordovaInstance, getPromise, IonicNativePlugin, Plugin } from '@ionic-native/core';

export interface SecureStorageEchoOptions {
android: {
/**
* See https://github.com/mibrito707/cordova-plugin-secure-storage-echo#sharing-data-android
*/
packageName?: string;
/**
* Sets the duration of time (seconds) for which the Private Encryption Key is authorized to be used after the user is successfully authenticated.
* See https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder.html#setUserAuthenticationValidityDurationSeconds(int)
*/
userAuthenticationValidityDuration?: number;
/**
* Custom title for Confirm Credentials screen.
* See https://developer.android.com/reference/android/app/KeyguardManager.html#createConfirmDeviceCredentialIntent(java.lang.CharSequence,%20java.lang.CharSequence)
*/
unlockCredentialsTitle?: string;
/**
* Custom description for Confirm Credentials screen.
*/
unlockCredentialsDescription?: string;
};
}

/**
* @hidden
Expand Down Expand Up @@ -137,13 +160,14 @@ export class SecureStorageEcho extends IonicNativePlugin {
* @returns {Promise<SecureStorageEchoObject>}
*/
@CordovaCheck()
create(store: string): Promise<SecureStorageEchoObject> {
create(store: string, options?: SecureStorageEchoOptions): Promise<SecureStorageEchoObject> {
return getPromise<SecureStorageEchoObject>((res: Function, rej: Function) => {
const instance = new (SecureStorageEcho.getPlugin())(
() => res(new SecureStorageEchoObject(instance)),
rej,
store
);
});
const instance = new (SecureStorageEcho.getPlugin())(
() => res(new SecureStorageEchoObject(instance)),
rej,
store,
options
);
});
}
}

0 comments on commit 95a67a8

Please sign in to comment.