0.13.0 • Published 3 years ago

@eid-easy/eideasy-js-sdk v0.13.0

Weekly downloads
78
License
ISC
Repository
-
Last release
3 years ago

Important !!

This package is in active development and not production ready.

eID Easy js SDk

eideasy-js-sdk provides you with a simple set of functions to get the user's identity.

Installing

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/@eid-easy/eideasy-js-sdk@0.7.0/dist/eideasy-js-sdk.min.js"></script>

Example

Create the authenticator instance:

var authenticator = window.eidEasySdk.createAuthenticator({
  countryCode: 'EE',
  sandbox: true,
  clientId: '2IaeiZXbcKzlP1KvjZH9ghty2IJKM8Lg',
  localApiEndpoints: {
    identityStart: 'http://eid-sample-app.test/api/identity/start',
    identityFinish: 'http://eid-sample-app.test/api/identity/finish',
  },
  language: 'et',
});

Authenticator Settings

OptionTypeDefaultDescription
countryCodestringundefinedISO 3166-1 alpha-2 country code
sandboxbooleanfalseWhether to use the sandbox mode.
clientIdstringundefinedget from id.eideasy.com after signing up.
localApiEndpoints.identityStartstringundefinedYour local API endpoint for the identity start request.
localApiEndpoints.identityFinishstringundefinedYour local API endpoint for the identity finish request.
languagestringundefinedTwo letter ISO 639-1 language code.

Authenticate with an ID Card:

authenticator.idCard.authenticate({
  fail: (result) => {
    // do something with the result
  },
  success: (result) => {
    // do something with the result
  },
  finished: (result) => {
    // do something with the result
  },
});

idCard authentication settings

OptionTypeDefaultDescription
failfunctionundefinedThis function gets called when the authentication process failed.
successfunctionundefinedThis function gets called when the authentication process succeeds.
finishedfunctionundefinedThis function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.

Authenticate with Smart-ID:

authenticator.smartId.authenticate({
  idcode: '10101010005',
  countryCode: 'EE',
  started: (result) => {
    // do something with the result
    // e.g. display the result.response.data.challenge code
  },
  fail: (result) => {
    // do something with the result
  },
  success: (result) => {
    // do something with the result
  },
  finished: (result) => {
    // do something with the result
  },
});

smartId authentication settings

OptionTypeDefaultDescription
idcodestringundefinedEnd user's personal identification code
countryCodestringthe value set during the authenticator initializationISO 3166-1 alpha-2 country code
startedfunctionundefinedThis function gets called when the authentication process has started. The argument object of this function contains the challenge (response.data.challenge) you can display to the end-user.
failfunctionundefinedThis function gets called when the authentication process failed.
successfunctionundefinedThis function gets called when the authentication process succeeds.
finishedfunctionundefinedThis function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.

Authenticate with Mobile ID:

authenticator.mobileId.authenticate({
  idcode: '60001019906',
  phone: '+37200000766',
  countryCode: 'EE',
  started: (result) => {
    // do something with the result
    // e.g. display the result.response.data.challenge code
  },
  fail: (result) => {
    // do something with the result
  },
  success: (result) => {
    // do something with the result
  },
  finished: (result) => {
    // do something with the result
  },
});

mobileId authentication settings

OptionTypeDefaultDescription
idcodestringundefinedEnd user's personal identification code
phonestringundefinedEnd user's phone number, must have the country code prefixed with a '+' sign, e.g. +37200000766
countryCodestringthe value set during the authenticator initializationISO 3166-1 alpha-2 country code
startedfunctionundefinedThis function gets called when the authentication process has started. The argument object of this function contains the challenge (response.data.challenge) you can display to the end-user.
failfunctionundefinedThis function gets called when the authentication process failed.
successfunctionundefinedThis function gets called when the authentication process succeeds.
finishedfunctionundefinedThis function gets called when the authentication process has either failed or succeeded. This means that this function gets called always, no matter the authentication result. For example, it can be useful to hide a loading spinner at the end of the authentication process or to do some other clean up work.

Development notes

https://github.com/volta-cli/volta/issues/651

volta install yarn@2.4.0 yarn set version berry

https://yarnpkg.com/cli/run yarn run --inspect-brk webpack

0.13.0

3 years ago

0.11.0

3 years ago

0.12.0

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago