Skip to content

Commit

Permalink
chore: attempt to streamline docgen output
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7061 committed Sep 26, 2024
1 parent 0942109 commit a99a909
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 128 deletions.
255 changes: 130 additions & 125 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,189 +26,194 @@ npx cap sync

<docgen-index>

* [`encrypt(...)`](#encrypt)
* [`encryptFile(...)`](#encryptfile)
* [`decrypt(...)`](#decrypt)
* [`decryptFile(...)`](#decryptfile)
* [`decryptFileFromURL(...)`](#decryptfilefromurl)
* [`generateKeyPair()`](#generatekeypair)
* [`computeSharedSecret(...)`](#computesharedsecret)
* [`computeED25519PublicKey(...)`](#computeed25519publickey)
* [`sign(...)`](#sign)
* [`verify(...)`](#verify)
* [`random(...)`](#random)
* [`derive(...)`](#derive)
* [Interfaces](#interfaces)
* [Enums](#enums)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### encrypt(...)
### Interfaces

```typescript
encrypt(options: { key: string; iv: string; adata: string; pt: string; tagLength: number; }) => Promise<{ cipherText: string; authTag: string; }>
```

| Param | Type |
| ------------- | --------------------------------------------------------------------------------------- |
| **`options`** | <code>{ key: string; iv: string; adata: string; pt: string; tagLength: number; }</code> |

**Returns:** <code>Promise&lt;{ cipherText: string; authTag: string; }&gt;</code>

--------------------


### encryptFile(...)

```typescript
encryptFile(options: { sharedSecret: string; ptPath: string; ctPath: string; }) => Promise<void>
```

| Param | Type |
| ------------- | ---------------------------------------------------------------------- |
| **`options`** | <code>{ sharedSecret: string; ptPath: string; ctPath: string; }</code> |

--------------------


### decrypt(...)

```typescript
decrypt(options: { key: string; iv: string; adata: string; ct: string; tagLength: number; }) => Promise<{ plainText: string; authOk: boolean; }>
```

| Param | Type |
| ------------- | --------------------------------------------------------------------------------------- |
| **`options`** | <code>{ key: string; iv: string; adata: string; ct: string; tagLength: number; }</code> |

**Returns:** <code>Promise&lt;{ plainText: string; authOk: boolean; }&gt;</code>
#### AbrevvaBLEInterface

--------------------
| Method | Signature |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **initialize** | (options?: <a href="#initializeoptions">InitializeOptions</a> \| undefined) =&gt; Promise&lt;void&gt; |
| **isEnabled** | () =&gt; Promise&lt;<a href="#booleanresult">BooleanResult</a>&gt; |
| **isLocationEnabled** | () =&gt; Promise&lt;<a href="#booleanresult">BooleanResult</a>&gt; |
| **startEnabledNotifications** | () =&gt; Promise&lt;void&gt; |
| **stopEnabledNotifications** | () =&gt; Promise&lt;void&gt; |
| **openLocationSettings** | () =&gt; Promise&lt;void&gt; |
| **openBluetoothSettings** | () =&gt; Promise&lt;void&gt; |
| **openAppSettings** | () =&gt; Promise&lt;void&gt; |
| **requestLEScan** | (options?: <a href="#requestbledeviceoptions">RequestBleDeviceOptions</a> \| undefined) =&gt; Promise&lt;void&gt; |
| **stopLEScan** | () =&gt; Promise&lt;void&gt; |
| **addListener** | (eventName: "onEnabledChanged", listenerFunc: (result: <a href="#booleanresult">BooleanResult</a>) =&gt; void) =&gt; <a href="#pluginlistenerhandle">PluginListenerHandle</a> |
| **addListener** | (eventName: string, listenerFunc: (event: <a href="#readresult">ReadResult</a>) =&gt; void) =&gt; <a href="#pluginlistenerhandle">PluginListenerHandle</a> |
| **addListener** | (eventName: "onScanResult", listenerFunc: (result: <a href="#scanresultinternal">ScanResultInternal</a>) =&gt; void) =&gt; <a href="#pluginlistenerhandle">PluginListenerHandle</a> |
| **connect** | (options: <a href="#deviceidoptions">DeviceIdOptions</a> & <a href="#timeoutoptions">TimeoutOptions</a>) =&gt; Promise&lt;void&gt; |
| **disconnect** | (options: <a href="#deviceidoptions">DeviceIdOptions</a>) =&gt; Promise&lt;void&gt; |
| **read** | (options: <a href="#readoptions">ReadOptions</a> & <a href="#timeoutoptions">TimeoutOptions</a>) =&gt; Promise&lt;<a href="#readresult">ReadResult</a>&gt; |
| **write** | (options: <a href="#writeoptions">WriteOptions</a> & <a href="#timeoutoptions">TimeoutOptions</a>) =&gt; Promise&lt;void&gt; |
| **signalize** | (options: <a href="#signalizeoptions">SignalizeOptions</a>) =&gt; Promise&lt;void&gt; |
| **disengage** | (options: <a href="#disengageoptions">DisengageOptions</a>) =&gt; Promise&lt;<a href="#stringresult">StringResult</a>&gt; |
| **startNotifications** | (options: <a href="#readoptions">ReadOptions</a>) =&gt; Promise&lt;void&gt; |
| **stopNotifications** | (options: <a href="#readoptions">ReadOptions</a>) =&gt; Promise&lt;void&gt; |


### decryptFile(...)
#### InitializeOptions

```typescript
decryptFile(options: { sharedSecret: string; ctPath: string; ptPath: string; }) => Promise<void>
```
| Prop | Type |
| ----------------------------- | -------------------- |
| **`androidNeverForLocation`** | <code>boolean</code> |

| Param | Type |
| ------------- | ---------------------------------------------------------------------- |
| **`options`** | <code>{ sharedSecret: string; ctPath: string; ptPath: string; }</code> |

--------------------
#### BooleanResult

| Prop | Type |
| ----------- | -------------------- |
| **`value`** | <code>boolean</code> |

### decryptFileFromURL(...)

```typescript
decryptFileFromURL(options: { sharedSecret: string; url: string; ptPath: string; }) => Promise<void>
```
#### RequestBleDeviceOptions

| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| **`options`** | <code>{ sharedSecret: string; url: string; ptPath: string; }</code> |
| Prop | Type |
| ---------------------- | --------------------------------------------- |
| **`services`** | <code>string[]</code> |
| **`name`** | <code>string</code> |
| **`namePrefix`** | <code>string</code> |
| **`optionalServices`** | <code>string[]</code> |
| **`allowDuplicates`** | <code>boolean</code> |
| **`scanMode`** | <code><a href="#scanmode">ScanMode</a></code> |
| **`timeout`** | <code>number</code> |

--------------------

#### PluginListenerHandle

### generateKeyPair()
| Prop | Type |
| ------------ | ----------------------------------------- |
| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |

```typescript
generateKeyPair() => Promise<{ privateKey: string; publicKey: string; }>
```

**Returns:** <code>Promise&lt;{ privateKey: string; publicKey: string; }&gt;</code>
#### ReadResult

--------------------
| Prop | Type |
| ----------- | ------------------- |
| **`value`** | <code>string</code> |


### computeSharedSecret(...)
#### ScanResultInternal

```typescript
computeSharedSecret(options: { privateKey: string; peerPublicKey: string; }) => Promise<{ sharedSecret: string; }>
```
| Prop | Type |
| ---------------------- | ----------------------------------------------- |
| **`device`** | <code><a href="#bledevice">BleDevice</a></code> |
| **`localName`** | <code>string</code> |
| **`rssi`** | <code>number</code> |
| **`txPower`** | <code>number</code> |
| **`manufacturerData`** | <code>{ [key: string]: T; }</code> |
| **`serviceData`** | <code>{ [key: string]: T; }</code> |
| **`uuids`** | <code>string[]</code> |
| **`rawAdvertisement`** | <code>T</code> |

| Param | Type |
| ------------- | ----------------------------------------------------------- |
| **`options`** | <code>{ privateKey: string; peerPublicKey: string; }</code> |

**Returns:** <code>Promise&lt;{ sharedSecret: string; }&gt;</code>
#### BleDevice

--------------------
| Prop | Type |
| -------------- | --------------------- |
| **`deviceId`** | <code>string</code> |
| **`name`** | <code>string</code> |
| **`uuids`** | <code>string[]</code> |


### computeED25519PublicKey(...)
#### DeviceIdOptions

```typescript
computeED25519PublicKey(options: { privateKey: string; }) => Promise<{ publicKey: string; }>
```
| Prop | Type |
| -------------- | ------------------- |
| **`deviceId`** | <code>string</code> |

| Param | Type |
| ------------- | ------------------------------------ |
| **`options`** | <code>{ privateKey: string; }</code> |

**Returns:** <code>Promise&lt;{ publicKey: string; }&gt;</code>
#### TimeoutOptions

--------------------
| Prop | Type |
| ------------- | ------------------- |
| **`timeout`** | <code>number</code> |


### sign(...)
#### ReadOptions

```typescript
sign(options: { privateKey: string; data: string; }) => Promise<{ signature: string; }>
```
| Prop | Type |
| -------------------- | ------------------- |
| **`deviceId`** | <code>string</code> |
| **`service`** | <code>string</code> |
| **`characteristic`** | <code>string</code> |

| Param | Type |
| ------------- | -------------------------------------------------- |
| **`options`** | <code>{ privateKey: string; data: string; }</code> |

**Returns:** <code>Promise&lt;{ signature: string; }&gt;</code>
#### WriteOptions

--------------------
| Prop | Type |
| -------------------- | ------------------- |
| **`deviceId`** | <code>string</code> |
| **`service`** | <code>string</code> |
| **`characteristic`** | <code>string</code> |
| **`value`** | <code>string</code> |


### verify(...)
#### SignalizeOptions

```typescript
verify(options: { publicKey: string; data: string; signature: string; }) => Promise<void>
```
| Prop | Type |
| -------------- | ------------------- |
| **`deviceId`** | <code>string</code> |

| Param | Type |
| ------------- | -------------------------------------------------------------------- |
| **`options`** | <code>{ publicKey: string; data: string; signature: string; }</code> |

--------------------
#### StringResult

| Prop | Type |
| ----------- | ------------------- |
| **`value`** | <code>string</code> |

### random(...)

```typescript
random(options: { numBytes: number; }) => Promise<{ value: string; }>
```
#### DisengageOptions

| Param | Type |
| ------------- | ---------------------------------- |
| **`options`** | <code>{ numBytes: number; }</code> |
| Prop | Type |
| ------------------------ | -------------------- |
| **`deviceId`** | <code>string</code> |
| **`mobileId`** | <code>string</code> |
| **`mobileDeviceKey`** | <code>string</code> |
| **`mobileGroupId`** | <code>string</code> |
| **`mobileAccessData`** | <code>string</code> |
| **`isPermanentRelease`** | <code>boolean</code> |

**Returns:** <code>Promise&lt;{ value: string; }&gt;</code>

--------------------
#### AbrevvaCryptoInterface

| Method | Signature |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **encrypt** | (options: { key: string; iv: string; adata: string; pt: string; tagLength: number; }) =&gt; Promise&lt;{ cipherText: string; authTag: string; }&gt; |
| **encryptFile** | (options: { sharedSecret: string; ptPath: string; ctPath: string; }) =&gt; Promise&lt;void&gt; |
| **decrypt** | (options: { key: string; iv: string; adata: string; ct: string; tagLength: number; }) =&gt; Promise&lt;{ plainText: string; authOk: boolean; }&gt; |
| **decryptFile** | (options: { sharedSecret: string; ctPath: string; ptPath: string; }) =&gt; Promise&lt;void&gt; |
| **decryptFileFromURL** | (options: { sharedSecret: string; url: string; ptPath: string; }) =&gt; Promise&lt;void&gt; |
| **generateKeyPair** | () =&gt; Promise&lt;{ privateKey: string; publicKey: string; }&gt; |
| **computeSharedSecret** | (options: { privateKey: string; peerPublicKey: string; }) =&gt; Promise&lt;{ sharedSecret: string; }&gt; |
| **computeED25519PublicKey** | (options: { privateKey: string; }) =&gt; Promise&lt;{ publicKey: string; }&gt; |
| **sign** | (options: { privateKey: string; data: string; }) =&gt; Promise&lt;{ signature: string; }&gt; |
| **verify** | (options: { publicKey: string; data: string; signature: string; }) =&gt; Promise&lt;void&gt; |
| **random** | (options: { numBytes: number; }) =&gt; Promise&lt;{ value: string; }&gt; |
| **derive** | (options: { key: string; salt: string; info: string; length: number; }) =&gt; Promise&lt;{ value: string; }&gt; |

### derive(...)

```typescript
derive(options: { key: string; salt: string; info: string; length: number; }) => Promise<{ value: string; }>
```
### Enums

| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| **`options`** | <code>{ key: string; salt: string; info: string; length: number; }</code> |

**Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
#### ScanMode

--------------------
| Members | Value |
| --------------------------- | -------------- |
| **`SCAN_MODE_LOW_POWER`** | <code>0</code> |
| **`SCAN_MODE_BALANCED`** | <code>1</code> |
| **`SCAN_MODE_LOW_LATENCY`** | <code>2</code> |

</docgen-api>
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
"eslint": "eslint . --ext ts",
"prettier": "prettier \"**/*.java\"",
"swiftlint": "node-swiftlint",
"docgen": "npm run docgen-ble && npm run docgen-crypto",
"docgen-ble": "docgen --api AbrevvaBLEInterface --output-readme README.md --output-json dist/abrevva-ble-api.json",
"docgen-crypto": "docgen --api AbrevvaCryptoInterface --output-readme README.md --output-json dist/abrevva-crypto-api.json",
"docgen": "docgen --api AbrevvaInterface --output-readme README.md --output-json dist/abrevva-api.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
Expand Down
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
import { AbrevvaBLEInterface } from "./plugins/ble";
import { AbrevvaCryptoInterface } from "./plugins/crypto";

export * from "./plugins/ble/index";
export * from "./plugins/crypto/index";

export interface AbrevvaInterface {
AbrevvaBLEInterface: AbrevvaBLEInterface;
AbrevvaCryptoInterface: AbrevvaCryptoInterface;
}

0 comments on commit a99a909

Please sign in to comment.