PeculiarVentures / fortify

Fortify enables web applications to use smart cards, local certificate stores and do certificate enrollment. This is the desktop application repository.
https://fortifyapp.com
Other
114 stars 32 forks source link

Fortify does not call callback events #500

Closed cmjunior closed 2 years ago

cmjunior commented 2 years ago

After a while working fine, fortify stopped call the registered callback functions. I'm already tried on examples provided, so nothing happens when I click on "Cancel" or "Continue" buttons.

It's a windows environment. Nothing on browser's console either.

The error I'd noticed on logs was: {"source":"server","error":"CKR_USER_TYPE_INVALID","level":"error","message":"Server event error","timestamp":"2022-06-06T14:38:54.103Z"}

One thing I've noticed is that the token's passwords is called a few times, when the fortify component is mounted, about three times, sometimes two.

donskov commented 2 years ago

Hello @cmjunior. Do you mean callbacks from peculiar-fortify-certificates web-component?

cmjunior commented 2 years ago

@donskov exactly, these one here from example, not being called:

var fortifyCertificates = document.createElement('peculiar-fortify-certificates');
  // All possible propertiest you can find on the documentation page
  // https://fortifyapp.com/docs/webcomponents/fortify-certificates/readme#properties
  fortifyCertificates.debug = true;
  fortifyCertificates.filters = {
    //   onlySmartcards: false,
    //   expired: false,
    onlyWithPrivateKey: true,
    //   subjectDNMatch: 'apple',
    //   subjectDNMatch: new RegExp(/apple/),
    //   issuerDNMatch: 'demo',
    //   issuerDNMatch: new RegExp(/demo/),
    //   providerNameMatch: 'MacOS',
    //   providerNameMatch: new RegExp(/MacOS/),
    //   keyUsage: ['digitalSignature'],
    //   certificateIdMatch: 'test',
  };

  fortifyCertificates.addEventListener('selectionCancel', function() {
    alert('selectionCancel');
  });

  fortifyCertificates.addEventListener('selectionSuccess', continueHandler);

  document.getElementsByTagName('section')[0].prepend(fortifyCertificates);
donskov commented 2 years ago

@cmjunior We released a 2.x version of Fortify web components.

Breaking changes:

  1. Events names were updated - https://fortifyapp.com/docs/webcomponents/fortify-certificates/readme#events
  2. Changed the "server" key name to "socketProvider" in the success event result.

Please check the event names again. Examples work for me without errors.

cmjunior commented 2 years ago

@donskov that was it! I was using the old ones. Thanks a lot!