@zanii/ai-register 0.0.0-stage → 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 +159 -0
- package/README.md +72 -2
- package/dist/index.d.ts +223 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +438 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -3
- package/src/index.ts +501 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
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 Derivative
|
|
95
|
+
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; and
|
|
103
|
+
|
|
104
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
105
|
+
distribution, then any Derivative Works that You distribute must
|
|
106
|
+
include a readable copy of the attribution notices contained
|
|
107
|
+
within such NOTICE file.
|
|
108
|
+
|
|
109
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
110
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
111
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
112
|
+
this License, without any additional terms or conditions.
|
|
113
|
+
|
|
114
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
115
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
116
|
+
except as required for reasonable and customary use in describing the
|
|
117
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
118
|
+
|
|
119
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
120
|
+
to in writing, Licensor provides the Work (and each Contributor
|
|
121
|
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
|
|
122
|
+
OR CONDITIONS OF ANY KIND, either express or implied, including,
|
|
123
|
+
without limitation, any warranties or conditions of TITLE,
|
|
124
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
|
125
|
+
|
|
126
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
127
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
128
|
+
unless required by applicable law (such as deliberate and grossly
|
|
129
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
130
|
+
liable to You for damages, including any direct, indirect, special,
|
|
131
|
+
incidental, or consequential damages of any character arising as a
|
|
132
|
+
result of this License or out of the use or inability to use the
|
|
133
|
+
Work.
|
|
134
|
+
|
|
135
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
136
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
137
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
138
|
+
or other liability obligations and/or rights consistent with this
|
|
139
|
+
License. However, in accepting such obligations, You may act only
|
|
140
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
141
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
142
|
+
defend, and hold each Contributor harmless for any liability
|
|
143
|
+
incurred by, or claims asserted against, such Contributor.
|
|
144
|
+
|
|
145
|
+
END OF TERMS AND CONDITIONS
|
|
146
|
+
|
|
147
|
+
Copyright 2026 Zanii
|
|
148
|
+
|
|
149
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
150
|
+
you may not use this file except in compliance with the License.
|
|
151
|
+
You may obtain a copy of the License at
|
|
152
|
+
|
|
153
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
154
|
+
|
|
155
|
+
Unless required by applicable law or agreed to in writing, software
|
|
156
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
157
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
158
|
+
See the License for the specific language governing permissions and
|
|
159
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zanii/ai-register
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**A regulator's register of AI systems, built from Ledger and Certify records and exported in the shapes public registers already use.**
|
|
4
|
+
|
|
5
|
+
One entry per AI system: its agent DIDs, the owner DID, a `zanii.jurisdiction` binding, an optional Zanii Certify certificate, an optional `@zanii/kyb` owner attestation and the descriptive fields the operator supplies (intended purpose, status, FRIA and DPIA summaries). Each export is a versioned field map. Every field either carries a value with its source, or is `null` with the reason the inputs do not support it. Nothing is guessed.
|
|
6
|
+
|
|
7
|
+
- **`buildEntry(input, { asOf, verifyBinding? })`**: one entry. It refuses a binding that does not verify or is about another subject, a certificate held by another agent or whose credential does not match its hash, and a KYB attestation that does not verify or is not signed by the owner. By default the binding is checked as a `@zanii/core` signed object; pass `verifyBinding` to pin which regulators you trust.
|
|
8
|
+
- **`exportEuAiAct(entry, 'A' | 'B' | 'C')`, `exportAtrs(entry)`, `exportEurocities(entry)`, `exportEntry(entry, format)`**: field maps.
|
|
9
|
+
- **`buildRegister({ regulator, jurisdiction, asOf, entries }, key)` / `verifyRegister(snapshot, { signers })`**: the signed `zanii.ai_register` snapshot (entries sorted by `system`, each with its evidence hashes).
|
|
10
|
+
- **`toCsv(exports)`, `toJson(x)`, `toRecord(export)`**: RFC 4180 CSV (one row per field), canonical JSON (the same bytes in Python), and a `{ id: value }` object (for the Eurocities format, the registration JSON).
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { buildEntry, exportEuAiAct, buildRegister, verifyRegister, toCsv } from '@zanii/ai-register';
|
|
14
|
+
|
|
15
|
+
const entry = buildEntry({
|
|
16
|
+
id: 'examplebank-cs',
|
|
17
|
+
agents: [agentDid],
|
|
18
|
+
owner: ownerDid,
|
|
19
|
+
jurisdiction: binding, // { v: 1, type: 'zanii.jurisdiction', subject, regulator, ... , signer, sig }
|
|
20
|
+
certificate: certificateView, // Certify GET /v1/certificates/{hash}, or { hash, ... }
|
|
21
|
+
kyb: ownerAttestation, // @zanii/kyb buildOwnerAttestation
|
|
22
|
+
ownerRole: 'deployer', // which party the KYB entity is in the exports
|
|
23
|
+
describe: { name: 'Customer service agent', intended_purpose: 'Retail account questions', status: 'operational', fria_summary: '...' },
|
|
24
|
+
overrides: { 'uk-atrs': { '2.2.2': 'Shorter queues' } },
|
|
25
|
+
}, { asOf: '2026-10-29T00:00:00Z' });
|
|
26
|
+
|
|
27
|
+
const annexC = exportEuAiAct(entry, 'C');
|
|
28
|
+
// annexC.fields: [{ id: 'C.1.name', value: 'Example Bank PJSC', source: 'kyb' },
|
|
29
|
+
// { id: 'C.3', value: null, reason: 'not supplied: describe.eu_database_url' }, ...]
|
|
30
|
+
|
|
31
|
+
const snapshot = buildRegister({ regulator: 'DFSA', jurisdiction: 'AE-DIFC', asOf: '2026-10-29T00:00:00Z', entries: [entry] }, operatorKey);
|
|
32
|
+
verifyRegister(snapshot, { signers: [operatorDid] }); // { ok: true, reasons: [] }
|
|
33
|
+
const csv = toCsv([annexC]);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Field maps
|
|
37
|
+
|
|
38
|
+
Sources: `describe.<key>` (caller-supplied), `kyb` (the KYB entity name, only when `ownerRole` names that party), `agents` (the agent DIDs), `certificate` (a one-line Certify summary: profile, level, scheme, status and reason, production evidence, certificate hash), `override` (`overrides[format][id]`), `const`. A field with no Zanii source is `null` with `not supported by Zanii inputs: supply overrides[...]`.
|
|
39
|
+
|
|
40
|
+
| Format | Fields | Zanii-sourced | Source of the field list |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| `eu-ai-act-annex-viii-a` (Art. 49(1), providers of high-risk systems) | 15 | 14 (A.9 needs an override) | Regulation (EU) 2024/1689 Annex VIII Section A, [artificialintelligenceact.eu/annex/8](https://artificialintelligenceact.eu/annex/8/) |
|
|
43
|
+
| `eu-ai-act-annex-viii-b` (Art. 49(2), Art. 6(3) not-high-risk) | 11 | 11 | Annex VIII Section B |
|
|
44
|
+
| `eu-ai-act-annex-viii-c` (Art. 49(3), deployers) | 7 | 7 | Annex VIII Section C |
|
|
45
|
+
| `uk-atrs` | 56 | 21 | ATRS template 4.0 (`ATRS_V4.0__FINAL.xlsx`), [gov.uk ATRS hub](https://www.gov.uk/government/collections/algorithmic-transparency-recording-standard-hub) |
|
|
46
|
+
| `eurocities-ats` | 49 | 21 | Algorithmic Transparency Standard 0.3.1 JSON schema, [algoritmeregister.org](https://www.algoritmeregister.org/standard/schemas/registration-v0.3.1.schema.json) |
|
|
47
|
+
|
|
48
|
+
Key mappings:
|
|
49
|
+
|
|
50
|
+
| Field | Source |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Annex VIII A.1 / B.1 provider name | `describe.provider_name`, else KYB with `ownerRole` `provider` or `both` |
|
|
53
|
+
| Annex VIII C.1 deployer name, ATRS 0.2 / 2.1.1, Eurocities `organization` | `describe.deployer_name`, else KYB with `ownerRole` `deployer` or `both` |
|
|
54
|
+
| A.4 / B.4 trade name and unambiguous reference | `describe.name` plus the agent DIDs |
|
|
55
|
+
| A.8 notified body certificate | `describe.notified_body_certificate` only. A Zanii Certify certificate is not a notified-body certificate (Art. 44) |
|
|
56
|
+
| C.4 FRIA summary, Eurocities `AIA_description` | `describe.fria_summary` |
|
|
57
|
+
| C.5 DPIA summary, Eurocities `DPIA_description` | `describe.dpia_summary` |
|
|
58
|
+
| ATRS 2.4.2.7 model performance, Eurocities `performance` | the Certify certificate summary (labelled: an assessment of the deployed configuration, not model metrics) |
|
|
59
|
+
| ATRS 2.5.1 impact assessments | `describe.fria_summary` and `describe.dpia_summary` |
|
|
60
|
+
| Eurocities `standard_version` | `0.3.1` |
|
|
61
|
+
|
|
62
|
+
**Guidance, not law.** The Annex VIII lists follow the consolidated text at artificialintelligenceact.eu. The EU database (Art. 71) format and some items are still subject to Commission implementing acts, and the Digital Omnibus amendments, whose timing is not final, mark B.7 and B.9 as not present after the amendment; both are kept with a `note`. The ATRS and Eurocities enum fields are passed through unchecked. A field map, not legal advice.
|
|
63
|
+
|
|
64
|
+
**Honest limits:** the register states what the inputs say. A KYB attestation proves the owner key signed the entity claim; check the two-way domain binding with `@zanii/kyb` `verifyOwnerBinding` before relying on it. A jurisdiction binding with `basis: "self_declared"` is the operator's claim, not a licence.
|
|
65
|
+
|
|
66
|
+
## Changelog
|
|
67
|
+
|
|
68
|
+
- **0.2.0**: `buildRegisterAsync(r, signer)` takes a raw key or a remote signer (HSM, KMS); snapshots are byte-identical to `buildRegister`. Requires `@zanii/core` 0.5.7. Additive.
|
|
69
|
+
- **0.1.0**: initial release. Entries, EU AI Act Annex VIII A/B/C, UK ATRS 4.0 and Eurocities 0.3.1 field maps, signed `zanii.ai_register` snapshots, CSV and JSON helpers. Python twin `zanii.ai_register`, checked by shared vectors.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zanii/ai-register: a regulator's register of AI systems, built from Ledger and Certify
|
|
3
|
+
* records, exported in the shapes public registers already use.
|
|
4
|
+
*
|
|
5
|
+
* One entry per AI system: its agent DIDs, the owner DID, a `zanii.jurisdiction` binding,
|
|
6
|
+
* an optional Zanii Certify certificate (the public `CertificateView` or the credential),
|
|
7
|
+
* an optional `@zanii/kyb` owner attestation and caller-supplied descriptive fields.
|
|
8
|
+
* Every export is a versioned field map in which each field either carries a value and its
|
|
9
|
+
* source or is null with the reason the inputs do not support it. Nothing is guessed.
|
|
10
|
+
*
|
|
11
|
+
* Exports:
|
|
12
|
+
* - EU AI Act Art. 49 / Annex VIII sections A, B and C (guidance: the EU database format
|
|
13
|
+
* is still subject to Commission implementing acts and to the Digital Omnibus changes),
|
|
14
|
+
* - UK Algorithmic Transparency Recording Standard (ATRS) template 4.0,
|
|
15
|
+
* - Algorithmic Transparency Standard 0.3.1 (Eurocities; Amsterdam, Helsinki registers).
|
|
16
|
+
*
|
|
17
|
+
* The native `zanii.ai_register` snapshot is signed by the regulator or the operator.
|
|
18
|
+
*/
|
|
19
|
+
import { type RemoteSigner, type SignedObject } from '@zanii/core';
|
|
20
|
+
import { type OwnerAttestation } from '@zanii/kyb';
|
|
21
|
+
/** The shared `zanii.jurisdiction` binding format (`@zanii/jurisdiction`); accepted as a plain object. */
|
|
22
|
+
export interface JurisdictionBinding {
|
|
23
|
+
v: 1;
|
|
24
|
+
type: 'zanii.jurisdiction';
|
|
25
|
+
subject: string;
|
|
26
|
+
regulator: string;
|
|
27
|
+
jurisdiction: string;
|
|
28
|
+
sector: string;
|
|
29
|
+
licence: string;
|
|
30
|
+
issued_at: string;
|
|
31
|
+
expires_at: string;
|
|
32
|
+
basis: 'self_declared' | 'regulator_attested';
|
|
33
|
+
signer: string;
|
|
34
|
+
sig: string;
|
|
35
|
+
}
|
|
36
|
+
/** Certify `GET /v1/certificates/{hash}` (`CertificateView`), or any subset with `hash`. */
|
|
37
|
+
export interface CertificateInput {
|
|
38
|
+
hash: string;
|
|
39
|
+
certificate?: {
|
|
40
|
+
holder?: string;
|
|
41
|
+
issuer?: string;
|
|
42
|
+
issuer_domain?: string;
|
|
43
|
+
claim?: {
|
|
44
|
+
scheme?: string;
|
|
45
|
+
profile?: string;
|
|
46
|
+
level?: number;
|
|
47
|
+
};
|
|
48
|
+
issued_at?: string;
|
|
49
|
+
exp?: string;
|
|
50
|
+
[k: string]: unknown;
|
|
51
|
+
};
|
|
52
|
+
status?: {
|
|
53
|
+
status?: string;
|
|
54
|
+
reason?: string | null;
|
|
55
|
+
since?: string;
|
|
56
|
+
};
|
|
57
|
+
agent?: {
|
|
58
|
+
did?: string;
|
|
59
|
+
};
|
|
60
|
+
profile?: string;
|
|
61
|
+
level?: number;
|
|
62
|
+
issued_at?: string;
|
|
63
|
+
exp?: string;
|
|
64
|
+
evidence?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare const DESCRIBE_KEYS: readonly ["name", "summary", "description", "intended_purpose", "status", "data_and_logic", "provider_name", "provider_address", "provider_contact", "submitter", "authorised_representative", "deployer_name", "deployer_address", "deployer_contact", "contact_email", "team", "senior_responsible_owner", "region", "member_states", "eu_database_url", "declaration_of_conformity_url", "instructions_url", "more_info_url", "notified_body_certificate", "not_high_risk_condition", "not_high_risk_grounds", "fria_summary", "fria_url", "dpia_summary", "dpia_url", "human_review", "appeals", "risks", "model", "lang"];
|
|
67
|
+
export type DescribeKey = (typeof DESCRIBE_KEYS)[number];
|
|
68
|
+
export type FieldValue = string | string[];
|
|
69
|
+
export type Describe = Partial<Record<DescribeKey, FieldValue>>;
|
|
70
|
+
export declare const FORMATS: readonly ["eu-ai-act-annex-viii-a", "eu-ai-act-annex-viii-b", "eu-ai-act-annex-viii-c", "uk-atrs", "eurocities-ats"];
|
|
71
|
+
export type Format = (typeof FORMATS)[number];
|
|
72
|
+
export interface SystemInput {
|
|
73
|
+
/** Register id of the system; defaults to the first agent DID (sorted). */
|
|
74
|
+
id?: string;
|
|
75
|
+
agents: string[];
|
|
76
|
+
owner: string;
|
|
77
|
+
jurisdiction?: JurisdictionBinding;
|
|
78
|
+
certificate?: CertificateInput;
|
|
79
|
+
/** A `@zanii/kyb` owner attestation by `owner`. */
|
|
80
|
+
kyb?: OwnerAttestation;
|
|
81
|
+
/** Which party the KYB entity is in the export: without it the KYB name fills no field. */
|
|
82
|
+
ownerRole?: 'provider' | 'deployer' | 'both';
|
|
83
|
+
describe?: Describe;
|
|
84
|
+
/** Per-format values by field id, for fields with no Zanii source: `{ 'uk-atrs': { '2.2.2': '...' } }`. */
|
|
85
|
+
overrides?: Partial<Record<Format, Record<string, FieldValue>>>;
|
|
86
|
+
}
|
|
87
|
+
export interface RegisterEntry {
|
|
88
|
+
system: string;
|
|
89
|
+
agents: string[];
|
|
90
|
+
owner: string;
|
|
91
|
+
jurisdiction: null | {
|
|
92
|
+
hash: string;
|
|
93
|
+
subject: string;
|
|
94
|
+
regulator: string;
|
|
95
|
+
jurisdiction: string;
|
|
96
|
+
sector: string;
|
|
97
|
+
licence: string;
|
|
98
|
+
basis: string;
|
|
99
|
+
issued_at: string;
|
|
100
|
+
expires_at: string;
|
|
101
|
+
current: boolean;
|
|
102
|
+
};
|
|
103
|
+
certificate: null | {
|
|
104
|
+
hash: string;
|
|
105
|
+
holder: string | null;
|
|
106
|
+
issuer: string | null;
|
|
107
|
+
issuer_domain: string | null;
|
|
108
|
+
scheme: string | null;
|
|
109
|
+
profile: string | null;
|
|
110
|
+
level: number | null;
|
|
111
|
+
status: string | null;
|
|
112
|
+
reason: string | null;
|
|
113
|
+
since: string | null;
|
|
114
|
+
evidence: string | null;
|
|
115
|
+
exp: string | null;
|
|
116
|
+
};
|
|
117
|
+
kyb: null | {
|
|
118
|
+
hash: string;
|
|
119
|
+
did: string;
|
|
120
|
+
domain: string;
|
|
121
|
+
entity: {
|
|
122
|
+
name: string;
|
|
123
|
+
jurisdiction: string | null;
|
|
124
|
+
registration: string | null;
|
|
125
|
+
};
|
|
126
|
+
role: string | null;
|
|
127
|
+
};
|
|
128
|
+
describe: Describe;
|
|
129
|
+
overrides: Partial<Record<Format, Record<string, FieldValue>>>;
|
|
130
|
+
evidence: string[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* One register entry. Refuses (throws) a binding that does not verify or is about another
|
|
134
|
+
* subject, a certificate for another agent or whose credential does not match its hash, and a
|
|
135
|
+
* KYB attestation that does not verify or is not by the owner. `verifyBinding` replaces the
|
|
136
|
+
* default check (the binding's own `signer` signature) when the caller trusts specific regulators.
|
|
137
|
+
*/
|
|
138
|
+
export declare function buildEntry(input: SystemInput, opts: {
|
|
139
|
+
asOf: string;
|
|
140
|
+
verifyBinding?: (b: JurisdictionBinding) => boolean;
|
|
141
|
+
}): RegisterEntry;
|
|
142
|
+
/** `jcsHash` of an entry. */
|
|
143
|
+
export declare function entryHash(entry: RegisterEntry): string;
|
|
144
|
+
/**
|
|
145
|
+
* A source is `d:<describe key>`, `kyb:provider`, `kyb:deployer` (the KYB entity name when
|
|
146
|
+
* `ownerRole` says so), `name+agents`, `certify`, `assessments` or `const:<value>`.
|
|
147
|
+
* No sources = not supported by Zanii inputs (supply an override).
|
|
148
|
+
*/
|
|
149
|
+
type FieldDef = [id: string, name: string, sources: string[], note?: string];
|
|
150
|
+
interface FieldMap {
|
|
151
|
+
format: Format;
|
|
152
|
+
format_version: string;
|
|
153
|
+
source_url: string;
|
|
154
|
+
guidance: string;
|
|
155
|
+
fields: FieldDef[];
|
|
156
|
+
}
|
|
157
|
+
export declare const FIELD_MAPS: Record<Format, FieldMap>;
|
|
158
|
+
export type ExportField = {
|
|
159
|
+
id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
value: FieldValue;
|
|
162
|
+
source: string;
|
|
163
|
+
note?: string;
|
|
164
|
+
} | {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
value: null;
|
|
168
|
+
reason: string;
|
|
169
|
+
note?: string;
|
|
170
|
+
};
|
|
171
|
+
export interface RegisterExport {
|
|
172
|
+
v: 1;
|
|
173
|
+
type: 'zanii.ai_register.export';
|
|
174
|
+
format: Format;
|
|
175
|
+
format_version: string;
|
|
176
|
+
source_url: string;
|
|
177
|
+
guidance: string;
|
|
178
|
+
system: string;
|
|
179
|
+
entry: string;
|
|
180
|
+
fields: ExportField[];
|
|
181
|
+
}
|
|
182
|
+
/** One export of an entry: a versioned field map, each field a value with its source or null with a reason. */
|
|
183
|
+
export declare function exportEntry(entry: RegisterEntry, format: Format): RegisterExport;
|
|
184
|
+
export declare const exportEuAiAct: (entry: RegisterEntry, section: "A" | "B" | "C") => RegisterExport;
|
|
185
|
+
export declare const exportAtrs: (entry: RegisterEntry) => RegisterExport;
|
|
186
|
+
export declare const exportEurocities: (entry: RegisterEntry) => RegisterExport;
|
|
187
|
+
/** `{ field id: value or null }`: for the Eurocities format this is the registration JSON object. */
|
|
188
|
+
export declare function toRecord(x: RegisterExport): Record<string, FieldValue | null>;
|
|
189
|
+
/** RFC 4180 CSV, one row per field: system, format, id, name, value, source, reason. */
|
|
190
|
+
export declare function toCsv(exports: RegisterExport[]): string;
|
|
191
|
+
/** Canonical JSON (RFC 8785): the same bytes in TypeScript and Python. */
|
|
192
|
+
export declare function toJson(x: unknown): string;
|
|
193
|
+
export type RegisterSnapshot = SignedObject<{
|
|
194
|
+
v: 1;
|
|
195
|
+
type: 'zanii.ai_register';
|
|
196
|
+
regulator: string;
|
|
197
|
+
jurisdiction: string;
|
|
198
|
+
as_of: string;
|
|
199
|
+
entries: RegisterEntry[];
|
|
200
|
+
}>;
|
|
201
|
+
/** Sign a snapshot of the register as the regulator or operator. Entries are sorted by `system`. */
|
|
202
|
+
export declare function buildRegister(r: {
|
|
203
|
+
regulator: string;
|
|
204
|
+
jurisdiction: string;
|
|
205
|
+
asOf: string;
|
|
206
|
+
entries: RegisterEntry[];
|
|
207
|
+
}, signerKey: Uint8Array): RegisterSnapshot;
|
|
208
|
+
/** Signature by an allowed signer, entries sorted and distinct, evidence lists consistent, bindings for this jurisdiction. */
|
|
209
|
+
export declare function verifyRegister(s: RegisterSnapshot, opts: {
|
|
210
|
+
signers: string[];
|
|
211
|
+
}): {
|
|
212
|
+
ok: boolean;
|
|
213
|
+
reasons: string[];
|
|
214
|
+
};
|
|
215
|
+
/** `buildRegister` with a raw key or a remote signer (HSM, KMS); all the same checks run. */
|
|
216
|
+
export declare function buildRegisterAsync(r: {
|
|
217
|
+
regulator: string;
|
|
218
|
+
jurisdiction: string;
|
|
219
|
+
asOf: string;
|
|
220
|
+
entries: RegisterEntry[];
|
|
221
|
+
}, signer: Uint8Array | RemoteSigner): Promise<RegisterSnapshot>;
|
|
222
|
+
export {};
|
|
223
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAA4E,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7I,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAM3E,0GAA0G;AAC1G,MAAM,WAAW,mBAAmB;IAClC,CAAC,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAC3G,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;CACpI;AAED,4FAA4F;AAC5F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,M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