New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bankid-api

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bankid-api

API integration against BankId

latest
npmnpm
Version
2.0.2
Version published
Maintainers
1
Created
Source

API integration against BankId

Setup

const path = require("path");
const BankId = require("../lib/BankId").default;

const instance = new BankId(
  path.resolve(__dirname, "../cert/bankid-test.pfx"),
  path.resolve(__dirname, "../cert/bankid-test.crt"),
  "qwerty123",
);

//new requrement for v3
const ip = "192.168.1.1";

Authenticate

instance
  .authenticate(ip, { personalNumber: "190101014801" })
  .then((response) => {
    console.log("got order reference: ", response.orderRef);
    return instance.collect(response.orderRef, 1000, (status, hintCode) => {
      console.log("status, hintcode:", status, hintCode);
    });
  })
  .then((result) => {
    console.log("auth result: ", result);
  })
  .catch((e) => {
    console.log("something went wrong");
    console.error(e);
  });

Sign

instance
  .sign(ip, "This text will show", "This text is hidden", {
    personalNumber: "190101014801",
  })
  .then((response) => {
    console.log("got order reference: ", response.orderRef);
    return instance.collect(response.orderRef, 1000, (status, hintCode) => {
      console.log("status, hintcode:", status, hintCode);
    });
  })
  .then((result) => {
    console.log("sign result: ", result);
  })
  .catch((e) => {
    console.log("something went wrong");
    console.error(e);
  });

Cancel

instance
  .sign(ip, "This text will show", "This text is hidden", {
    personalNumber: "190101014801",
  })
  .then((response) => {
    console.log("got order reference: ", response.orderRef);
    return instance.cancel(response.orderRef);
  })
  .then((result) => {
    console.log("cancel result: ", result);
  })
  .catch((e) => {
    console.log("something went wrong");
    console.error(e);
  });

Keywords

bankid

FAQs

Package last updated on 24 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts