# @hyperledger/cactus-plugin-keychain-memory

> Dummy keychain implementation doing NO encryption and storing everything in-memory. Only suitable for development and testing.

Latest version **2.0.0** (published 2024-10-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @hyperledger/cactus-plugin-keychain-memory
pnpm add @hyperledger/cactus-plugin-keychain-memory
yarn add @hyperledger/cactus-plugin-keychain-memory
bun add @hyperledger/cactus-plugin-keychain-memory
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-10-18 |
| First published | 2020-12-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 10 |
| Unpacked size | 291.3 KB |
| Known vulnerabilities | 0 (+34 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 412 |
| Author | Hyperledger Cactus Contributors |
| Maintainers | hyperledger-ghci, hyperledger-lf |
| Keywords | Hyperledger, Cactus, Integration, Blockchain, Distributed Ledger Technology |

## Links

- npm: https://www.npmjs.com/package/@hyperledger/cactus-plugin-keychain-memory
- Repository: https://github.com/hyperledger/cacti
- Homepage: https://github.com/hyperledger/cacti#readme
- Issues: https://github.com/hyperledger-cacti/cacti/issues
- npm.io page: https://npm.io/package/@hyperledger/cactus-plugin-keychain-memory

## Dependencies (10)

- [rxjs](https://npm.io/package/rxjs.md) 7.8.1
- [uuid](https://npm.io/package/uuid.md) 10.0.0
- [axios](https://npm.io/package/axios.md) 1.7.7
- [express](https://npm.io/package/express.md) 4.21.0
- [prom-client](https://npm.io/package/prom-client.md) 15.1.3
- [@bufbuild/protobuf](https://npm.io/package/@bufbuild/protobuf.md) 1.10.0
- [@connectrpc/connect](https://npm.io/package/@connectrpc/connect.md) 1.4.0
- [@hyperledger/cactus-core](https://npm.io/package/@hyperledger/cactus-core.md) 2.0.0
- [@hyperledger/cactus-common](https://npm.io/package/@hyperledger/cactus-common.md) 2.0.0
- [@hyperledger/cactus-core-api](https://npm.io/package/@hyperledger/cactus-core-api.md) 2.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2024-10-18
- 2.0.0-main.339 (main) — 2024-06-13
- 2.0.0-2945-supply-chain-app-build-failed.241 (2945-supply-chain-app-build-failed) — 2024-03-08
- 2.0.0-lfx-connector.208 (lfx-connector) — 2024-02-07
- 2.0.0-dev.197 (dev) — 2024-01-25
- 2.0.0-build-deps-upgrade-to-lerna-lite-v3-1-0-config-fix.126 (build-deps-upgrade-to-lerna-lite-v3-1-0-config-fix) — 2023-12-08
- 1.0.1-jwt-supply-chain.9df3fe79.16 (jwt-supply-chain) — 2022-04-05
- 0.8.1-pr-brioux-1333.92b26c3a.36 (pr-brioux-1333) — 2021-10-06
- 0.10.1-fix-quorum-api-server.0677a0e6.4 (fix-quorum-api-server) — 2021-09-29
- 0.10.1-fix-quorum-no-keychain-endpoints.bf5e0403.1 (fix-quorum-no-keychain-endpoints) — 2021-09-28
- 0.9.1-ci-942.cbb849c6.35 (ci-942) — 2021-09-27
- 0.9.1-add-bluebird-dependency.a8944f63.33 (add-bluebird-dependency) — 2021-09-23
- 0.9.1-web-socket-identity-provider.845e2a3e.23 (web-socket-identity-provider) — 2021-09-16
- 0.9.1-docs-1312.bcfd3c31.6 (docs-1312) — 2021-09-09
- 0.8.1-vaultTransitKeychain.5ad9cac4.17 (vaultTransitKeychain) — 2021-08-30
- … 44 more at https://npm.io/package/@hyperledger/cactus-plugin-keychain-memory/versions

## README

# `@hyperledger/cactus-plugin-keychain-memory`

## Prometheus Exporter

This class creates a prometheus exporter, which scrapes the transactions (total transaction count) for the use cases incorporating the use of Keychain memory plugin.


### Usage
The prometheus exporter object is initialized in the `PluginKeychainMemory` class constructor itself, so instantiating the object of the `PluginKeychainMemory` class, gives access to the exporter object.
You can also initialize the prometheus exporter object seperately and then pass it to the `IPluginKeychainMemoryOptions` interface for `PluginKeychainMemory` constructor.

`getPrometheusMetricsV1` function returns the prometheus exporter metrics, currently displaying the total key count, which currently updates everytime a new key is added/removed from the list of total keys.

### Prometheus Integration
To use Prometheus with this exporter make sure to install [Prometheus main component](https://prometheus.io/download/).
Once Prometheus is setup, the corresponding scrape_config needs to be added to the prometheus.yml

```(yaml)
- job_name: 'keychain_memory_exporter'
  metrics_path: api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics
  scrape_interval: 5s
  static_configs:
    - targets: ['{host}:{port}']
```

Here the `host:port` is where the prometheus exporter metrics are exposed. The test cases (For example, packages/cactus-plugin-keychain-memory/src/test/typescript/unit/plugin-keychain-memory.test.ts) exposes it over `0.0.0.0` and a random port(). The random port can be found in the running logs of the test case and looks like (42379 in the below mentioned URL)
`Metrics URL: http://0.0.0.0:42379/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics`

Once edited, you can start the prometheus service by referencing the above edited prometheus.yml file.
On the prometheus graphical interface (defaulted to http://localhost:9090), choose **Graph** from the menu bar, then select the **Console** tab. From the **Insert metric at cursor** drop down, select **cactus_keychain_memory_total_key_count** and click **execute**

### Helper code

###### response.type.ts
This file contains the various responses of the metrics.

###### data-fetcher.ts
This file contains functions encasing the logic to process the data points

###### metrics.ts
This file lists all the prometheus metrics and what they are used for.

---
_Source: https://npm.io/package/@hyperledger/cactus-plugin-keychain-memory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
