open-index/open-npm huggingface dataset:
npm package: @juseop/js.toast
Description: Lightweight framework-agnostic toast notification libray
Author: Juseop Yu
Latest version: 0.0.1

# js.toast — Lightweight Toast Notification Library

A minimal, dependency-free toast library written in TypeScript. **CSS is automatically included** - no need to import separate CSS files!

---

## Install

```bash
npm install js.toast
# or
yarn add js.toast
```

---

## Usage

```ts
import { toast, configure, dismiss } from "js.toast";

// CSS is automatically injected! No need to import CSS files
toast("Hello World!", { type: "success" });

configure({ position: "bottom-left", maxToasts: 3 });

const id = toast("Undo?", {
  actions: [{ label: "Undo", onClick: () => console.log("Undo clicked") }],
  duration: 0, // persistent
});

// Manually dismiss
dismiss(id);
```

---

## Customization

### CSS Variables (Recommended)

You can customize the appearance using CSS variables:

```css
:root {
  --toast-bg: #1a1a1a; /* Background color */
  --toast-color: #ffffff; /* Text color */
  --toast-padding: 16px 20px; /* Padding */
  --toast-border-radius: 12px; /* Border radius */
  --toast-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --toast-min-width: 200px; /* Minimum width */
  --toast-gap: 8px; /* Gap between toasts */
  --toast-z-index: 10000; /* Z-index */

  /* Type colors */
  --toast-success-color: #10b981;
  --toast-error-color: #ef4444;
  --toast-info-color: #3b82f6;
  --toast-warning-color: #f59e0b;

  /* Close button */
  --toast-close-color: #9ca3af;
  --toast-close-hover-color: #ffffff;
  --toast-action-hover-bg: rgba(255, 255, 255, 0.1);
}
```

### CSS Classes

You can also override styles using CSS classes:

```css
.toast-toast {
  background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
}

.toast-toast.success {
  border-left: 6px solid #10b981;
}
```

---

## API

### `toast(message, options?)`

Shows a toast message. Returns a toast id.

**Options:**

- `type?: "info" | "success" | "error" | "warning"`
- `duration?: number` (ms, 0 = persistent)
- `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center"`
- `onClose?: () => void`
- `allowHtml?: boolean`
- `className?: string`
- `actions?: Array<{ label: string; onClick: (id: string) => void }>`

### `dismiss(id)`

Closes a specific toast.

### `clearAll()`

Removes all visible toasts.

### `configure(options)`

Sets global defaults (e.g., position, duration, maxToasts).

---

## License

MIT 2025
npm package: @jusfeel/last-git-commits
Description: Read recent git commits from the default branch with optional JSON file cache
Author: Hao
Latest version: 1.3.0

# @jusfeel/last-git-commits

Read the latest commits from a git repo’s default branch (`origin/HEAD`, else `main` / `master`), with an optional JSON file cache. No dependencies beyond Node.js.

## Install

```bash
npm install @jusfeel/last-git-commits
```

## Usage

```js
const {
  getReleaseNotes,
  getRecentCommitNotes,
  refreshCommitsCache,
  defaultOptions,
} = require('@jusfeel/last-git-commits');

// Cached list (rebuilds synchronously on cold miss)
const { entries } = getReleaseNotes({
  repoRoot: '/path/to/repo',
  cacheDir: 'my-app', // optional: folder under os.tmpdir(), or an absolute path
});

// One-shot, no cache file
const { commits, branch } = getRecentCommitNotes({
  repoRoot: '/path/to/repo',
  limit: 20,
});
```

Commit entries are `{ created_at, title, detail, author }` where `title` is the short hash and `author` is `%an` from git (for release-note style UIs).

### Express (or any HTTP framework)

The library only talks to git and the filesystem. In your route, call `refreshCommitsCache` with paths and `repoRoot` (optional `limit`; defaults to `DEFAULT_BUILD_LIMIT`), then map the result to HTTP or `throw` / `next(err)`:

