@solidus-network/bbs 0.2.0
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/LICENSE +201 -0
- package/README.md +99 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +270 -0
- package/dist/index.js.map +1 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Solidus Network
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing permissions
|
|
201
|
+
and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @solidus-network/bbs
|
|
2
|
+
|
|
3
|
+
BBS+ selective-disclosure primitives for Solidus Network. Wraps
|
|
4
|
+
[`@digitalbazaar/bbs-signatures`](https://www.npmjs.com/package/@digitalbazaar/bbs-signatures)
|
|
5
|
+
v3.0.0 with a Solidus-shaped API mirroring `solidus-crypto::bbs` in the
|
|
6
|
+
Rust chain crate.
|
|
7
|
+
|
|
8
|
+
**Ciphersuite:** `BLS12-381-SHA-256` per IRTF
|
|
9
|
+
[`draft-irtf-cfrg-bbs-signatures`](https://www.ietf.org/archive/id/draft-irtf-cfrg-bbs-signatures-10.html).
|
|
10
|
+
|
|
11
|
+
**Compatibility:** byte-compatible with the Solidus chain's BBS+
|
|
12
|
+
implementation (zkryptium 0.6.1) for Sign / Verify / ProofGen /
|
|
13
|
+
ProofVerify, verified by reproducing `solidus-crypto::bbs` test vectors
|
|
14
|
+
in this package's vitest suite. The same secret key bytes produce the
|
|
15
|
+
same public key bytes in both libraries, and signatures generated in
|
|
16
|
+
one verify in the other.
|
|
17
|
+
|
|
18
|
+
**One known divergence:** IKM→SK derivation. zkryptium uses IRTF
|
|
19
|
+
draft-10 `KeyGen`, while `@digitalbazaar/bbs-signatures` 3.0.0 uses
|
|
20
|
+
an earlier draft. Same IKM → different SK bytes across the two
|
|
21
|
+
libraries. Practical impact: zero for production (transmit SK bytes
|
|
22
|
+
directly, or generate randomly). Just don't expect IKM-based keygen
|
|
23
|
+
to roundtrip across languages.
|
|
24
|
+
|
|
25
|
+
**Audit posture:** testnet-grade. External audit pending via NLnet NGI
|
|
26
|
+
Zero (H2 2026 target). Do **not** use for production-grade key
|
|
27
|
+
material until the audit completes.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install @solidus-network/bbs
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> Published on npm as `@solidus-network/bbs` (the public scope).
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import {
|
|
41
|
+
BbsSecretKey,
|
|
42
|
+
BbsPublicKey,
|
|
43
|
+
BbsSignature,
|
|
44
|
+
utf8,
|
|
45
|
+
} from '@solidus-network/bbs'
|
|
46
|
+
|
|
47
|
+
// Issuer side
|
|
48
|
+
const sk = await BbsSecretKey.generate()
|
|
49
|
+
const pk = await sk.publicKey()
|
|
50
|
+
const header = utf8('did:solidus:testnet:issuer-1')
|
|
51
|
+
const messages = [
|
|
52
|
+
utf8('did:solidus:testnet:alice'),
|
|
53
|
+
utf8('Alice Liddell'),
|
|
54
|
+
utf8('1990-07-04'),
|
|
55
|
+
utf8('GB'),
|
|
56
|
+
]
|
|
57
|
+
const sig = await sk.sign(header, messages)
|
|
58
|
+
|
|
59
|
+
// Verifier side
|
|
60
|
+
const valid = await sig.verify(pk, header, messages)
|
|
61
|
+
|
|
62
|
+
// Selective disclosure (holder side)
|
|
63
|
+
const proof = await sig.createProof({
|
|
64
|
+
pk,
|
|
65
|
+
header,
|
|
66
|
+
presentationHeader: utf8('verifier-challenge-nonce'),
|
|
67
|
+
messages,
|
|
68
|
+
disclosedIndices: [0, 3], // reveal DID and country only
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// Verifier-side proof check
|
|
72
|
+
const ok = await proof.verify({
|
|
73
|
+
pk,
|
|
74
|
+
header,
|
|
75
|
+
presentationHeader: utf8('verifier-challenge-nonce'),
|
|
76
|
+
disclosedIndices: [0, 3],
|
|
77
|
+
disclosedMessages: [messages[0], messages[3]],
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Sizes
|
|
82
|
+
|
|
83
|
+
| Element | Bytes |
|
|
84
|
+
|---------|-------|
|
|
85
|
+
| Secret key (Fr scalar) | 32 |
|
|
86
|
+
| Public key (compressed BLS12-381 G2) | 96 |
|
|
87
|
+
| Signature | 80 |
|
|
88
|
+
| Proof (variable) | depends on undisclosed-message count |
|
|
89
|
+
|
|
90
|
+
## Out of scope
|
|
91
|
+
|
|
92
|
+
- ZK predicate proofs (e.g., proving `age ≥ 18` without revealing DOB)
|
|
93
|
+
— needs Bulletproofs or Plonk on top of BBS+. Tracked under the
|
|
94
|
+
Solidus Groth16/Plonk decision date 2026-07-31.
|
|
95
|
+
- Blind signing — supported by zkryptium, not yet exposed here.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
Apache-2.0.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Serialized size of a BBS+ secret key (BLS12-381 Fr scalar). */
|
|
2
|
+
export declare const BBS_SECRET_KEY_BYTES = 32;
|
|
3
|
+
/** Serialized size of a BBS+ public key (compressed BLS12-381 G2 point). */
|
|
4
|
+
export declare const BBS_PUBLIC_KEY_BYTES = 96;
|
|
5
|
+
/** Serialized size of a BBS+ signature. */
|
|
6
|
+
export declare const BBS_SIGNATURE_BYTES = 80;
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of messages signed in a single BBS+ credential.
|
|
9
|
+
* Matches `BBS_MAX_MESSAGE_COUNT` in `solidus-txns/src/credential.rs`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const BBS_MAX_MESSAGE_COUNT = 64;
|
|
12
|
+
export declare class BbsError extends Error {
|
|
13
|
+
readonly cause?: unknown | undefined;
|
|
14
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
15
|
+
}
|
|
16
|
+
export declare class BbsSecretKey {
|
|
17
|
+
private readonly bytes;
|
|
18
|
+
private constructor();
|
|
19
|
+
/** Generate a fresh random BBS+ secret key. */
|
|
20
|
+
static generate(): Promise<BbsSecretKey>;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a BBS+ keypair deterministically from input key material.
|
|
23
|
+
*
|
|
24
|
+
* **Cross-language note:** zkryptium 0.6.1 (the Rust chain crate)
|
|
25
|
+
* implements IRTF draft-10 KeyGen. The wrapped JS library implements an
|
|
26
|
+
* earlier draft revision of KeyGen, so IKM-based derivation produces
|
|
27
|
+
* different SK bytes between the two libraries. Sign/Verify/Proof
|
|
28
|
+
* operations remain byte-compatible — only IKM→SK diverges. For
|
|
29
|
+
* production cross-language workflows, transmit SK bytes directly
|
|
30
|
+
* (via `fromBytes`) rather than re-deriving from IKM.
|
|
31
|
+
*/
|
|
32
|
+
static fromIkm(ikm: Uint8Array): Promise<BbsSecretKey>;
|
|
33
|
+
/** Deserialize a 32-byte secret key (big-endian). */
|
|
34
|
+
static fromBytes(bytes: Uint8Array): BbsSecretKey;
|
|
35
|
+
/** Decode from hex. */
|
|
36
|
+
static fromHex(hex: string): BbsSecretKey;
|
|
37
|
+
/** Serialize to 32 bytes (big-endian). */
|
|
38
|
+
toBytes(): Uint8Array;
|
|
39
|
+
/** Encode as lowercase hex. */
|
|
40
|
+
toHex(): string;
|
|
41
|
+
/** Derive the corresponding public key. */
|
|
42
|
+
publicKey(): Promise<BbsPublicKey>;
|
|
43
|
+
/**
|
|
44
|
+
* Sign a vector of messages with optional context header. Matches
|
|
45
|
+
* `BbsSecretKey::sign(header, messages)` in the Rust crate.
|
|
46
|
+
*/
|
|
47
|
+
sign(header: Uint8Array, messages: Uint8Array[]): Promise<BbsSignature>;
|
|
48
|
+
}
|
|
49
|
+
export declare class BbsPublicKey {
|
|
50
|
+
private readonly bytes;
|
|
51
|
+
private constructor();
|
|
52
|
+
static fromBytes(bytes: Uint8Array): BbsPublicKey;
|
|
53
|
+
static fromHex(hex: string): BbsPublicKey;
|
|
54
|
+
toBytes(): Uint8Array;
|
|
55
|
+
toHex(): string;
|
|
56
|
+
equals(other: BbsPublicKey): boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare class BbsSignature {
|
|
59
|
+
private readonly bytes;
|
|
60
|
+
private constructor();
|
|
61
|
+
static fromBytes(bytes: Uint8Array): BbsSignature;
|
|
62
|
+
static fromHex(hex: string): BbsSignature;
|
|
63
|
+
toBytes(): Uint8Array;
|
|
64
|
+
toHex(): string;
|
|
65
|
+
/** Verify this signature against a public key, header, and message vector. */
|
|
66
|
+
verify(pk: BbsPublicKey, header: Uint8Array, messages: Uint8Array[]): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Generate a selective-disclosure proof from this signature.
|
|
69
|
+
* `disclosedIndices` must be in strictly ascending order.
|
|
70
|
+
*/
|
|
71
|
+
createProof(opts: {
|
|
72
|
+
pk: BbsPublicKey;
|
|
73
|
+
header: Uint8Array;
|
|
74
|
+
presentationHeader: Uint8Array;
|
|
75
|
+
messages: Uint8Array[];
|
|
76
|
+
disclosedIndices: number[];
|
|
77
|
+
}): Promise<BbsProof>;
|
|
78
|
+
}
|
|
79
|
+
export declare class BbsProof {
|
|
80
|
+
private readonly bytes;
|
|
81
|
+
private constructor();
|
|
82
|
+
static fromBytes(bytes: Uint8Array): BbsProof;
|
|
83
|
+
static fromHex(hex: string): BbsProof;
|
|
84
|
+
toBytes(): Uint8Array;
|
|
85
|
+
toHex(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Verify this proof against a public key, header, presentation header,
|
|
88
|
+
* disclosed messages, and the indices those messages occupied in the
|
|
89
|
+
* original signed vector.
|
|
90
|
+
*/
|
|
91
|
+
verify(opts: {
|
|
92
|
+
pk: BbsPublicKey;
|
|
93
|
+
header: Uint8Array;
|
|
94
|
+
presentationHeader: Uint8Array;
|
|
95
|
+
disclosedIndices: number[];
|
|
96
|
+
disclosedMessages: Uint8Array[];
|
|
97
|
+
}): Promise<boolean>;
|
|
98
|
+
}
|
|
99
|
+
/** Encode a UTF-8 string as raw bytes (for use as a message or header). */
|
|
100
|
+
export declare function utf8(s: string): Uint8Array;
|
|
101
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+BA,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,KAAK,CAAA;AACtC,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,KAAK,CAAA;AACtC,2CAA2C;AAC3C,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAIvC,qBAAa,QAAS,SAAQ,KAAK;IACJ,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;gBAAzC,OAAO,EAAE,MAAM,EAAW,KAAK,CAAC,EAAE,OAAO,YAAA;CAItD;AAuBD,qBAAa,YAAY;IACH,OAAO,CAAC,QAAQ,CAAC,KAAK;IAA1C,OAAO;IAIP,+CAA+C;WAClC,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAK9C;;;;;;;;;;OAUG;WACU,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAW5D,qDAAqD;IACrD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY;IAIjD,uBAAuB;IACvB,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;IAMzC,0CAA0C;IAC1C,OAAO,IAAI,UAAU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AC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ;IAI7C,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;IAIrC,OAAO,IAAI,UAAU;IAIrB,KAAK,IAAI,MAAM;IAIf;;;;OAIG;IACG,MAAM,CAAC,IAAI,EAAE;QACjB,EAAE,EAAE,YAAY,CAAA;QAChB,MAAM,EAAE,UAAU,CAAA;QAClB,kBAAkB,EAAE,UAAU,CAAA;QAC9B,gBAAgB,EAAE,MAAM,EAAE,CAAA;QAC1B,iBAAiB,EAAE,UAAU,EAAE,CAAA;KAChC,GAAG,OAAO,CAAC,OAAO,CAAC;CAcrB;AAID,2EAA2E;AAC3E,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAE1C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BBS+ selective-disclosure primitives for Solidus Network.
|
|
3
|
+
*
|
|
4
|
+
* Wraps {@link https://www.npmjs.com/package/@digitalbazaar/bbs-signatures @digitalbazaar/bbs-signatures}
|
|
5
|
+
* v3.0.0 with a Solidus-shaped API mirroring the conventions of
|
|
6
|
+
* `solidus-crypto::bbs` in the Rust chain crate.
|
|
7
|
+
*
|
|
8
|
+
* Ciphersuite is pinned to `BLS12-381-SHA-256` per IRTF
|
|
9
|
+
* `draft-irtf-cfrg-bbs-signatures`. Verified byte-compatible with
|
|
10
|
+
* `zkryptium` 0.6.1 (the chain's BBS+ implementation) — the same secret
|
|
11
|
+
* key produces the same public key and the chain's signatures verify in
|
|
12
|
+
* this library and vice-versa.
|
|
13
|
+
*
|
|
14
|
+
* Audit posture: testnet-grade. External audit pending via NLnet NGI Zero
|
|
15
|
+
* (H2 2026 target). Do NOT use for production-grade key material until
|
|
16
|
+
* the audit completes.
|
|
17
|
+
*/
|
|
18
|
+
import { CIPHERSUITES, generateKeyPair, secretKeyToPublicKey, sign as bbsSign, verifySignature as bbsVerify, deriveProof as bbsDeriveProof, verifyProof as bbsVerifyProof, } from '@digitalbazaar/bbs-signatures';
|
|
19
|
+
const CIPHERSUITE = CIPHERSUITES.BLS12381_SHA256;
|
|
20
|
+
// ---------- byte-size constants (match the Rust crate) ----------
|
|
21
|
+
/** Serialized size of a BBS+ secret key (BLS12-381 Fr scalar). */
|
|
22
|
+
export const BBS_SECRET_KEY_BYTES = 32;
|
|
23
|
+
/** Serialized size of a BBS+ public key (compressed BLS12-381 G2 point). */
|
|
24
|
+
export const BBS_PUBLIC_KEY_BYTES = 96;
|
|
25
|
+
/** Serialized size of a BBS+ signature. */
|
|
26
|
+
export const BBS_SIGNATURE_BYTES = 80;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum number of messages signed in a single BBS+ credential.
|
|
29
|
+
* Matches `BBS_MAX_MESSAGE_COUNT` in `solidus-txns/src/credential.rs`.
|
|
30
|
+
*/
|
|
31
|
+
export const BBS_MAX_MESSAGE_COUNT = 64;
|
|
32
|
+
// ---------- error types ----------
|
|
33
|
+
export class BbsError extends Error {
|
|
34
|
+
cause;
|
|
35
|
+
constructor(message, cause) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.cause = cause;
|
|
38
|
+
this.name = 'BbsError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// ---------- helpers ----------
|
|
42
|
+
function assertLen(label, got, want) {
|
|
43
|
+
if (got !== want) {
|
|
44
|
+
throw new BbsError(`${label}: expected ${want} bytes, got ${got}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function toHex(bytes) {
|
|
48
|
+
return Buffer.from(bytes).toString('hex');
|
|
49
|
+
}
|
|
50
|
+
function fromHex(hex, label) {
|
|
51
|
+
if (!/^[0-9a-f]*$/i.test(hex) || hex.length % 2 !== 0) {
|
|
52
|
+
throw new BbsError(`${label} is not valid hex`);
|
|
53
|
+
}
|
|
54
|
+
return new Uint8Array(Buffer.from(hex, 'hex'));
|
|
55
|
+
}
|
|
56
|
+
// ---------- BbsSecretKey ----------
|
|
57
|
+
export class BbsSecretKey {
|
|
58
|
+
bytes;
|
|
59
|
+
constructor(bytes) {
|
|
60
|
+
this.bytes = bytes;
|
|
61
|
+
assertLen('secret key', bytes.length, BBS_SECRET_KEY_BYTES);
|
|
62
|
+
}
|
|
63
|
+
/** Generate a fresh random BBS+ secret key. */
|
|
64
|
+
static async generate() {
|
|
65
|
+
const { secretKey } = await generateKeyPair({ ciphersuite: CIPHERSUITE });
|
|
66
|
+
return new BbsSecretKey(new Uint8Array(secretKey));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Generate a BBS+ keypair deterministically from input key material.
|
|
70
|
+
*
|
|
71
|
+
* **Cross-language note:** zkryptium 0.6.1 (the Rust chain crate)
|
|
72
|
+
* implements IRTF draft-10 KeyGen. The wrapped JS library implements an
|
|
73
|
+
* earlier draft revision of KeyGen, so IKM-based derivation produces
|
|
74
|
+
* different SK bytes between the two libraries. Sign/Verify/Proof
|
|
75
|
+
* operations remain byte-compatible — only IKM→SK diverges. For
|
|
76
|
+
* production cross-language workflows, transmit SK bytes directly
|
|
77
|
+
* (via `fromBytes`) rather than re-deriving from IKM.
|
|
78
|
+
*/
|
|
79
|
+
static async fromIkm(ikm) {
|
|
80
|
+
if (ikm.length < 32) {
|
|
81
|
+
throw new BbsError(`ikm must be ≥ 32 bytes, got ${ikm.length}`);
|
|
82
|
+
}
|
|
83
|
+
const { secretKey } = await generateKeyPair({
|
|
84
|
+
ciphersuite: CIPHERSUITE,
|
|
85
|
+
seed: ikm,
|
|
86
|
+
});
|
|
87
|
+
return new BbsSecretKey(new Uint8Array(secretKey));
|
|
88
|
+
}
|
|
89
|
+
/** Deserialize a 32-byte secret key (big-endian). */
|
|
90
|
+
static fromBytes(bytes) {
|
|
91
|
+
return new BbsSecretKey(new Uint8Array(bytes));
|
|
92
|
+
}
|
|
93
|
+
/** Decode from hex. */
|
|
94
|
+
static fromHex(hex) {
|
|
95
|
+
const bytes = fromHex(hex, 'secret key');
|
|
96
|
+
assertLen('secret key', bytes.length, BBS_SECRET_KEY_BYTES);
|
|
97
|
+
return new BbsSecretKey(bytes);
|
|
98
|
+
}
|
|
99
|
+
/** Serialize to 32 bytes (big-endian). */
|
|
100
|
+
toBytes() {
|
|
101
|
+
return new Uint8Array(this.bytes);
|
|
102
|
+
}
|
|
103
|
+
/** Encode as lowercase hex. */
|
|
104
|
+
toHex() {
|
|
105
|
+
return toHex(this.bytes);
|
|
106
|
+
}
|
|
107
|
+
/** Derive the corresponding public key. */
|
|
108
|
+
async publicKey() {
|
|
109
|
+
const pk = await secretKeyToPublicKey({
|
|
110
|
+
secretKey: this.bytes,
|
|
111
|
+
ciphersuite: CIPHERSUITE,
|
|
112
|
+
});
|
|
113
|
+
return BbsPublicKey.fromBytes(new Uint8Array(pk));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sign a vector of messages with optional context header. Matches
|
|
117
|
+
* `BbsSecretKey::sign(header, messages)` in the Rust crate.
|
|
118
|
+
*/
|
|
119
|
+
async sign(header, messages) {
|
|
120
|
+
if (messages.length < 1) {
|
|
121
|
+
throw new BbsError('at least one message is required');
|
|
122
|
+
}
|
|
123
|
+
if (messages.length > BBS_MAX_MESSAGE_COUNT) {
|
|
124
|
+
throw new BbsError(`message count ${messages.length} exceeds BBS_MAX_MESSAGE_COUNT (${BBS_MAX_MESSAGE_COUNT})`);
|
|
125
|
+
}
|
|
126
|
+
const pk = await secretKeyToPublicKey({
|
|
127
|
+
secretKey: this.bytes,
|
|
128
|
+
ciphersuite: CIPHERSUITE,
|
|
129
|
+
});
|
|
130
|
+
const sig = await bbsSign({
|
|
131
|
+
secretKey: this.bytes,
|
|
132
|
+
publicKey: pk,
|
|
133
|
+
header,
|
|
134
|
+
messages,
|
|
135
|
+
ciphersuite: CIPHERSUITE,
|
|
136
|
+
});
|
|
137
|
+
return BbsSignature.fromBytes(new Uint8Array(sig));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// ---------- BbsPublicKey ----------
|
|
141
|
+
export class BbsPublicKey {
|
|
142
|
+
bytes;
|
|
143
|
+
constructor(bytes) {
|
|
144
|
+
this.bytes = bytes;
|
|
145
|
+
assertLen('public key', bytes.length, BBS_PUBLIC_KEY_BYTES);
|
|
146
|
+
}
|
|
147
|
+
static fromBytes(bytes) {
|
|
148
|
+
return new BbsPublicKey(new Uint8Array(bytes));
|
|
149
|
+
}
|
|
150
|
+
static fromHex(hex) {
|
|
151
|
+
const bytes = fromHex(hex, 'public key');
|
|
152
|
+
assertLen('public key', bytes.length, BBS_PUBLIC_KEY_BYTES);
|
|
153
|
+
return new BbsPublicKey(bytes);
|
|
154
|
+
}
|
|
155
|
+
toBytes() {
|
|
156
|
+
return new Uint8Array(this.bytes);
|
|
157
|
+
}
|
|
158
|
+
toHex() {
|
|
159
|
+
return toHex(this.bytes);
|
|
160
|
+
}
|
|
161
|
+
equals(other) {
|
|
162
|
+
if (this.bytes.length !== other.bytes.length)
|
|
163
|
+
return false;
|
|
164
|
+
for (let i = 0; i < this.bytes.length; i++) {
|
|
165
|
+
if (this.bytes[i] !== other.bytes[i])
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// ---------- BbsSignature ----------
|
|
172
|
+
export class BbsSignature {
|
|
173
|
+
bytes;
|
|
174
|
+
constructor(bytes) {
|
|
175
|
+
this.bytes = bytes;
|
|
176
|
+
assertLen('signature', bytes.length, BBS_SIGNATURE_BYTES);
|
|
177
|
+
}
|
|
178
|
+
static fromBytes(bytes) {
|
|
179
|
+
return new BbsSignature(new Uint8Array(bytes));
|
|
180
|
+
}
|
|
181
|
+
static fromHex(hex) {
|
|
182
|
+
const bytes = fromHex(hex, 'signature');
|
|
183
|
+
assertLen('signature', bytes.length, BBS_SIGNATURE_BYTES);
|
|
184
|
+
return new BbsSignature(bytes);
|
|
185
|
+
}
|
|
186
|
+
toBytes() {
|
|
187
|
+
return new Uint8Array(this.bytes);
|
|
188
|
+
}
|
|
189
|
+
toHex() {
|
|
190
|
+
return toHex(this.bytes);
|
|
191
|
+
}
|
|
192
|
+
/** Verify this signature against a public key, header, and message vector. */
|
|
193
|
+
async verify(pk, header, messages) {
|
|
194
|
+
return bbsVerify({
|
|
195
|
+
publicKey: pk.toBytes(),
|
|
196
|
+
signature: this.bytes,
|
|
197
|
+
header,
|
|
198
|
+
messages,
|
|
199
|
+
ciphersuite: CIPHERSUITE,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Generate a selective-disclosure proof from this signature.
|
|
204
|
+
* `disclosedIndices` must be in strictly ascending order.
|
|
205
|
+
*/
|
|
206
|
+
async createProof(opts) {
|
|
207
|
+
for (let i = 1; i < opts.disclosedIndices.length; i++) {
|
|
208
|
+
if (opts.disclosedIndices[i - 1] >= opts.disclosedIndices[i]) {
|
|
209
|
+
throw new BbsError('disclosedIndices must be strictly ascending');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (opts.disclosedIndices.some((i) => i < 0 || i >= opts.messages.length)) {
|
|
213
|
+
throw new BbsError('disclosedIndices contains out-of-range value');
|
|
214
|
+
}
|
|
215
|
+
const proof = await bbsDeriveProof({
|
|
216
|
+
publicKey: opts.pk.toBytes(),
|
|
217
|
+
signature: this.bytes,
|
|
218
|
+
header: opts.header,
|
|
219
|
+
presentationHeader: opts.presentationHeader,
|
|
220
|
+
messages: opts.messages,
|
|
221
|
+
disclosedMessageIndexes: opts.disclosedIndices,
|
|
222
|
+
ciphersuite: CIPHERSUITE,
|
|
223
|
+
});
|
|
224
|
+
return BbsProof.fromBytes(new Uint8Array(proof));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// ---------- BbsProof ----------
|
|
228
|
+
export class BbsProof {
|
|
229
|
+
bytes;
|
|
230
|
+
constructor(bytes) {
|
|
231
|
+
this.bytes = bytes;
|
|
232
|
+
}
|
|
233
|
+
static fromBytes(bytes) {
|
|
234
|
+
return new BbsProof(new Uint8Array(bytes));
|
|
235
|
+
}
|
|
236
|
+
static fromHex(hex) {
|
|
237
|
+
return new BbsProof(fromHex(hex, 'proof'));
|
|
238
|
+
}
|
|
239
|
+
toBytes() {
|
|
240
|
+
return new Uint8Array(this.bytes);
|
|
241
|
+
}
|
|
242
|
+
toHex() {
|
|
243
|
+
return toHex(this.bytes);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Verify this proof against a public key, header, presentation header,
|
|
247
|
+
* disclosed messages, and the indices those messages occupied in the
|
|
248
|
+
* original signed vector.
|
|
249
|
+
*/
|
|
250
|
+
async verify(opts) {
|
|
251
|
+
if (opts.disclosedIndices.length !== opts.disclosedMessages.length) {
|
|
252
|
+
throw new BbsError('disclosedIndices and disclosedMessages length mismatch');
|
|
253
|
+
}
|
|
254
|
+
return bbsVerifyProof({
|
|
255
|
+
publicKey: opts.pk.toBytes(),
|
|
256
|
+
proof: this.bytes,
|
|
257
|
+
header: opts.header,
|
|
258
|
+
presentationHeader: opts.presentationHeader,
|
|
259
|
+
disclosedMessages: opts.disclosedMessages,
|
|
260
|
+
disclosedMessageIndexes: opts.disclosedIndices,
|
|
261
|
+
ciphersuite: CIPHERSUITE,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// ---------- convenience helpers ----------
|
|
266
|
+
/** Encode a UTF-8 string as raw bytes (for use as a message or header). */
|
|
267
|
+
export function utf8(s) {
|
|
268
|
+
return new TextEncoder().encode(s);
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,IAAI,IAAI,OAAO,EACf,eAAe,IAAI,SAAS,EAC5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iB,CAAC,MAAM,EAAE,CAAC;YACnE,MAAM,IAAI,QAAQ,CAAC,wDAAwD,CAAC,CAAA;QAC9E,CAAC;QACD,OAAO,cAAc,CAAC;YACpB,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE;YAC5B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,uBAAuB,EAAE,IAAI,CAAC,gBAAgB;YAC9C,WAAW,EAAE,WAAW;SACzB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,4CAA4C;AAE5C,2EAA2E;AAC3E,MAAM,UAAU,IAAI,CAAC,CAAS;IAC5B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AACpC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solidus-network/bbs",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "BBS+ selective-disclosure primitives for Solidus Network — IRTF draft-irtf-cfrg-bbs-signatures, BLS12-381 SHA-256. Byte-compatible with the Solidus chain (zkryptium-backed).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@digitalbazaar/bbs-signatures": "^3.0.0"
|
|
17
|
+
},
|
|
18
|
+
"keywords": ["solidus", "bbs", "bbs+", "selective-disclosure", "verifiable-credentials", "zero-knowledge", "bls12-381", "irtf"],
|
|
19
|
+
"author": "Solidus Network (https://solidus.network)",
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"homepage": "https://solidus.network",
|
|
22
|
+
"bugs": { "url": "https://github.com/solidusnetwork/sdk/issues" },
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/solidusnetwork/sdk.git",
|
|
26
|
+
"directory": "bbs"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": { "access": "public" }
|
|
29
|
+
}
|