2.2.38 • Published 7 months ago

@payrail/ancore v2.2.38

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

Ancore Cloud Framework

Import the SDK to your application

import { AncoreClient,  UriPath, OAuthCredential,Misc} from '@payrail/ancore'

const client = new AncoreClient( new UriPath('https://d30j1fl4d3p9wd.cloudfront.net'));

To perform user onboarding

<!-- * Call to onboard an account
* @param options : the onboard params.
* @returns a promise to the onboarding status.
* @technote The onboarding process occurs in phases;
*  - Pass in the options with email or phone number field. (This will be passed at every phase of the onboarding process)
*  - On response status of `verify` display 2fa UI and add the input in options.mfa
*  - On response status of `processing` display kyc form and add the input to options.accountProvisionSettings
*  - On response status of `complete` or `verified` display success take to sign-in ui.
*  End

* Call handleOnboardingStatus function to receive onboarding status event -->

  client.handleOnboardingStatus = (evt) => {
      <!-- * Perform any other implementation you want to do -->
      }

      <!-- * Define function that object of a user with email or phone number
      * @param {email | phone} payload  -->

      await client.onboarding(payload);

To perform user mfa verification

 <!-- * Call the onboarding function to validate the user mfa to the account
 * Define the function to verify OTP code sent to user email or phone number
 * @param {email | phone, mfa} payload 
 * @returns Success object 
 *  - On response status of `processing` display kyc form and add the input to options.accountProvisionSettings
* Call handleOnboardingStatus function to receive onboarding status event -->

  client.handleOnboardingStatus = (evt) => {
        <!-- * Perform any other implementation you want to do -->
      }
 <!-- * Define function that object of a user with email or phone number and mfa code -->
  await client.onboarding(payload);

To perform bvn validation

<!-- * Call the onboarding function to validate the user bvn to the account
* @param options: the onboard params.
* @returns a promise to the onboarding status.
* @technote The onboarding process occurs in phases;
*  - Pass in the options with email or phone number field. (This will be passed at every phase of the onboarding process)
*  - On response status of `verify` display 2fa UI and add the input in options.mfa
*  - On response status of `processing` display kyc form and add the input to options.accountProvisionSettings
*  - On response status of `complete` or `verified` display success take to sign-in ui.
*  End
   * Call handleOnboardingStatus function to receive onboarding status event -->

  client.handleOnboardingStatus = (evt) => {
         <!-- * Perform any other implementation you want to do -->
      }

      <!-- * Define function that object of a user with email or phone number
      * @param {email | phone, mfa, bvn} payload  -->
      
      await client.onboarding(payload);

To perform user identity onboarding

    <!-- * Call the onboarding function to perform the user identity
    * @param options: the onboard params.
    * @returns a promise to the onboarding status.
    * @technote The onboarding process occurs in phases;
    *  - Pass in the options with email or phone number field. (This will be passed at every phase of the onboarding process)
    *  - On response status of `verify` display 2fa UI and add the input in options.mfa
    *  - On response status of `processing` display kyc form and add the input to options.accountProvisionSettings
    *  - On response status of `complete` or `verified` display success take to sign-in ui.
    *  End

    * Call handleOnboardingStatus function to receive onboarding status event -->

    client.handleOnboardingStatus = (evt) => {
             <!-- * Perform any other implementation you want to do -->
        }

        <!-- * Define function that object of a user with email or phone number
        * @param -->

        const payload = {email | phone, mfa, kyc:{
            bvn,
            firstname,
            lastname
        },
            accountProvisionSettings: {
            subscriber_account_name: payload.subscriber_account_name,
            subscriber_data_security_mode: 'system',
            subscriber_dataprotection_algo: 'none',
            administratorCredentials: new OAuthCredential(
                Misc.GenerateId(Misc.Constants.MAX_ID_LENGTH),
                Misc.GenerateId(Misc.Constants.MAX_ID_LENGTH),
                {email | phone},
                password,
                false,
            ).serialize(SerializeFormats.HIBERNATESTATE_FORMAT)
        } }  
        
        await client.onboarding(payload);

To perform user authentication

<!-- * Call to authenticate credentials in exchange for a Session on the platform.
* This uses an Oauth style architecture.
* @param username : the authentication credentials username.
* @param secret : the authentication credentials secret.
* @param options : the optional platform subscriber info that must be passed with the subscriber's UUID hash.
* @returns a promise to a service telegram response from the endpoint.
* The handleMfaRequired function needs to be called before the authenticate method, the method got triggered if 2FA is required. -->

 client.handleMfaRequired = (evt) => {
        <!-- * Perform any other implementation you want to do -->
      }
<!-- * This authenticate function returned a session object if no 2FA is required -->
     const session = await client.authenticate(username,
      secret,
        {
            uuidHash: uuidHash
        }
    );

To perform user authentication

 <!-- * Define the function to verify 2FA code sent to user email or phone number
* @param username : the authentication credentials username.
* @param secret : the authentication credentials secret.
* @param options : the optional platform subscriber info that must be passed with the subscriber's UUID hash.
* @returns a promise to a service telegram response from the endpoint.
 
* This authenticate function returned a session object if no 2FA is required -->
     const session = await client.authenticate(username,
      secret,
        {
            uuidHash: uuidHash
            mfa: mfa,
            signinResponse: signinResponse
        }
    );