```js
const { refreshCommitsCache, defaultOptions } = require('@jusfeel/last-git-commits');

const opts = {
  ...defaultOptions('my-app'), // cache dir name under os.tmpdir(), or absolute path
  repoRoot: '/path/to/repo',
};

app.post('/admin/commits/refresh', (req, res, next) => {
  const result = refreshCommitsCache({ ...opts });
  if (!result.ok) {
    return next(new Error(result.error));
  }
  res.json({ branch: result.branch, entryCount: result.entryCount });
});
```

## API

- **`defaultCachePaths(cacheDir?)`** — four file paths under that directory (see `defaultOptions`).
- **`defaultOptions(cacheDir?)`** — `{ repoRoot, cacheFile, cacheTmp, metaFile, metaTmp }` using `process.cwd()` and `cacheDir` (absolute path, or a folder name under `os.tmpdir()`, default `last-git-commits`).
- **`getReleaseNotes(overrides?)`** — returns `{ source: 'cache', entries }`. If the cache file is missing and the rebuild fails, **`throws`** an `Error` whose message comes from `refreshCommitsCache` (no `console` logging).
- **`refreshCommitsCache(options)`** — writes cache + meta; returns `{ ok, branch?, entryCount? }` or `{ ok: false, error }`. Omits `limit` to use `DEFAULT_BUILD_LIMIT` (10).
- **`getRecentCommitNotes({ repoRoot, limit, gitBinary? })`**

## License

MIT
npm package: @jusfoun-vis/canvas-common
Description: HTML5 Canvas Common Library.
Author: jusfoun-vis
Latest version: 0.1.1

﻿# HTML5 Canvas Common Library

Jusfoun Visualization Department.   

九次方大数据可视化部。

## Pattern/Style Definition 样式定义

### Solid Color 纯色

```javascript
const style1 = '#FFF';
const style2 = 'rgba(0, 0, 0, 0.5)';
```

### Linear Gradient 线性渐变

```javascript
const style = {
  type: 'linearGradient'
  // Indicate this pattern apply each line individually or global.
  // 指示此样式单独应用于每一行还是整体
  scope: 'global' or 'line'
  x0: 0,
  y0: 0,
  x1: 1,
  y1: 0,
  colorStops: [
    {
      offset: 0,
      color: '#FFF'
    },
    {
      offset: 1,
      color: '#000'
    }
  ]
};
```

### Radial Gradient 放射状/径向渐变

```javascript
const style = {
  type: 'radialGradient'
  // Indicate this pattern apply each line individually or global.
  // 指示此样式单独应用于每一行还是整体
  scope: 'global' or 'line'
  x0: 0,
  y0: 0,
  r0: 0,
  x1: 1,
  y1: 1,
  r1: 1,
  colorStops: [
    {
      offset: 0,
      color: '#FFF'
    },
    {
      offset: 1,
      color: '#000'
    }
  ]
};
```

### Image Fill 图形填充

```javascript
const style = {
  type: 'pattern',
  image,
  repetition,
};
```
## Text 文字

### renderTextLikeDocument(text, maxWidth, style)

Render text to image with restricted width and styles.   

以指定的宽度和样式渲染文本为图形。

```javascript
import {renderTextLikeDocument} from '@jusfoun-vis/canvas-common';

const style = {
  fontSize : 12,
  fontWeight : 'bold',
  fontFamily : 'Microsoft YaHei',
  // left (default), center, right
  textAlign : 'left',
  lineHeight : 12,
  // unified number or [top, right, bottom, left] or [top/bottom, right/left]
  padding : [0, 0],
  // '#RRGGBB' or 'rgb(R, G, B)' or 'rgba(R, G, B, A)'
  // Notice that 'fillStyle' will override this parameter
  // 注意fillStyle属性会覆盖此属性
  color : '#FFF', 
  // See the section 'Pattern/Style Definition' above.
  // 请查看上面的“样式定义”章节
  fillStyle : {
    type: 'linearGradient',
    scope: 'line',
    x0: 0,
    y0: 0,
    x1: 1,
    y1: 0,
    colorStops: [
      {
        offset: 0,
        color: '#FFF'
      },
      {
        offset: 1,
        color: '#000'
      }
    ]
  },
  strokeWidth : 1,
  // See the section 'Pattern/Style Definition' above.
  // 请查看上面的“样式定义”章节
  strokeStyle : '#CCC',
  shadowColor : '#000',
  shadowBlur : 5,
  shadowOffsetX : 5,
  shadowOffsetY : 5,
  // See the section 'Pattern/Style Definition' above. Support background drawing.
  // 请查看上面的“样式定义”章节，用于添加背景
  backgroundStyle : '#CCC'
};

const image = renderTextLikeDocument('Hello World', 100, style);
```
npm package: @jusfoun-vis/relativism
Description: A simple tiny library for relating all resources of React and Vue projects.
Author: Molay Chen
Latest version: 0.1.3

