@tik-choco/mistsign 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +36 -29
- package/README.md +39 -31
- package/README.zh.md +34 -29
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -16,27 +16,26 @@
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
mistsign は Go 製 CLI [tc-sign](https://github.com/tik-choco/tc-sign) を基にした、
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
ブラウザ向けの TypeScript ライブラリ。ファイル・データへの電子署名、署名の検証、
|
|
20
|
+
信頼の判定、複数人の合意を Web アプリに組み込める。
|
|
21
21
|
|
|
22
|
-
[mistseed](https://www.npmjs.com/package/@tik-choco/mistseed) 互換の DidSigner
|
|
23
|
-
tc-sign 互換の正規化 JSON
|
|
24
|
-
[mistlib](https://github.com/tik-choco-lab/mistlib) を前提とする。mistlib ノードは
|
|
25
|
-
アプリ側から注入し、ライブラリは mistlib ノードの実装に直接依存しない。
|
|
22
|
+
[mistseed](https://www.npmjs.com/package/@tik-choco/mistseed) 互換の `DidSigner`・`DelegationV1` 型を受け付け、
|
|
23
|
+
Ed25519 の `did:key` と tc-sign 互換の正規化 JSON に対応している。
|
|
26
24
|
|
|
27
25
|
## 特徴
|
|
28
26
|
|
|
29
27
|
| | |
|
|
30
28
|
| --- | --- |
|
|
31
|
-
| **署名** |
|
|
32
|
-
| **信頼** |
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
29
|
+
| **署名** | 分離署名(`.tcsig` v1)の作成と検証 |
|
|
30
|
+
| **信頼** | 委任・失効・署名者一覧に基づく判定 |
|
|
31
|
+
| **時刻証明** | RFC 3161 の時刻証明トークンの検証 |
|
|
32
|
+
| **合意** | 提案の作成、意思表示への署名、証拠の取りまとめ、M-of-N などの成立条件の判定 |
|
|
33
|
+
| **通信** | mistlib 経由の署名の依頼・回収(予定) |
|
|
34
|
+
| **ポータブルな UI** | フレームワーク非依存の Web Components と任意の Preact 連携(予定) |
|
|
36
35
|
|
|
37
36
|
## 導入
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
`@tik-choco/mistsign` 0.1.0 は npm で公開済み。
|
|
40
39
|
|
|
41
40
|
```sh
|
|
42
41
|
npm install @tik-choco/mistsign
|
|
@@ -44,8 +43,7 @@ npm install @tik-choco/mistsign
|
|
|
44
43
|
|
|
45
44
|
## 使い方
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
新しい形式には `mistsign:*` という type 名を使う。
|
|
46
|
+
分離署名には tc-sign の `.tcsig` v1 形式(`type: tc-sign:signature`)を使う。
|
|
49
47
|
|
|
50
48
|
```ts
|
|
51
49
|
import { signFile, verify, type DidSigner } from '@tik-choco/mistsign'
|
|
@@ -72,29 +70,38 @@ async function signAndVerify(file: File, signer: DidSigner, expectedDid: string)
|
|
|
72
70
|
署名者一覧・委任・失効の判定は `@tik-choco/mistsign/trust` でも利用できる。
|
|
73
71
|
|
|
74
72
|
対応環境は Web Crypto Ed25519 を備えたブラウザと Node.js 22 以上。
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
|
|
74
|
+
RFC 3161 の時刻証明を検証するには、DER 形式のトークンを `options.timestamp`、時刻認証局
|
|
75
|
+
(TSA)の信頼ルート証明書を `options.tsaRoots` として `verify` に渡す。CMS の署名、ESS 属性、
|
|
76
|
+
X.509 の証明書チェーンを検証し、確認できた `genTime` を委任・失効・署名者一覧の判定時刻に使う。
|
|
77
|
+
指定した信頼ルートでトークンを検証できなければ、`verify` は `invalid` を返す。
|
|
78
|
+
既定では、トークンか信頼ルートを省略すると自己申告の署名時刻を使う。検証済みの時刻証明を必須にするには
|
|
79
|
+
`requireTimestamp: true` を指定する。
|
|
80
|
+
|
|
81
|
+
合意 API では `mistsign:agreement` v1 の提案を作成し、承認・拒否・撤回の意思表示に署名できる。
|
|
82
|
+
意思表示と関連する証拠を束ね、`verifyAgreement` で提案の成立条件を満たすか判定する。
|
|
83
|
+
詳細は [合意の仕様](docs/AGREEMENT.md) を参照。
|
|
78
84
|
|
|
79
85
|
## API
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
パッケージのエントリポイント
|
|
82
88
|
|
|
83
89
|
| サブパス | 役割 |
|
|
84
90
|
| --- | --- |
|
|
85
|
-
| `.` |
|
|
86
|
-
| `./trust` |
|
|
87
|
-
| `./agreement` |
|
|
88
|
-
| `./transport` |
|
|
89
|
-
| `./timestamp` |
|
|
90
|
-
| `./elements` | Web Components |
|
|
91
|
-
| `./preact` | 任意の Preact UI
|
|
91
|
+
| `.` | 署名・検証、Ed25519 の `did:key`、正規化 JSON |
|
|
92
|
+
| `./trust` | 委任・失効・署名者一覧 |
|
|
93
|
+
| `./agreement` | 提案、意思表示への署名、証拠の取りまとめ、成立判定 |
|
|
94
|
+
| `./transport` | 署名の依頼・回収(予定、エントリのみ) |
|
|
95
|
+
| `./timestamp` | RFC 3161 の時刻証明の検証 |
|
|
96
|
+
| `./elements` | Web Components(予定、エントリのみ) |
|
|
97
|
+
| `./preact` | 任意の Preact UI とフック(予定、エントリのみ) |
|
|
92
98
|
| `./testing` | テスト用ユーティリティ |
|
|
93
|
-
| `./ui.css` | UI
|
|
99
|
+
| `./ui.css` | UI スタイル(予定、空のスタイルシート) |
|
|
94
100
|
|
|
95
101
|
## 設定
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
コア機能は Web フレームワークに依存しない。今後の署名の依頼・回収には、アプリ側が提供する
|
|
104
|
+
[mistlib](https://github.com/tik-choco-lab/mistlib) ノードを使う予定。
|
|
98
105
|
|
|
99
106
|
## ソースからのビルド
|
|
100
107
|
|
|
@@ -110,8 +117,8 @@ npm run build
|
|
|
110
117
|
|
|
111
118
|
## ステータス
|
|
112
119
|
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
開発途上。分離署名の作成と検証、信頼判定、RFC 3161 の時刻証明の検証、合意は実装済み。
|
|
121
|
+
通信と UI は今後の予定。
|
|
115
122
|
|
|
116
123
|
## ライセンス
|
|
117
124
|
|
package/README.md
CHANGED
|
@@ -15,29 +15,28 @@ English · [日本語](README.ja.md) · [简体中文](README.zh.md)
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
mistsign is a browser-oriented TypeScript library
|
|
19
|
-
[tc-sign](https://github.com/tik-choco/tc-sign). It
|
|
20
|
-
files and data, signature verification, trust evaluation, and multi-party agreements to
|
|
18
|
+
mistsign is a browser-oriented TypeScript library based on the Go CLI
|
|
19
|
+
[tc-sign](https://github.com/tik-choco/tc-sign). It brings electronic signatures for
|
|
20
|
+
files and data, signature verification, trust evaluation, and multi-party agreements to web apps.
|
|
21
21
|
|
|
22
22
|
It accepts [mistseed](https://www.npmjs.com/package/@tik-choco/mistseed)-compatible
|
|
23
|
-
DidSigner and DelegationV1 types
|
|
24
|
-
|
|
25
|
-
[mistlib](https://github.com/tik-choco-lab/mistlib) for requesting and collecting signatures.
|
|
26
|
-
The host app will inject its mistlib node; the library will not depend directly on a mistlib node implementation.
|
|
23
|
+
`DidSigner` and `DelegationV1` types and supports Ed25519 `did:key` and
|
|
24
|
+
tc-sign-compatible canonical JSON.
|
|
27
25
|
|
|
28
26
|
## Features
|
|
29
27
|
|
|
30
28
|
| | |
|
|
31
29
|
| --- | --- |
|
|
32
|
-
| **Signatures** |
|
|
33
|
-
| **Trust** | Evaluate
|
|
34
|
-
| **
|
|
35
|
-
| **
|
|
36
|
-
| **
|
|
30
|
+
| **Signatures** | Create and verify detached `.tcsig` v1 signatures |
|
|
31
|
+
| **Trust** | Evaluate delegations, revocations, and allowed signers |
|
|
32
|
+
| **Timestamps** | Verify RFC 3161 timestamp tokens |
|
|
33
|
+
| **Agreements** | Create proposals, sign decisions, bundle evidence, and evaluate policies such as M-of-N |
|
|
34
|
+
| **Transport** | Request and collect signatures via mistlib (planned) |
|
|
35
|
+
| **Portable UI** | Framework-independent Web Components and optional Preact integration (planned) |
|
|
37
36
|
|
|
38
37
|
## Install
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
`@tik-choco/mistsign` 0.1.0 is available on npm.
|
|
41
40
|
|
|
42
41
|
```sh
|
|
43
42
|
npm install @tik-choco/mistsign
|
|
@@ -45,8 +44,7 @@ npm install @tik-choco/mistsign
|
|
|
45
44
|
|
|
46
45
|
## Usage
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
New formats will use `mistsign:*` type names.
|
|
47
|
+
Detached signatures use tc-sign's `.tcsig` v1 format (`type: tc-sign:signature`).
|
|
50
48
|
|
|
51
49
|
```ts
|
|
52
50
|
import { signFile, verify, type DidSigner } from '@tik-choco/mistsign'
|
|
@@ -75,29 +73,39 @@ valid signature is `signer-unconfirmed`. Allowed signers, delegations and
|
|
|
75
73
|
revocation checks are available via `@tik-choco/mistsign/trust`.
|
|
76
74
|
|
|
77
75
|
Supported environments are browsers with Web Crypto Ed25519 and Node.js 22+.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
|
|
77
|
+
For RFC 3161 verification, pass a DER-encoded token as `options.timestamp` and trusted
|
|
78
|
+
timestamp authority (TSA) root certificates as `options.tsaRoots` to `verify`. Verification
|
|
79
|
+
checks the CMS signature, ESS attributes, and the X.509 certificate chain. A verified
|
|
80
|
+
`genTime` is used to evaluate delegations, revocations, and allowed signers. A token
|
|
81
|
+
that fails verification against the supplied roots yields `invalid`. By default,
|
|
82
|
+
omitting either the token or the roots leaves the signing time self-declared. Set
|
|
83
|
+
`requireTimestamp: true` to require a verified timestamp.
|
|
84
|
+
|
|
85
|
+
The agreement API creates `mistsign:agreement` v1 proposals, signs accept, reject,
|
|
86
|
+
or withdraw decisions, and bundles the decisions and supporting evidence.
|
|
87
|
+
`verifyAgreement` checks whether the proposal's formation rules are met. See the [agreement specification](docs/AGREEMENT.md).
|
|
81
88
|
|
|
82
89
|
## API
|
|
83
90
|
|
|
84
|
-
Package entry points
|
|
91
|
+
Package entry points
|
|
85
92
|
|
|
86
93
|
| Subpath | Responsibility |
|
|
87
94
|
| --- | --- |
|
|
88
|
-
| `.` | Signing and
|
|
89
|
-
| `./trust` |
|
|
90
|
-
| `./agreement` |
|
|
91
|
-
| `./transport` | Signature requests and collection |
|
|
92
|
-
| `./timestamp` |
|
|
93
|
-
| `./elements` | Web Components |
|
|
94
|
-
| `./preact` | Optional Preact UI and hooks |
|
|
95
|
+
| `.` | Signing, verification, Ed25519 `did:key`, and canonical JSON |
|
|
96
|
+
| `./trust` | Delegations, revocations, and allowed signers |
|
|
97
|
+
| `./agreement` | Proposals, signed decisions, evidence bundles, and formation checks |
|
|
98
|
+
| `./transport` | Signature requests and collection (planned, empty entry point) |
|
|
99
|
+
| `./timestamp` | RFC 3161 timestamp verification |
|
|
100
|
+
| `./elements` | Web Components (planned, empty entry point) |
|
|
101
|
+
| `./preact` | Optional Preact UI and hooks (planned, empty entry point) |
|
|
95
102
|
| `./testing` | Test utilities |
|
|
96
|
-
| `./ui.css` | UI styles |
|
|
103
|
+
| `./ui.css` | UI styles (planned, empty stylesheet) |
|
|
97
104
|
|
|
98
105
|
## Configuration
|
|
99
106
|
|
|
100
|
-
The
|
|
107
|
+
The core is framework-independent. The planned signature transport will use a
|
|
108
|
+
[mistlib](https://github.com/tik-choco-lab/mistlib) node supplied by the host app.
|
|
101
109
|
|
|
102
110
|
## Build from source
|
|
103
111
|
|
|
@@ -113,9 +121,9 @@ them from a sibling `../tc-sign` checkout, run `npm run vectors:sync`.
|
|
|
113
121
|
|
|
114
122
|
## Status
|
|
115
123
|
|
|
116
|
-
Under active development.
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
Under active development. Detached signing and verification, trust evaluation,
|
|
125
|
+
RFC 3161 timestamp verification, and agreements are implemented. Transport and
|
|
126
|
+
UI are planned.
|
|
119
127
|
|
|
120
128
|
## License
|
|
121
129
|
|
package/README.zh.md
CHANGED
|
@@ -15,28 +15,26 @@
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
mistsign 是基于 Go CLI [tc-sign](https://github.com/tik-choco/tc-sign)
|
|
19
|
-
|
|
20
|
-
电子签名、签名验证、信任评估以及多方合议。
|
|
18
|
+
mistsign 是基于 Go CLI [tc-sign](https://github.com/tik-choco/tc-sign) 的浏览器端
|
|
19
|
+
TypeScript 库,为 Web 应用提供文件和数据的电子签名、签名验证、信任评估以及多方合议。
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
DidSigner
|
|
24
|
-
[mistlib](https://github.com/tik-choco-lab/mistlib) 请求和收集签名。mistlib 节点由宿主应用注入,
|
|
25
|
-
本库不直接依赖 mistlib 节点的具体实现。
|
|
21
|
+
本库接受与 [mistseed](https://www.npmjs.com/package/@tik-choco/mistseed) 兼容的
|
|
22
|
+
`DidSigner` 和 `DelegationV1` 类型,支持 Ed25519 `did:key` 和与 tc-sign 兼容的规范化 JSON。
|
|
26
23
|
|
|
27
24
|
## 特性
|
|
28
25
|
|
|
29
26
|
| | |
|
|
30
27
|
| --- | --- |
|
|
31
|
-
| **签名** |
|
|
32
|
-
| **信任** |
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
28
|
+
| **签名** | 创建和验证分离签名(`.tcsig` v1) |
|
|
29
|
+
| **信任** | 根据委托、撤销和允许签名者列表进行评估 |
|
|
30
|
+
| **时间戳** | 验证 RFC 3161 时间戳令牌 |
|
|
31
|
+
| **合议** | 创建提案、签署决定、打包证据,并按 M-of-N 等规则判定是否成立 |
|
|
32
|
+
| **传输** | 通过 mistlib 请求和收集签名(计划中) |
|
|
33
|
+
| **可移植 UI** | 不依赖框架的 Web Components 与可选的 Preact 集成(计划中) |
|
|
36
34
|
|
|
37
35
|
## 安装
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
`@tik-choco/mistsign` 0.1.0 已在 npm 上发布。
|
|
40
38
|
|
|
41
39
|
```sh
|
|
42
40
|
npm install @tik-choco/mistsign
|
|
@@ -44,8 +42,7 @@ npm install @tik-choco/mistsign
|
|
|
44
42
|
|
|
45
43
|
## 用法
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
新格式将使用 `mistsign:*` 类型名称。
|
|
45
|
+
分离签名采用 tc-sign 的 `.tcsig` v1 格式(`type: tc-sign:signature`)。
|
|
49
46
|
|
|
50
47
|
```ts
|
|
51
48
|
import { signFile, verify, type DidSigner } from '@tik-choco/mistsign'
|
|
@@ -72,28 +69,36 @@ ReadableStream<Uint8Array>,此时需显式传入 `{ name: 'report.pdf' }` 等
|
|
|
72
69
|
允许签名者列表、委托和撤销检查可通过 `@tik-choco/mistsign/trust` 使用。
|
|
73
70
|
|
|
74
71
|
支持提供 Web Crypto Ed25519 的浏览器和 Node.js 22 及以上版本。
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
|
|
73
|
+
要验证 RFC 3161 时间戳,请将 DER 编码的令牌通过 `options.timestamp` 传给 `verify`,
|
|
74
|
+
并通过 `options.tsaRoots` 提供时间戳机构(TSA)的受信任根证书。验证过程会检查 CMS 签名、
|
|
75
|
+
ESS 属性和 X.509 证书链,并以通过验证的 `genTime` 作为核查委托、撤销和允许签名者列表的时间依据。
|
|
76
|
+
如果令牌未能通过基于所提供信任根的验证,`verify` 会返回 `invalid`。默认情况下,省略令牌或信任根时,
|
|
77
|
+
`verify` 会使用签名者自行声明的签名时间。可设置 `requireTimestamp: true`,要求时间戳通过验证。
|
|
78
|
+
|
|
79
|
+
合议 API 支持创建 `mistsign:agreement` v1 提案,为接受、拒绝或撤回决定签名,将决定和相关证据
|
|
80
|
+
打包,再通过 `verifyAgreement` 判定是否满足提案的成立条件。详见 [合议规范](docs/AGREEMENT.md)。
|
|
77
81
|
|
|
78
82
|
## API
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
软件包入口
|
|
81
85
|
|
|
82
86
|
| 子路径 | 作用 |
|
|
83
87
|
| --- | --- |
|
|
84
|
-
| `.` |
|
|
85
|
-
| `./trust` |
|
|
86
|
-
| `./agreement` |
|
|
87
|
-
| `./transport` |
|
|
88
|
-
| `./timestamp` |
|
|
89
|
-
| `./elements` | Web Components |
|
|
90
|
-
| `./preact` | 可选的 Preact UI 和 Hooks |
|
|
88
|
+
| `.` | 签名、验证、Ed25519 `did:key` 和规范化 JSON |
|
|
89
|
+
| `./trust` | 委托、撤销和允许签名者列表 |
|
|
90
|
+
| `./agreement` | 提案、签署决定、证据打包和成立判定 |
|
|
91
|
+
| `./transport` | 签名请求与收集(计划中,仅预留入口) |
|
|
92
|
+
| `./timestamp` | RFC 3161 时间戳验证 |
|
|
93
|
+
| `./elements` | Web Components(计划中,仅预留入口) |
|
|
94
|
+
| `./preact` | 可选的 Preact UI 和 Hooks(计划中,仅预留入口) |
|
|
91
95
|
| `./testing` | 测试工具 |
|
|
92
|
-
| `./ui.css` | UI
|
|
96
|
+
| `./ui.css` | UI 样式(计划中,样式表为空) |
|
|
93
97
|
|
|
94
98
|
## 配置
|
|
95
99
|
|
|
96
|
-
|
|
100
|
+
核心功能不依赖 Web 框架。计划中的签名请求与收集功能将使用由宿主应用提供的
|
|
101
|
+
[mistlib](https://github.com/tik-choco-lab/mistlib) 节点。
|
|
97
102
|
|
|
98
103
|
## 从源码构建
|
|
99
104
|
|
|
@@ -109,8 +114,8 @@ npm run build
|
|
|
109
114
|
|
|
110
115
|
## 状态
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
仍在开发中。已实现分离签名的创建与验证、信任评估、RFC 3161 时间戳验证和合议。
|
|
118
|
+
传输与 UI 仍在计划中。
|
|
114
119
|
|
|
115
120
|
## 许可
|
|
116
121
|
|
package/package.json
CHANGED