Call to perform user signout

   <!-- * Call to signout session
   * @returns true if signout was successful. -->

        await client.signout();

Call to get user account information

  <!-- * Call to get information of the active Session's account.
  * @returns the active/last Session's account information. -->

    await client.accountinfo();

To get the information (which is the AccountInfo interface in the SDK source code) of the account after an onboarding success response or after a session is received during the sign-in process.

client.accountInfo() 

To get the amount of time (in seconds) the server is requesting the client to hold-on before trying to request another OTP.

client.waitTime() 

To get the last message that was sent to the client from the server during the onboarding process.

client.message() 

You can also handle Account ID missing from client cache by listening/registering for event handler and display the Account ID input field only when it's not available.

client.handleSubscriberUuidHashRequired(evt)
2.1.89

9 months ago

2.1.87

9 months ago

2.1.88

9 months ago

2.1.85

9 months ago

2.1.86

9 months ago

2.1.83

9 months ago

2.1.84

9 months ago

2.1.81

9 months ago

2.1.82

9 months ago

2.1.80

9 months ago

2.1.98

9 months ago

2.1.99

9 months ago

2.1.96

9 months ago

2.1.97

9 months ago

2.1.95

9 months ago

2.1.92

9 months ago

2.1.93

9 months ago

2.1.90

9 months ago

2.1.91

9 months ago

2.1.27

10 months ago

2.1.28

10 months ago

2.1.25

10 months ago

2.1.26

10 months ago

2.1.23

10 months ago

2.1.24

10 months ago

2.1.22

10 months ago

2.1.29

10 months ago

2.1.38

10 months ago

2.1.39

10 months ago

2.1.36

10 months ago

2.1.37

10 months ago

2.1.34

10 months ago

2.1.35

10 months ago

2.1.32

10 months ago

2.1.33

10 months ago

2.1.30

10 months ago

2.1.31

10 months ago

2.2.17

8 months ago

2.2.1

9 months ago

2.1.49

10 months ago

2.2.18

8 months ago

2.2.0

9 months ago

2.2.15

9 months ago

2.2.3

9 months ago

2.1.47

10 months ago

2.2.16

8 months ago

2.2.2

9 months ago

2.1.48

10 months ago

2.2.13

9 months ago

2.2.5

9 months ago

2.1.45

10 months ago

2.2.14

9 months ago

2.2.4

9 months ago

2.1.46

10 months ago

2.2.11

9 months ago

2.2.7

9 months ago

2.1.43

10 months ago

2.2.12

9 months ago

2.2.6

9 months ago

2.1.44

10 months ago

2.1.41

10 months ago

2.2.10

9 months ago

2.1.42

10 months ago

2.1.40

10 months ago

2.2.19

8 months ago

2.2.28

7 months ago

2.2.29

7 months ago

2.2.26

8 months ago

2.1.58

9 months ago

2.2.27

7 months ago

2.1.59

9 months ago

2.2.24

8 months ago

2.1.56

9 months ago

2.2.25

8 months ago

2.1.57

9 months ago

2.2.22

8 months ago

2.1.54

9 months ago

2.2.23

8 months ago

2.2.20

8 months ago

2.1.52

10 months ago

2.2.21

8 months ago

2.1.53

10 months ago

2.1.50

10 months ago

2.1.51

10 months ago

2.2.37

7 months ago

2.1.69

9 months ago

2.2.38

7 months ago

2.2.35

7 months ago

2.1.67

9 months ago

2.2.36

7 months ago

2.1.68

9 months ago

2.2.33

7 months ago

2.1.65

9 months ago

2.2.34

7 months ago

2.1.66

9 months ago

2.1.63

9 months ago

2.2.32

7 months ago

2.1.64

9 months ago

2.1.61

9 months ago

2.2.30

7 months ago

2.1.62

9 months ago

2.1.60

9 months ago

2.2.9

9 months ago

2.2.8

9 months ago

2.1.78

9 months ago

2.1.79

9 months ago

2.1.76

9 months ago

2.1.74

9 months ago

2.1.75

9 months ago

2.1.72

9 months ago

2.1.73

9 months ago

2.1.70

9 months ago

2.1.71

9 months ago

2.1.21

10 months ago

2.1.20

10 months ago

2.1.19

11 months ago

2.1.18

11 months ago

2.1.17

11 months ago

2.1.16

11 months ago

2.1.15

11 months ago

2.1.14

11 months ago

2.1.13

11 months ago

2.1.12

11 months ago

2.1.11

11 months ago

2.1.10

11 months ago

2.1.9

11 months ago

2.1.8

11 months ago

2.1.7

11 months ago

2.1.6

11 months ago

2.1.5

11 months ago

2.1.4

11 months ago

2.1.3

11 months ago

2.1.2

11 months ago

2.1.1

11 months ago

2.1.0

11 months ago

2.0.9

11 months ago

2.0.8

11 months ago

2.0.7

11 months ago

2.0.6

11 months ago

2.0.5

11 months ago

2.0.4

11 months ago

2.0.3

11 months ago

2.0.2

11 months ago

2.0.1

11 months ago

2.0.0

12 months ago

1.8.0

12 months ago

1.7.0

12 months ago

1.6.0

12 months ago

1.5.0

12 months ago

1.4.0

12 months ago

1.3.0

12 months ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago