# web-pki
The [Lacuna Web PKI component](https://docs.lacunasoftware.com/articles/web-pki/) enables web applications to interact with digital certificates through javascript.

The main features are:

* Displaying available certificates (either software- or hardware-based)
* Obtaining public properties of certificates (name, email address, etc.)
* Reading a certificate's binary encoding
* Signing data (or a pre-computed digest) with a certificate

The Web PKI component's main goal is to perform the client-side processing necessary for operations with digital certificates.

## Installation
Using npm:
```sh
$ npm install web-pki --save
```

## Usage Examples

### ES6 (examples in TypeScript)

#### - if you want to import only the main class from web-pki
```ts
import LacunaWebPKI from 'web-pki';

//...

public pki = new LacunaWebPKI(/* license */);
public installationState: LacunaWebPKI.InstallationStates; //you are able to use enums within LacunaWebPKI

//...
```

#### - if you also want to import any other names
```ts
import LacunaWebPKI, { CertificateModel } from 'web-pki';

//...

public pki = new LacunaWebPKI(/* license */);
public certificateList: CertificateModel[];

//...
```

#### - if you want to import everything from web-pki
```ts
import LacunaWebPKI, * as Lacuna from 'web-pki';

//...

public pki = new LacunaWebPKI(/* license */);
public certificateList: Lacuna.CertificateModel[];
public myTrustArbitrators: Lacuna.TrustArbitrator[];

//...
```

### CommonJS (example in JavaScript)

```js
//...

var LacunaWebPKI = require('web-pki').default;
var pki = new LacunaWebPKI(/* license */);

//...
```

For more information, access [Web PKI docs](https://docs.lacunasoftware.com/articles/web-pki/).
