Skip to content

Commit

Permalink
feat(unvired-cordova-sdk): add ability to receive the JWT token (#3671)
Browse files Browse the repository at this point in the history
* feat(unvired-cordova-sdk): support login via email

* fix(unvired-cordova-sdk): return typed promise object for user settings

* fix(unvired-cordova-sdk): change return type to string for guid()

* doc(unvired-cordova-sdk): doc update

* doc(unvired-cordova-sdk): update doc

* feat(unvired-cordova-sdk): add support for metadata JSON

* doc(unvired-cordova-sdk): update doc

* doc(unvired-cordova-sdk): update doc

* feat(unvired-cordova-sdk): add methods to get and set log level

* fix(unvired-cordova-sdk): update the return type for getLog()

* feat(unvired-cordova-sdk): return platform name

* feat(unvired-cordova-sdk): add method to get log file path

* feat(unvired-cordova-sdk): test push notifications

* fix(unvired-cordova-sdk): define return for logRead

* doc(unvired-cordova-sdk): remove mobile only restriction for some apis

* feat(unvired-cordova-sdk): add new property containing HTTP status code.

* feat(unvired-cordova-sdk): add new functions to lock & unlock sending of data

* fix(unvired-cordova-sdk): update the return type for lock and unlock functions.

* fix(unvired-cordova-sdk): change the return type for lockDataSender api

* fix(unvired-cordova-sdk): fix the data type for ResultType and OutboxLockStatus

* doc(unvired-cordova-sdk): Update doc

* doc(unvired-cordova-sdk): Update doc

* feat(unvired-cordova-sdk): Added new notification type

* feat(unvired-cordova-sdk): delete outbox item based on lid

* fix(unvired-cordova-sdk): Update doc

* doc(unvired-cordova-sdk): Update doc for userSettings()

* feat(unvired-cordova-sdk): add new discovery api

* fix(unvired-cordova-sdk): rename the property

* doc(unvired-cordova-sdk): Doc update

* fix(unvired-cordova-sdk): Update the return type for startDiscoveryService api

* doc(unvired-cordova-sdk): Rename the loginParameter languageCode to loginLanguage.

* changes after doing npm install

* feat(unvired-cordova-sdk): Add a new login parameter to send jwt options.

* feat(unvired-cordova-sdk): add new function to cache website data

* feat(unvired-cordova-sdk): new function to export the database for browser platform

* fix(unvired-cordova-sdk): fix method names

* feat(unvired-cordova-sdk): add new function 'setClientCredentials'

* doc(unvired-cordova-sdk): Update doc

* fix(unvired-cordova-sdk): Create a new Credential object and pass that as an input to the setClientCredentials() function.

* fix(unvired-cordova-sdk): Fix the typo in the function parameter.

* fix(unvired-cordova-sdk): Changed the type of port to string.

* feat(unvired-cordova-sdk): add methods to encrypt and decrypt the string.

* Delete package-lock.json

removed the package-locj.json from the PR

Co-authored-by: Srinidhi Anand Rao <[email protected]>
  • Loading branch information
srinidhirao and Srinidhi Anand Rao authored Aug 2, 2021
1 parent b206b42 commit 50d9110
Showing 1 changed file with 81 additions and 2 deletions.
83 changes: 81 additions & 2 deletions src/@ionic-native/plugins/unvired-cordova-sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export enum LoginType {
* Set the type to email to login based on email id.
*/
email = 'EMAIL',
/**
* SAML 2.0 Login Type
*/
saml2 = 'SAML2',
/**
* TODO:
*/
Expand Down Expand Up @@ -207,6 +211,10 @@ export enum NotificationListenerType {
* Notify when the sent item count changes.
*/
SentItemChanged = 11,
/**
* Notify that the JWT token is received
*/
JWTTokenReceived = 12
}

export enum AttachmentItemStatus {
Expand Down Expand Up @@ -390,8 +398,7 @@ export class LoginParameters {
persistWebDb: boolean;

/*
* Optional jwt token parameter. Please check with your Unvired Admin for this value.
* For Example:
* JWT options.
* loginParameters.jwtOptions = {"app": "myapp"};
*/
jwtOptions: object;
Expand All @@ -401,6 +408,18 @@ export class LoginParameters {
* The default value of this is 'en'.
*/
loginLanguage: string;

/**
* Applicable for browser only. Set this flag to indicate that saved data should be reloaded upon launch.
*/
cacheWebData: boolean;

/**
* Set this value if you the login process requires client credentials to be set.
* You can pass the client credentials with the method: |unviredSDK.setClientCredentials(credentials)|
* The passed credentials will be used based on this flag.
*/
requireClientCredentials: boolean;
}
export class LoginResult extends UnviredResult {
type: LoginListenerType;
Expand All @@ -414,6 +433,12 @@ export class AuthenticateLocalResult extends UnviredResult {
type: AuthenticateLocalResultType;
}

export class UnviredCredential {
user: string;
password: string;
port: string;
}

/**
* @name Unvired Cordova SDK
* @description
Expand Down Expand Up @@ -1055,6 +1080,24 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
return;
}

/**
* Browser platform only. Call this function to save the WebData. This function can be used to preserve a large data that is downloaded.
* If you set the loginParameter flag, |cacheWebData|, then the plugin loads this data.
*/
@Cordova()
dbSaveWebData(): Promise<any> {
return;
}

/**
* Browser platform only. Call this function to export the Webdata.
* Call this function to export the Web
*/
@Cordova()
dbExportWebData(): Promise<any> {
return;
}

/**
* Supported in Android & Windows only.
* Launch a file from a file path
Expand Down Expand Up @@ -1513,4 +1556,40 @@ export class UnviredCordovaSDK extends IonicNativePlugin {
startDiscoveryService(): Promise<UnviredResult> {
return;
}

/**
* Use this function to set the SAP credentials to be sent to UMP.
* @param credentials Array of |Credential| objects.
*/
@Cordova()
setClientCredentials(credentials: UnviredCredential[]) {
return;
}

/**
* Check for client credentials.
* @returns Returns true if client credentials are set
*/
@Cordova()
isClientCredentialsSet(): Promise<UnviredResult> {
return;
}

/**
* Encrypt a string with the key stored by the Unvired SDK.
* @returns UnviredResult.data which should contains the encrypted string.
*/
@Cordova()
encrypt(stringToBeEncrypted: string): Promise<UnviredResult> {
return;
}

/**
* Decrypt a string with the string encrypted with the key (key stored by the Unvired SDK)
* @returns UnviredResult.data which should contains the decrypted string.
*/
@Cordova()
decrypt(stringToBeDecrypted: string): Promise<UnviredResult> {
return;
}
}

0 comments on commit 50d9110

Please sign in to comment.