﻿# Relativism
一个短小的工具库，用于相对化所有React、Vue发布版中的静态资源，使项目发布版可以放置在任意目录下使用。

目前支持React、Vue两个框架。

## Usage

```javascript
// React
var path = require('path');
var relativism = require('./relativism.min.js');
var relate = relativism.relate;

relate({
  type: 'react',
  dist: path.join(__dirname, 'build'),
  src: path.join(__dirname, 'src'),
  build: true,
  removeSourceMap: true
});
```

```javascript
// Vue
var path = require('path');
var relativism = require('./relativism.min.js');
var relate = relativism.relate;

relate({
  type: 'vue',
  dist: path.join(__dirname, 'dist'),
  build: true,
  removeSourceMap: true
});
```
npm package: @jusfoun-vis/scaler
Description: Adapt content to the screen size for various occasions.
Author: Molay Chen
Latest version: 0.1.5

﻿# Scaler
一个短小的工具库，可以将前端界面依据窗口大小进行自适应调整。

## Usage
托管整屏自适应。
```javascript
import {
  Scaler,
  MODE_NORMAL,    // 自适应居中
  MODE_WIDTH,     // 依据宽度自适应
  MODE_HEIGHT,    // 依据高度自适应
  MODE_FULL,      // 全屏拉伸
  MODE_NONE,      // 不做任何处理
  MODE_DEBUG      // 按住shift建双击屏幕任何位置，可在自适应居中与100%中进行切换
} from '@jusfoun-vis/scaler';

const scaler = new Scaler(MODE_NORMAL, 1920, 1080);
scaler.manage();
```

获取100%状态下的屏幕坐标。
```javascript
import {
  getLocalPosition,
  getGlobalPosition
} from '@jusfoun-vis/scaler';

window.onclick = function (mouseEvent) {
  // 依据MouseEvent获得100%状态下的全局坐标位置
  let p0 = getGlobalPosition(mouseEvent);
  console.log(p0);
  
  // 依据MouseEvent获得100%状态下相对于指定HTMLElement的坐标位置
  let p1 = getLocalPosition(mouseEvent, domElement);
  console.log(p1);
};
```
npm package: @jusfoun-vis/threejs-chart
Description: Three.js chart library for general data visualzaition.
Author: jusfoun-vis
Latest version: 0.1.10

﻿# Three.js 图表库
基于 Three.js 提供常规可视化图表。

## 基础环境

### General3DEnv

通用3D环境，此类构造了一个基础的3D运行环境，使用如下。

