Giter VIP home page Giter VIP logo

bankid's People

Contributors

a7ul avatar alepek avatar andreas-bergstrom avatar awesome-button avatar dependabot[bot] avatar fredrik avatar hyperborea avatar jakubhomoly avatar jefftrinidad29 avatar kimpers avatar linde12 avatar najamshehzad avatar nikvaessen avatar oliverjohns avatar pepf avatar spathon avatar spiatrenka avatar tobiastornros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bankid's Issues

TypeError: fs.readFileSync is not a function on initiating new BankId instance in React app

Hello!

I just scaffolded a react app and trying to use this package.

I added the sample code and I get the following error when new BankId() tries to execute:

Selection_077

The code I am using:

import React from "react";

const BankId = require('bankid');

const App = () => {
  const bankid = new BankId();
  const pno = "19681110-0871";
  const handleClick = () => {
    return bankid
      .authenticateAndCollect("127.0.0.1", pno)
      .then(res => console.log(res.completionData))
      .catch(console.error);
  };
  return (
    <div>
      <h1>BankId Test</h1>
      <button onClick={handleClick}>Autenticate!</button>
    </div>
  );
};

export default App;

Can you help me debug this?
Thanks!
Greg

pfx problem

Hi, I just get this when I try to give path to the downloaded .pfx cert?
any idea how to link to .pfx file?

fs.js:663
return binding.open(pathModule.toNamespacedPath(path),
ENOENT: no such file or directory, open '....pfx'

Add support for Markdown formatting (userVisibleDataFormat)

BankID added an optional userVisibleDataFormat parameter to allow Markdown syntax in userVisibleData

Relevant documentation:
image

Sign request example (source):

{
"personalNumber":"190000000000",
"endUserIp": "194.168.2.25",
"userVisibleData": "IFRoaXMgaXMgYSBzYW1wbGUgdGV4dCB0byBiZSBzaWduZWQ=",
"userVisibleDataFormat": "simpleMarkdownV1"
}

Regarding PDF File Contract Sign

Dear Sir/Mam,

I am using this code authentication for personal number and its is working fine in test net.

Code:
const BankId = require("bankid");

const bankid = new BankId();
const pno = "YYYYMMDD-XXXX";
const message = "some message displayed to the user to sign";

bankid
.sign("127.0.0.1", pno, message)
.then(res => {
const timer = setInterval(() => {
const done = () => clearInterval(timer);

  bankid
    .collect(res.orderRef)
    .then(res => {
      if (res.status === "complete") {
        console.log(res.completionData);
        done();
      } else if (res.status === "failed") {
        throw new Error(res.hintCode);
      }
    })
    .catch(err => {
      console.error(err);
      done();
    });
}, 1000);

})
.catch(console.error);
But Now i Want to implement the upload file in pdf format and check it is correct or not though bank id app.

I am using this code in nodes.js. So please tell me the solution . Because i am trying for a month but not got any solution.

Thanks

invalidParameters

I have set every as documented in the readme file, it was working before but now I am getting this error invalid parameters. What could be the issue?

ca & pfx types don't match runtime validation

The BankIdClientSettings.pfx and BankIdClientSettings.ca options have the following type: string | Buffer | undefined but during runtime it is expected to be string | Buffer

We need to check that the path isn't undefined before passing it to fs.readFileSync, alternatively update the typescript definition.

I think that allowing undefined is good, because then you could do e.g.:

const client = new BankIdClient({
    production: process.env.NODE_ENV === 'prod',
    pfx: process.env.BANKID_PFX_PATH,
    passphrase: process.env.BANKID_PASSPHRASE,
});

rather than something like

const client = new BankIdClient({
    production: process.env.NODE_ENV === 'prod',
    ...(process.env.NODE_ENV === 'prod' && {
        pfx: process.env.BANKID_PFX_PATH,
        passphrase: process.env.BANKID_PASSPHRASE,
    }),
});

Cancel and awaitPendingCollect

Is there a reason to why no proper status is returned from awaitPendingCollect when cancelling the orderRef?

Right now it will just reject with an error and nothing else.

Can you specify a timeout?

Is there a way to specify a timeout? If not, what is the default timeout if any?

I'm not seeing anything obvious whilst browsing the code other than the REQUEST_TIMEOUT response code, which is seemingly defined but not referenced.

We have a fairly short timeout per default of six seconds for our Lambdas and on occasion requests will take longer than that.

Unsupported

I'm getting unsupported from my endpoints. I tried using this basic example however it didn't work -

const BankId = require("bankid");

const client = new BankId.BankIdClient();
const pno = "YYYYMMDDXXXX";

client
  .authenticateAndCollect({
    personalNumber: pno,
    endUserIp: "127.0.0.1",
  })
  .then(res => console.log(res.completionData))
  .catch(console.error);

Do you guys know if there has been any updates to the bankid API?

QR support

Hi, have you considered implementing support for qrStartSecrets and qrStartSecrets?

This library requires legacy openssl support

BankID certificates are encrypted using the RC2-40-CBC algorithm, which was probably dropped in OpenSSL 3.

As Node 17 switched to openssl 3, and bankid certificates use the RC2 algorithm, a node application using this library must be started with node-options="--openssl-legacy-provider".

I think an average developer expects this library to work out-of the box with the certificate they get from BankID.

Maybe we should mention this option is required in our README?

We use axios, which uses follow-redirects, so the symptom the developer will experience is:

 Error: unsupported
    at configSecureContext (node:internal/tls/secure-context:278:15)
    at Object.createSecureContext (node:_tls_common:116:3)
    at Object.connect (node:_tls_wrap:1718:48)
    at Agent.createConnection (node:https:169:22)
    at Agent.createSocket (node:_http_agent:342:26)
    at Agent.addRequest (node:_http_agent:289:10)
    at new ClientRequest (node:_http_client:337:16)
    at Object.request (node:https:377:10)
    at RedirectableRequest._performRequest (/app/node_modules/bankid/node_modules/follow-redirects/index.js:273:24)
    at new RedirectableRequest (/app/node_modules/bankid/node_modules/follow-redirects/index.js:61:8)

awaitPendingCollect

Is it intended behaviour that awaitPendingCollect does not return a proper status when the orderRef has been canceled?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.