```javascript
import {
  General3DEnv
} from '@jusfoun-vis/threejs-chart';

// 自定义一个3D应用。
class Custom3DApp extends General3DEnv {
  
  constructor(option) {
    super(option);
    // 可以选择是自动在构造中初始化，或是new出实例后外部手动调用初始化，
    // 注意仅可初始化一次，当前示例是自动在构造中初始化。
    this.initialize();
  }
  
  // 自定义引擎的Scene、Camera、Renderer实现，一般情况下无需重写。
  _initEngine() {
    super._initEngine();
    
    // Stage3D参见
    const stage3d = this.stage3d;
    const camera = this.camera; // read-only, it is equals to stage3d.camera and this._camera
    const scene = this.scene; // read-only, it is equals to stage3d.scene and this._scene
    const renderer = this.renderer; // read-only, it is equals to stage3d.renderer and this._renderer
  }
  
  // 自定义控制器Controls实现，默认使用OrbitControls控制器（threejs-ext库），一般情况下无需重写。
  _initControls() {
    super._initControls();
    
    const controls = this.controls; // read-only, it is equals to this._controls
    controls.update();
  }
  
  // 自定义3D场景中的光源。
  _initLights() {
    // General3DEnv自带addPointLight(color, intensity, x, y, z)方法可快速创建点光源。
    this.addPointLight(0xFFFFFF, 1.0, 0, 0, 1000);
    
    // 自定义光源
    const directionalLight = new THREE.DirectionalLight( 0xFFFFFF );
    this.scene.add(directionalLight); // or using this.addObject(directionalLight), this.stage3d.addObject(directionalLight)
  }
  
  // 自定义纹理、材质。
  _initMaterials() {
  }
  
  // 自定义物件。
  _initObjects() {
    const mesh = new THREE.Mesh(new THREE.BoxBufferGeometry(1, 1, 1));
    this.addObject(mesh);
  }
  
  // 自定义物件。
  _initObjects() {
  }
  
  // 自定义事件监听，默认添加了Canvas画布上的双击事件，按住Shift键，双击可打印当前Camera的坐标以及Controls中Target的坐标，
  // 可在旋转、调整场景至合适角度后，获得数值然后固化在初始化的设置中。
  _initEventListeners() {
    super._initControls();
    
    const domElement = this.domElement; // it is equals to stage3d.domElement, both read-only
    domElement.addEventListener('xxx', e => {
      // TODO...
    });
  }
  
  // 自定初始化最后阶段应执行的代码。
  _initFinally() {
  }
  
}

const app = new Custom3DApp();
document.body.appendChild(app.domElement);
app.resize(512, 512);
app.startRender();

```

## 板块地图

## 相关性矩阵图

## 装饰物件
npm package: @jusfoun-vis/threejs-common
Description: Three.js common library with basic graphics and interaction control methods.
Author: jusfoun-vis
Latest version: 0.1.10

﻿## Three.js 通用库
基于 Three.js 提供集成3D环境与基础控制功能。

## Stage3D

通用3D环境，将常用功能进行统一封装，包含Scene场景、Camera镜头、Renderer渲染器等，提供标准resize、capture方法。   
同时，Stage3D中已内置交互、渲染管理器，可基于标准体系提供物件的鼠标交互支持。

```javascript
import {
  Timer
} from '@jusfoun-vis/common';
import {
  Stage3D,
  InteractiveMesh
} from '@jusfoun-vis/threejs-common';

const stage3d = new Stage3D();
stage3d.camera.position.set(0, 0, 100);
document.body.appendChild(stage3d.domElement);

const controls = new THREE.OrbitControls(stage3d.camera, stage3d.domElement);
controls.update();

const boxBufferGeometry = new THREE.BoxBufferGeometry(10, 10, 10);
const meshNormalMaterial = new THREE.MeshNormalMaterial();
const meshBasicMaterial = new THREE.MeshBasicMaterial({
  color: 0xFFFF00
});
for (let i = 0; i < 100; i++) {
  let mesh = new InteractiveMesh(boxBufferGeometry, meshNormalMaterial);
  mesh.interactive = true;
  mesh.buttonMode = true;
  mesh.mouseOut = function (e) {
    this.material = meshNormalMaterial;
  };
  mesh.mouseOver = function (e) {
    this.material = meshBasicMaterial;
  };
  mesh.position.set(
    -100 + Math.random() * 200,
    -100 + Math.random() * 200,
    -100 + Math.random() * 200
  );
  mesh.rotation.set(
    Math.random() * DP,
    Math.random() * DP,
    Math.random() * DP
  );
  stage3d.addObject(mesh);
}

const timer = new Timer(Timer.REQUEST_ANIMATION_FRAME);
timer.on('timer', function () {
  stage3d.render();
});
timer.start();

window.onresize = function () {
  stage3d.resize(window.innerWidth - 8, window.innerHeight - 8);
};
window.onresize();

```

## InteractiveObjects

* InteractiveObject : Basic class 基类
  * interactive getter/setter boolean : 指示此物件是否具备交互能力（接受鼠标事件）
  * buttonMode getter/setter boolean : 指示此物件是否在具备鼠标焦点时显示手型
  * renderable getter/setter boolean : 指示此物件是否参与帧频渲染，参与帧频渲染的物件，引擎会以帧频调用其上的render方法（如果可用）
  * addObject(object3d) : 在此物件（容器）中添加子物件
  * removeObject(object3d) : 从此物件（容器）中删除子物件
* InteractiveGroup
* InteractiveLine
* InteractiveLineSegments
* InteractiveMesh
* InteractiveSprite
* InteractiveObject3D
npm package: @jushacornerstonejs/adapters
Description: Adapters for Cornerstone3D to/from formats including DICOM SR and others
Author: @cornerstonejs
Latest version: 0.0.3

<div align="center">
  <h1>Adapters for VTK, Cornerstone and Cornerstone3D</h1>
  <p>Conversion to/from the internal model and DICOM SR for annotations and other
  types of objects.</p>
</div>

<hr />

# History

- 2014
  - [DCMTK](dcmtk.org) cross compiled to javascript at [CTK Hackfest](http://www.commontk.org/index.php/CTK-Hackfest-May-2014). While this was useful and powerful, it was heavyweight for typical web usage.
- 2016
  - A [Medical Imaging Web Appliction meeting at Stanford](http://qiicr.org/web/outreach/Medical-Imaging-Web-Apps/) and [follow-on hackfest in Boston](http://qiicr.org/web/outreach/MIWS-hackfest/) helped elaborate the needs for manipulating DICOM in pure Javascript.
  - Based on [DICOM Part 10 read/write code](https://github.com/OHIF/dicom-dimse) initiated by Weiwei Wu of [OHIF](http://ohif.org), Steve Pieper [developed further features](https://github.com/pieper/sites/tree/gh-pages/dcmio) and [examples of creating multiframe and segmentation objects](https://github.com/pieper/sites/tree/gh-pages/DICOMzero) discussed with the community at RSNA
- 2017
  - At [NA-MIC Project Week 25](https://na-mic.org/wiki/Project_Week_25) Erik Ziegler and Steve Pieper [worked](https://na-mic.org/wiki/Project_Week_25/DICOM_Segmentation_Support_for_Cornerstone_and_OHIF_Viewer)
    with the community to define some example use cases to mix the pure JavaScript DICOM code with Cornerstone and [CornerstoneTools](https://github.com/chafey/cornerstoneTools).
- 2018-2022
  - Work continues to develop SR and SEG support to [OHIFViewer](http://ohif.org) allow interoperability with [DICOM4QI](https://legacy.gitbook.com/book/qiicr/dicom4qi/details)
- 2023
  - Moved the adapters into cornerstone3D from dcmjsj

# Support

The developers gratefully acknowledge their research support:

- Open Health Imaging Foundation ([OHIF](http://ohif.org))
- Quantitative Image Informatics for Cancer Research ([QIICR](http://qiicr.org))
- [Radiomics](http://radiomics.io)
- The [Neuroimage Analysis Center](http://nac.spl.harvard.edu)
- The [National Center for Image Guided Therapy](http://ncigt.org)
- The [NCI Imaging Data Commons](https://imagingdatacommons.github.io/) NCI Imaging Data Commons: contract number 19X037Q from Leidos Biomedical Research under Task Order HHSN26100071 from NCI
npm package: @jushacornerstonejs/core
Description: Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the [OHIF Viewer](https://ohif.org/).
Latest version: 0.0.3

# @cornerstonejs/core

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the [OHIF Viewer](https://ohif.org/).

This library, _@cornerstonejs/core_, provides CPU and GPU-based rendering support, image/volume loading API, and caching utilities.

You can find the Cornerstone documentation [on the website](https://cornerstonejs.org/).
npm package: @jushacornerstonejs/streaming-image-volume-loader
Description: Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the [OHIF Viewer](https://ohif.org/).
Latest version: 0.0.3

# @cornerstonejs/streaming-image-volume-loader

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the [OHIF Viewer](https://ohif.org/).

This library, _@cornerstonejs/streaming-image-volume-loader_, provides a volume loader which allows for individual image slices (e.g. part of an MRI or CT acquisition) to be streamed in to fill an entire volumetric array. During this slice-by-slice streaming, the user can continue to interact with the volume.

You can find the Cornerstone documentation [on the website](https://cornerstonejs.org/).
npm package: @jushacornerstonejs/tools
Description: Cornerstone3D Tools
Latest version: 0.0.3

# @cornerstonejs/tools

Cornerstone is a set of JavaScript libraries that can be used to build web-based medical imaging applications. It provides a framework to build radiology applications such as the [OHIF Viewer](https://ohif.org/).

This library, _@cornerstonejs/tools_, provides manipulation, annotation, and segmentation tools as well as a tool framework for building interactive imaging applications.

You can find the Cornerstone documentation [on the website](https://cornerstonejs.org/).
npm package: @jushuitan/wangeditor
Description: wangEditor - 轻量级 web 富文本编辑器，配置方便，使用简单，开源免费
Latest version: 4.8.3

# wangEditor

<!-- Badge -->
![Stars badge](https://img.shields.io/badge/stars-11.2-green)
![Forks badge](https://img.shields.io/badge/forks-2.5k-brightgreen)
![cypress badge](https://img.shields.io/badge/E2E-Cypress-brightgreen)
![jest badge](https://img.shields.io/badge/unit%20test-jest-yellowgreen)
![build badge](https://github.com/wangeditor-team/wangEditor/workflows/build/badge.svg)
![MIT License](https://img.shields.io/badge/License-MIT-blue)
[![](https://data.jsdelivr.com/v1/package/npm/wangeditor/badge)](https://www.jsdelivr.com/package/npm/wangeditor)

<!-- PROJECT LOGO -->
<br />
<p align="center">
  <a href="http://www.wangeditor.com/">
    <img src="./docs/imgs/logo.png" alt="Logo" width="80" height="80">
  </a>

  <h3 align="center">wangEditor</h3>

  <p align="center">
    轻量级 web 富文本编辑器，配置方便，使用简单!
    <br />
    <a href="http://www.wangeditor.com"><strong>官网</strong></a>
    ·
    <a href="http://www.wangeditor.com/doc/"><strong>文档</strong></a>
    <br />
    <br />
    <a href="./README-en.md">English</a>
    ·
    <a href="http://www.wangeditor.com/doc/#demo">在线示例</a>
    ·
    <a href="https://github.com/wangeditor-team/wangEditor/issues/new?template=bug.md">提交 bug</a>
    ·
    <a href="https://github.com/wangeditor-team/wangEditor/issues/new?template=feature.md">建议增加新功能</a>
  </p>
</p>

<!-- ABOUT THE PROJECT -->
## 项目介绍

wangEditor 是一款使用 Typescript 开发的 Web 富文本编辑器， 轻量、简洁、易用、开源免费。

兼容常见的 PC 浏览器：Chrome，Firefox，Safar，Edge，QQ 浏览器，IE11。

不支持移动端。

当前是 `v4` 版本。想继续使用 `v3` 版本看[这里](http://www.wangeditor.com/doc/pages/01-%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8/08-%E4%BD%BF%E7%94%A8V3%E7%89%88%E6%9C%AC.html)。

![Product Screen Shot](./docs/imgs/demo.png)

## 安装和使用

### NPM
```bash
npm i wangeditor --save
```
安装后几行代码即可创建一个编辑器：

```js
import E from "wangeditor";
const editor = new E("#div1");
editor.create();
```
### CDN
```html
<script type="text/javascript" src="https://unpkg.com/wangeditor/dist/wangEditor.min.js"></script>
<script type="text/javascript">
  const E = window.wangEditor
  const editor = new E('#div1')
  // 或者 const editor = new E(document.getElementById('div1'))
  editor.create()
</script>
```

<!-- CONTRIBUTING -->
## 贡献

贡献使得开源社区成为一个学习、激励和创造的好地方，非常感谢你所做的任何贡献。在贡献 `wangEditor` 之前，你需要阅读文档 [contribution](./docs/contribution.md)。

<!-- LICENSE -->
## 许可证

项目在 MIT 的许可证下发布， 查看更多 [MIT](https://en.wikipedia.org/wiki/MIT_license) 许可证信息。

<!-- CONTACT -->
## 交流

加入 QQ 群
- 164999061（人已满）
- 710646022（人已满）
- 901247714（人已满）
- 606602511

提交 bug 或建议
- [github issues](https://github.com/wangeditor-team/wangeditor/issues) 提交问题

## 开发团队

有专业[开发团队](http://www.wangeditor.com/doc/#%E5%BC%80%E5%8F%91%E4%BA%BA%E5%91%98)维护，非个人单兵作战。

想加入 wangEditor 研发团队，可申请加入 QQ 群，然后私聊群主。

## 为我们加油

你的支持，将激励我们输出更多优质内容！

![](./docs/imgs/wechat-pay.jpeg)
![](./docs/imgs/ali-pay.jpeg)
npm package: @jusola/blind-signatures
Description: Chaum's Blind Signatures
Author: Kevin Johnson
Latest version: 1.0.8

# Chaum's Blind Signature

[![NPM Package](https://img.shields.io/npm/v/blind-signatures.svg?style=flat-square)](https://www.npmjs.org/package/blind-signatures)


### Two implementations of RSA Blind Signatures

1. `./rsablind.js`
https://en.wikipedia.org/wiki/Blind_signature

2. `./rsablind2.js`
https://github.com/arisath/Blind-RSA

The RSA key generation uses the node-only module `node-rsa` but everything else *should* work outside of node.js


## Use

`npm install --save blind-signatures`

```
const BlindSignature = require('blind-signatures');

const Bob = {
  key: BlindSignature.keyGeneration({ b: 2048 }), // b: key-length
  blinded: null,
  unblinded: null,
  message: null,
};

const Alice = {
  message: 'Hello Chaum!',
  N: null,
  E: null,
  r: null,
  signed: null,
  unblinded: null,
};

// Alice wants Bob to sign a message without revealing it's contents.
// Bob can later verify he did sign the message

console.log('Message:', Alice.message);

// Alice gets N and E variables from Bob's key
Alice.N = Bob.key.keyPair.n.toString();
Alice.E = Bob.key.keyPair.e.toString();

const { blinded, r } = BlindSignature.blind({
  message: Alice.message,
  N: Alice.N,
  E: Alice.E,
}); // Alice blinds message
Alice.r = r;

// Alice sends blinded to Bob
Bob.blinded = blinded;

const signed = BlindSignature.sign({
  blinded: Bob.blinded,
  key: Bob.key,
}); // Bob signs blinded message

// Bob sends signed to Alice
Alice.signed = signed;

const unblinded = BlindSignature.unblind({
  signed: Alice.signed,
  N: Alice.N,
  r: Alice.r,
}); // Alice unblinds
Alice.unblinded = unblinded;

// Alice verifies
const result = BlindSignature.verify({
  unblinded: Alice.unblinded,
  N: Alice.N,
  E: Alice.E,
  message: Alice.message,
});
if (result) {
  console.log('Alice: Signatures verify!');
} else {
  console.log('Alice: Invalid signature');
}

// Alice sends Bob unblinded signature and original message
Bob.unblinded = Alice.unblinded;
Bob.message = Alice.message;

// Bob verifies
const result2 = BlindSignature.verify2({
  unblinded: Bob.unblinded,
  key: Bob.key,
  message: Bob.message,
});
if (result2) {
  console.log('Bob: Signatures verify!');
} else {
  console.log('Bob: Invalid signature');
}
```