@zanii/subprocessor 0.2.0 → 0.2.2

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.md CHANGED
@@ -36,3 +36,7 @@ breach. dpa/scc transfers with no agreement id are flagged too. Composes
36
36
  Proves the transfers that were **recorded**. It cannot prove an off-record leak — a
37
37
  processor that received plaintext and emitted nothing (that's the enclave/broker problem).
38
38
  An agreement id is a reference, not a guarantee the counterparty honored it.
39
+
40
+ ## Changelog
41
+
42
+ - **0.2.2** — Model-provider transfers with zero-retention flag, signed DPA versions, Art. 28(3) clause check, Art. 28(2) change notices and objections, fourth-party declarations, transfer impact assessments, AI Act roles, per-object breach propagation, trust-center feed, regulator export.
package/dist/dpa.d.ts ADDED
@@ -0,0 +1,176 @@
1
+ /**
2
+ * The onward-transfer chain in contracts and operations: model-provider calls as
3
+ * transfers, signed DPAs and change notices (Art. 28(2)), fourth-party declarations,
4
+ * transfer impact assessments, AI Act roles, breach propagation, Art. 28(3) clause checks,
5
+ * a trust-center feed and a regulator export. All read the same `Transfer` records.
6
+ */
7
+ import { type SignedObject } from '@zanii/core';
8
+ import { type Transfer } from './index.js';
9
+ /** Record a call to a model provider as a transfer, flagging zero data retention. */
10
+ export declare function modelProviderTransfer(input: {
11
+ from: string;
12
+ provider: string;
13
+ model: string;
14
+ zeroRetention: boolean;
15
+ dpaId?: string;
16
+ region?: string;
17
+ ref?: string;
18
+ ts: string;
19
+ }): {
20
+ target: string;
21
+ payload: Record<string, unknown>;
22
+ };
23
+ export type SignedDpa = SignedObject<{
24
+ v: 1;
25
+ type: 'subprocessor.dpa';
26
+ processor: string;
27
+ version: string;
28
+ effective: string;
29
+ clauses: string[];
30
+ document: string;
31
+ }>;
32
+ /** A DPA version, signed by the controller, naming the document by hash. */
33
+ export declare function signDpa(input: {
34
+ processor: string;
35
+ version: string;
36
+ effective: string;
37
+ clauses: string[];
38
+ documentHash: string;
39
+ }, privateKey: Uint8Array): SignedDpa;
40
+ /** The DPA in force for a processor at a time: the latest valid version effective by then. */
41
+ export declare function dpaInForce(dpas: SignedDpa[], processor: string, at: string, trustedSigners?: string[]): SignedDpa | null;
42
+ /** Art. 28(3) GDPR: what a processor contract must cover. */
43
+ export declare const ART28_CLAUSES: readonly ["documented-instructions", "confidentiality", "security-art32", "subprocessor-conditions", "data-subject-assistance", "controller-assistance-art32-36", "deletion-or-return", "audit-rights"];
44
+ export declare function contractualMinimums(clauses: string[], required?: readonly string[]): {
45
+ ok: boolean;
46
+ missing: string[];
47
+ };
48
+ export type ChangeNotice = SignedObject<{
49
+ v: 1;
50
+ type: 'subprocessor.change_notice';
51
+ subprocessor: string;
52
+ purpose: string;
53
+ region?: string;
54
+ effective: string;
55
+ ts: string;
56
+ }>;
57
+ export type Objection = SignedObject<{
58
+ v: 1;
59
+ type: 'subprocessor.objection';
60
+ notice: string;
61
+ reason: string;
62
+ ts: string;
63
+ }>;
64
+ /** The processor gives prior notice of a new subprocessor; it takes effect after `noticeDays`. */
65
+ export declare function changeNotice(input: {
66
+ subprocessor: string;
67
+ purpose: string;
68
+ region?: string;
69
+ noticeDays?: number;
70
+ ts?: string;
71
+ }, processorPrivateKey: Uint8Array): ChangeNotice;
72
+ /** A customer objects within the notice period. */
73
+ export declare function objectTo(notice: ChangeNotice, reason: string, customerPrivateKey: Uint8Array, ts?: string): Objection;
74
+ /** Where a change stands: in its notice period, objected to in time, or effective. */
75
+ export declare function changeStatus(notice: ChangeNotice, objections: Objection[], now?: string): {
76
+ status: "invalid";
77
+ objectors: string[];
78
+ } | {
79
+ status: "objected";
80
+ objectors: string[];
81
+ } | {
82
+ status: "notice-period" | "effective";
83
+ objectors: string[];
84
+ };
85
+ export type SubprocessorDeclaration = SignedObject<{
86
+ v: 1;
87
+ type: 'subprocessor.declaration';
88
+ subprocessors: string[];
89
+ ts: string;
90
+ }>;
91
+ /** A provider declares its own subprocessors, signed with its DID. */
92
+ export declare function declareSubprocessors(subprocessors: string[], providerPrivateKey: Uint8Array, ts?: string): SubprocessorDeclaration;
93
+ /** The supply chain from a root through signed declarations, with each party's depth. Parties without a declaration are leaves. */
94
+ export declare function supplyChain(root: string, declarations: SubprocessorDeclaration[], maxDepth?: number): {
95
+ parties: {
96
+ [k: string]: number;
97
+ };
98
+ edges: {
99
+ from: string;
100
+ to: string;
101
+ }[];
102
+ undeclaredBelow: string[];
103
+ };
104
+ export declare const SUPPLEMENTARY_MEASURES: readonly ["exporter-held-keys", "pseudonymisation", "split-processing", "transparency-reporting", "challenge-requests"];
105
+ /**
106
+ * A recorded transfer impact assessment (after Schrems II). Where public-authority access risk
107
+ * is high, a technical measure that keeps data unintelligible to the importer is needed to
108
+ * proceed. A structured record of the assessment, not legal advice.
109
+ */
110
+ export declare function transferImpactAssessment(input: {
111
+ destination: string;
112
+ mechanism: 'scc' | 'bcr' | 'adequacy' | 'derogation';
113
+ accessRisk: 'low' | 'medium' | 'high';
114
+ measures: string[];
115
+ assessedBy: string;
116
+ ts: string;
117
+ }): {
118
+ hash: string;
119
+ outcome: string;
120
+ destination: string;
121
+ mechanism: "scc" | "bcr" | "adequacy" | "derogation";
122
+ accessRisk: "low" | "medium" | "high";
123
+ measures: string[];
124
+ assessedBy: string;
125
+ ts: string;
126
+ v: number;
127
+ type: string;
128
+ };
129
+ export type AiActRole = 'provider' | 'deployer' | 'importer' | 'distributor' | 'authorised-representative';
130
+ /** Annotate each transfer edge with the parties' AI Act roles; edges with an unknown role are listed. */
131
+ export declare function aiActRoles(transfers: Transfer[], roles: Record<string, AiActRole>): {
132
+ edges: {
133
+ from: string;
134
+ to: string;
135
+ fromRole: AiActRole | null;
136
+ toRole: AiActRole | null;
137
+ }[];
138
+ unknown: string[];
139
+ };
140
+ /**
141
+ * After a breach at one party: which data objects had reached it, and through which senders.
142
+ * Traced per object (`ref`), so another object that merely shared an intermediary is not
143
+ * implicated; transfers without a ref are traced together as one group.
144
+ */
145
+ export declare function breachPropagation(transfers: Transfer[], breached: string): {
146
+ upstream: string[];
147
+ objects: string[];
148
+ };
149
+ /** A public subprocessor list from recorded transfers: first and last seen per declared party, plus declared-but-unused. */
150
+ export declare function trustCenterFeed(transfers: Transfer[], declared: Array<{
151
+ name: string;
152
+ purpose: string;
153
+ region?: string;
154
+ }>): {
155
+ subprocessors: {
156
+ inUse: boolean;
157
+ firstSeen: string | null;
158
+ lastSeen: string | null;
159
+ name: string;
160
+ purpose: string;
161
+ region?: string;
162
+ }[];
163
+ generatedFrom: number;
164
+ };
165
+ /** One export for a supervisor: nodes, edges, verdict and a hash over all of it. */
166
+ export declare function regulatorExport(transfers: Transfer[], declared: string[], controller: string): {
167
+ hash: string;
168
+ v: number;
169
+ type: string;
170
+ controller: string;
171
+ declared: string[];
172
+ graph: import("./index.js").SubprocessorGraph;
173
+ verdict: import("./index.js").TransferCheck;
174
+ transfers: string[];
175
+ };
176
+ //# sourceMappingURL=dpa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dpa.d.ts","sourceRoot":"","sources":["../src/dpa.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA2C,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAqD,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM9F,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;;;EAEhL;AAED,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;IAAE,CAAC,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,SAAS,EAAE,MA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AAY,CAAC;IAAC,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;;;iBAAzJ,MAAM;eAAa,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,YAAY;gBAAc,KAAK,GAAG,QAAQ,GAAG,MAAM;cAAY,MAAM,EAAE;gBAAc,MAAM;QAAM,MAAM;;;EAKrN;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,2BAA2B,CAAC;AAE3G,yGAAyG;AACzG,wBAAgB,UAAU,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;;;;;;;;EAGjF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM;;;EAkBxE;AAMD,4HAA4H;AAC5H,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;;;;;cAA3C,MAAM;iBAAW,MAAM;iBAAW,MAAM;;;EAUtH;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM;;;;;;;;;EAK5F"}
package/dist/dpa.js ADDED
@@ -0,0 +1,147 @@
1
+ /**
2
+ * The onward-transfer chain in contracts and operations: model-provider calls as
3
+ * transfers, signed DPAs and change notices (Art. 28(2)), fourth-party declarations,
4
+ * transfer impact assessments, AI Act roles, breach propagation, Art. 28(3) clause checks,
5
+ * a trust-center feed and a regulator export. All read the same `Transfer` records.
6
+ */
7
+ import { jcsHash, signObject, verifySignedObject } from '@zanii/core';
8
+ import { buildTransfer, subprocessorGraph, verifyTransfers } from './index.js';
9
+ // ------------------------------------------------------------------------------ //
10
+ // Transfers and agreements
11
+ // ------------------------------------------------------------------------------ //
12
+ /** Record a call to a model provider as a transfer, flagging zero data retention. */
13
+ export function modelProviderTransfer(input) {
14
+ return buildTransfer({ from: input.from, to: input.provider, agreement: input.zeroRetention ? { type: 'zero-retention', id: input.dpaId } : { type: 'dpa', id: input.dpaId }, ts: input.ts, junction: `model:${input.model}`, ...(input.region ? { region: input.region } : {}), ...(input.ref ? { ref: input.ref } : {}) });
15
+ }
16
+ /** A DPA version, signed by the controller, naming the document by hash. */
17
+ export function signDpa(input, privateKey) {
18
+ return signObject({ v: 1, type: 'subprocessor.dpa', processor: input.processor, version: input.version, effective: input.effective, clauses: input.clauses, document: input.documentHash }, privateKey);
19
+ }
20
+ /** The DPA in force for a processor at a time: the latest valid version effective by then. */
21
+ export function dpaInForce(dpas, processor, at, trustedSigners) {
22
+ return dpas.filter((d) => d.processor === processor && d.effective <= at && verifySignedObject(d) && (!trustedSigners || trustedSigners.includes(d.signer))).sort((a, b) => a.effective.localeCompare(b.effective)).at(-1) ?? null;
23
+ }
24
+ /** Art. 28(3) GDPR: what a processor contract must cover. */
25
+ export const ART28_CLAUSES = ['documented-instructions', 'confidentiality', 'security-art32', 'subprocessor-conditions', 'data-subject-assistance', 'controller-assistance-art32-36', 'deletion-or-return', 'audit-rights'];
26
+ export function contractualMinimums(clauses, required = ART28_CLAUSES) {
27
+ const missing = required.filter((c) => !clauses.includes(c));
28
+ return { ok: missing.length === 0, missing };
29
+ }
30
+ /** The processor gives prior notice of a new subprocessor; it takes effect after `noticeDays`. */
31
+ export function changeNotice(input, processorPrivateKey) {
32
+ const ts = input.ts ?? new Date().toISOString();
33
+ return signObject({ v: 1, type: 'subprocessor.change_notice', subprocessor: input.subprocessor, purpose: input.purpose, ...(input.region ? { region: input.region } : {}), effective: new Date(Date.parse(ts) + (input.noticeDays ?? 30) * 86_400_000).toISOString(), ts }, processorPrivateKey);
34
+ }
35
+ /** A customer objects within the notice period. */
36
+ export function objectTo(notice, reason, customerPrivateKey, ts = new Date().toISOString()) {
37
+ return signObject({ v: 1, type: 'subprocessor.objection', notice: jcsHash(notice), reason, ts }, customerPrivateKey);
38
+ }
39
+ /** Where a change stands: in its notice period, objected to in time, or effective. */
40
+ export function changeStatus(notice, objections, now = new Date().toISOString()) {
41
+ if (!verifySignedObject(notice))
42
+ return { status: 'invalid', objectors: [] };
43
+ const timely = objections.filter((o) => o.notice === jcsHash(notice) && o.ts < notice.effective && verifySignedObject(o));
44
+ const objectors = [...new Set(timely.map((o) => o.signer))];
45
+ if (objectors.length)
46
+ return { status: 'objected', objectors };
47
+ return { status: now < notice.effective ? 'notice-period' : 'effective', objectors };
48
+ }
49
+ /** A provider declares its own subprocessors, signed with its DID. */
50
+ export function declareSubprocessors(subprocessors, providerPrivateKey, ts = new Date().toISOString()) {
51
+ return signObject({ v: 1, type: 'subprocessor.declaration', subprocessors: [...subprocessors].sort(), ts }, providerPrivateKey);
52
+ }
53
+ /** The supply chain from a root through signed declarations, with each party's depth. Parties without a declaration are leaves. */
54
+ export function supplyChain(root, declarations, maxDepth = 6) {
55
+ const latest = new Map();
56
+ for (const d of declarations.filter(verifySignedObject))
57
+ if (!latest.has(d.signer) || latest.get(d.signer).ts < d.ts)
58
+ latest.set(d.signer, d);
59
+ const depth = new Map([[root, 0]]);
60
+ const edges = [];
61
+ const queue = [root];
62
+ while (queue.length) {
63
+ const p = queue.shift();
64
+ const d = depth.get(p);
65
+ if (d >= maxDepth)
66
+ continue;
67
+ for (const s of latest.get(p)?.subprocessors ?? []) {
68
+ edges.push({ from: p, to: s });
69
+ if (!depth.has(s)) {
70
+ depth.set(s, d + 1);
71
+ queue.push(s);
72
+ }
73
+ }
74
+ }
75
+ return { parties: Object.fromEntries(depth), edges, undeclaredBelow: [...depth.keys()].filter((p) => p !== root && !latest.has(p)) };
76
+ }
77
+ export const SUPPLEMENTARY_MEASURES = ['exporter-held-keys', 'pseudonymisation', 'split-processing', 'transparency-reporting', 'challenge-requests'];
78
+ /**
79
+ * A recorded transfer impact assessment (after Schrems II). Where public-authority access risk
80
+ * is high, a technical measure that keeps data unintelligible to the importer is needed to
81
+ * proceed. A structured record of the assessment, not legal advice.
82
+ */
83
+ export function transferImpactAssessment(input) {
84
+ const technical = input.measures.some((m) => m === 'exporter-held-keys' || m === 'pseudonymisation' || m === 'split-processing');
85
+ const outcome = input.mechanism === 'adequacy' || input.accessRisk === 'low' ? 'proceed' : input.accessRisk === 'medium' ? (input.measures.length ? 'proceed-with-measures' : 'review') : technical ? 'proceed-with-measures' : 'suspend';
86
+ const record = { v: 1, type: 'subprocessor.tia', ...input, outcome };
87
+ return { ...record, hash: jcsHash(record) };
88
+ }
89
+ /** Annotate each transfer edge with the parties' AI Act roles; edges with an unknown role are listed. */
90
+ export function aiActRoles(transfers, roles) {
91
+ const edges = transfers.map((t) => ({ from: t.from, to: t.to, fromRole: roles[t.from] ?? null, toRole: roles[t.to] ?? null }));
92
+ return { edges, unknown: [...new Set(edges.flatMap((e) => [...(e.fromRole ? [] : [e.from]), ...(e.toRole ? [] : [e.to])]))].sort() };
93
+ }
94
+ /**
95
+ * After a breach at one party: which data objects had reached it, and through which senders.
96
+ * Traced per object (`ref`), so another object that merely shared an intermediary is not
97
+ * implicated; transfers without a ref are traced together as one group.
98
+ */
99
+ export function breachPropagation(transfers, breached) {
100
+ const groups = new Map();
101
+ for (const t of transfers)
102
+ groups.set(t.ref ?? '', [...(groups.get(t.ref ?? '') ?? []), t]);
103
+ const upstream = new Set();
104
+ const objects = new Set();
105
+ for (const [ref, ts] of groups) {
106
+ const reached = new Set([breached]);
107
+ let grew = true;
108
+ while (grew) {
109
+ grew = false;
110
+ for (const t of ts)
111
+ if (reached.has(t.to) && !reached.has(t.from)) {
112
+ reached.add(t.from);
113
+ grew = true;
114
+ }
115
+ }
116
+ reached.delete(breached);
117
+ if (reached.size === 0)
118
+ continue;
119
+ reached.forEach((p) => upstream.add(p));
120
+ if (ref)
121
+ objects.add(ref);
122
+ }
123
+ return { upstream: [...upstream].sort(), objects: [...objects].sort() };
124
+ }
125
+ // ------------------------------------------------------------------------------ //
126
+ // Publishing
127
+ // ------------------------------------------------------------------------------ //
128
+ /** A public subprocessor list from recorded transfers: first and last seen per declared party, plus declared-but-unused. */
129
+ export function trustCenterFeed(transfers, declared) {
130
+ const seen = new Map();
131
+ for (const t of transfers) {
132
+ const s = seen.get(t.to);
133
+ seen.set(t.to, s ? { first: s.first < t.ts ? s.first : t.ts, last: s.last > t.ts ? s.last : t.ts, count: s.count + 1 } : { first: t.ts, last: t.ts, count: 1 });
134
+ }
135
+ return {
136
+ subprocessors: declared.map((d) => ({ ...d, inUse: seen.has(d.name), firstSeen: seen.get(d.name)?.first ?? null, lastSeen: seen.get(d.name)?.last ?? null })),
137
+ generatedFrom: transfers.length,
138
+ };
139
+ }
140
+ /** One export for a supervisor: nodes, edges, verdict and a hash over all of it. */
141
+ export function regulatorExport(transfers, declared, controller) {
142
+ const graph = subprocessorGraph(transfers, declared, { controller });
143
+ const verdict = verifyTransfers(transfers, declared, { controller });
144
+ const body = { v: 1, type: 'subprocessor.regulator_export', controller, declared: [...declared].sort(), graph, verdict, transfers: transfers.map((t) => jcsHash(t)) };
145
+ return { ...body, hash: jcsHash(body) };
146
+ }
147
+ //# sourceMappingURL=dpa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dpa.js","sourceRoot":"","sources":["../src/dpa.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAiB,MAAM,YAAY,CAAC;AAE9F,oFAAoF;AACpF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E,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QAC7J,aAAa,EAAE,SAAS,CAAC,MAAM;KAChC,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,SAAqB,EAAE,QAAkB,EAAE,UAAkB;IAC3F,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACrE,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAU,CAAC,CAAC,EAAE,CAAC;IAC/K,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -84,4 +84,5 @@ export interface TransferCheck {
84
84
  export declare function verifyTransfers(transfers: Transfer[], declared: string[], opts?: {
85
85
  controller?: string;
86
86
  }): TransferCheck;
87
+ export * from './dpa.js';
87
88
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/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CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAWD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CA6B9H;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAOxH;AACD,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -124,4 +124,5 @@ export function verifyTransfers(transfers, declared, opts) {
124
124
  reasons.push(`transfer to '${m.to}' at ${m.ts} has no agreement id (dpa/scc requires one)`);
125
125
  return { ok: reasons.length === 0, reasons };
126
126
  }
127
+ export * from './dpa.js';
127
128
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAoCtC,MAAM,UAAU,GAAG,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAE7D,6FAA6F;AAC7F,MAAM,OAAO,GAAG,CAAC,EAAW,EAAW,EAAE,CACvC,OAAO,EAAE,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,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CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,EAAE;QAClC,oBAAoB,EAAE,OAAO;QAC7B,SAAS;KACV,CAAC;AACJ,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,SAAqB,EAAE,QAAkB,EAAE,IAA8B;IACvG,MAAM,CAAC,GAAG,iBAAiB,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9E,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU;QAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,yCAAyC,CAAC,CAAC;IACxG,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,oBAAoB;QAAE,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,6CAA6C,CAAC,CAAC;IACpI,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;AAC/C,CAAC;AACD,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zanii/subprocessor",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Prove the onward-transfer chain - which downstream processors actually saw the data, under which agreement (zero-retention, DPA id), tied to the junction/settlement. Answers the exact GDPR Art. 28 question every AI DPA raises: 'you sent my data to OpenAI, who sent it where?' A transfer to a party not in the declared subprocessor list is a provable, flagged violation. Proves recorded transfers; an off-record leak needs an attested enclave.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://ledger.zanii.agency",
@@ -31,7 +31,7 @@
31
31
  "vitest": "^3.0.9"
32
32
  },
33
33
  "dependencies": {
34
- "@zanii/core": "0.4.0"
34
+ "@zanii/core": "^0.5.4"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsc -p tsconfig.build.json",
package/src/dpa.ts ADDED
@@ -0,0 +1,166 @@
1
+ /**
2
+ * The onward-transfer chain in contracts and operations: model-provider calls as
3
+ * transfers, signed DPAs and change notices (Art. 28(2)), fourth-party declarations,
4
+ * transfer impact assessments, AI Act roles, breach propagation, Art. 28(3) clause checks,
5
+ * a trust-center feed and a regulator export. All read the same `Transfer` records.
6
+ */
7
+ import { jcsHash, signObject, verifySignedObject, type SignedObject } from '@zanii/core';
8
+ import { buildTransfer, subprocessorGraph, verifyTransfers, type Transfer } from './index.js';
9
+
10
+ // ------------------------------------------------------------------------------ //
11
+ // Transfers and agreements
12
+ // ------------------------------------------------------------------------------ //
13
+
14
+ /** Record a call to a model provider as a transfer, flagging zero data retention. */
15
+ export function modelProviderTransfer(input: { from: string; provider: string; model: string; zeroRetention: boolean; dpaId?: string; region?: string; ref?: string; ts: string }) {
16
+ return buildTransfer({ from: input.from, to: input.provider, agreement: input.zeroRetention ? { type: 'zero-retention', id: input.dpaId } : { type: 'dpa', id: input.dpaId }, ts: input.ts, junction: `model:${input.model}`, ...(input.region ? { region: input.region } : {}), ...(input.ref ? { ref: input.ref } : {}) });
17
+ }
18
+
19
+ export type SignedDpa = SignedObject<{ v: 1; type: 'subprocessor.dpa'; processor: string; version: string; effective: string; clauses: string[]; document: string }>;
20
+
21
+ /** A DPA version, signed by the controller, naming the document by hash. */
22
+ export function signDpa(input: { processor: string; version: string; effective: string; clauses: string[]; documentHash: string }, privateKey: Uint8Array): SignedDpa {
23
+ return signObject({ v: 1 as const, type: 'subprocessor.dpa' as const, processor: input.processor, version: input.version, effective: input.effective, clauses: input.clauses, document: input.documentHash }, privateKey);
24
+ }
25
+
26
+ /** The DPA in force for a processor at a time: the latest valid version effective by then. */
27
+ export function dpaInForce(dpas: SignedDpa[], processor: string, at: string, trustedSigners?: string[]): SignedDpa | null {
28
+ return dpas.filter((d) => d.processor === processor && d.effective <= at && verifySignedObject(d) && (!trustedSigners || trustedSigners.includes(d.signer))).sort((a, b) => a.effective.localeCompare(b.effective)).at(-1) ?? null;
29
+ }
30
+
31
+ /** Art. 28(3) GDPR: what a processor contract must cover. */
32
+ export const ART28_CLAUSES = ['documented-instructions', 'confidentiality', 'security-art32', 'subprocessor-conditions', 'data-subject-assistance', 'controller-assistance-art32-36', 'deletion-or-return', 'audit-rights'] as const;
33
+
34
+ export function contractualMinimums(clauses: string[], required: readonly string[] = ART28_CLAUSES) {
35
+ const missing = required.filter((c) => !clauses.includes(c));
36
+ return { ok: missing.length === 0, missing };
37
+ }
38
+
39
+ // ------------------------------------------------------------------------------ //
40
+ // Change notices and objections (Art. 28(2))
41
+ // ------------------------------------------------------------------------------ //
42
+
43
+ export type ChangeNotice = SignedObject<{ v: 1; type: 'subprocessor.change_notice'; subprocessor: string; purpose: string; region?: string; effective: string; ts: string }>;
44
+ export type Objection = SignedObject<{ v: 1; type: 'subprocessor.objection'; notice: string; reason: string; ts: string }>;
45
+
46
+ /** The processor gives prior notice of a new subprocessor; it takes effect after `noticeDays`. */
47
+ export function changeNotice(input: { subprocessor: string; purpose: string; region?: string; noticeDays?: number; ts?: string }, processorPrivateKey: Uint8Array): ChangeNotice {
48
+ const ts = input.ts ?? new Date().toISOString();
49
+ return signObject({ v: 1 as const, type: 'subprocessor.change_notice' as const, subprocessor: input.subprocessor, purpose: input.purpose, ...(input.region ? { region: input.region } : {}), effective: new Date(Date.parse(ts) + (input.noticeDays ?? 30) * 86_400_000).toISOString(), ts }, processorPrivateKey);
50
+ }
51
+
52
+ /** A customer objects within the notice period. */
53
+ export function objectTo(notice: ChangeNotice, reason: string, customerPrivateKey: Uint8Array, ts = new Date().toISOString()): Objection {
54
+ return signObject({ v: 1 as const, type: 'subprocessor.objection' as const, notice: jcsHash(notice), reason, ts }, customerPrivateKey);
55
+ }
56
+
57
+ /** Where a change stands: in its notice period, objected to in time, or effective. */
58
+ export function changeStatus(notice: ChangeNotice, objections: Objection[], now = new Date().toISOString()) {
59
+ if (!verifySignedObject(notice)) return { status: 'invalid' as const, objectors: [] as string[] };
60
+ const timely = objections.filter((o) => o.notice === jcsHash(notice) && o.ts < notice.effective && verifySignedObject(o));
61
+ const objectors = [...new Set(timely.map((o) => o.signer))];
62
+ if (objectors.length) return { status: 'objected' as const, objectors };
63
+ return { status: now < notice.effective ? ('notice-period' as const) : ('effective' as const), objectors };
64
+ }
65
+
66
+ // ------------------------------------------------------------------------------ //
67
+ // Fourth parties, assessments, roles
68
+ // ------------------------------------------------------------------------------ //
69
+
70
+ export type SubprocessorDeclaration = SignedObject<{ v: 1; type: 'subprocessor.declaration'; subprocessors: string[]; ts: string }>;
71
+
72
+ /** A provider declares its own subprocessors, signed with its DID. */
73
+ export function declareSubprocessors(subprocessors: string[], providerPrivateKey: Uint8Array, ts = new Date().toISOString()): SubprocessorDeclaration {
74
+ return signObject({ v: 1 as const, type: 'subprocessor.declaration' as const, subprocessors: [...subprocessors].sort(), ts }, providerPrivateKey);
75
+ }
76
+
77
+ /** The supply chain from a root through signed declarations, with each party's depth. Parties without a declaration are leaves. */
78
+ export function supplyChain(root: string, declarations: SubprocessorDeclaration[], maxDepth = 6) {
79
+ const latest = new Map<string, SubprocessorDeclaration>();
80
+ for (const d of declarations.filter(verifySignedObject)) if (!latest.has(d.signer) || latest.get(d.signer)!.ts < d.ts) latest.set(d.signer, d);
81
+ const depth = new Map<string, number>([[root, 0]]);
82
+ const edges: Array<{ from: string; to: string }> = [];
83
+ const queue = [root];
84
+ while (queue.length) {
85
+ const p = queue.shift()!;
86
+ const d = depth.get(p)!;
87
+ if (d >= maxDepth) continue;
88
+ for (const s of latest.get(p)?.subprocessors ?? []) {
89
+ edges.push({ from: p, to: s });
90
+ if (!depth.has(s)) { depth.set(s, d + 1); queue.push(s); }
91
+ }
92
+ }
93
+ return { parties: Object.fromEntries(depth), edges, undeclaredBelow: [...depth.keys()].filter((p) => p !== root && !latest.has(p)) };
94
+ }
95
+
96
+ export const SUPPLEMENTARY_MEASURES = ['exporter-held-keys', 'pseudonymisation', 'split-processing', 'transparency-reporting', 'challenge-requests'] as const;
97
+
98
+ /**
99
+ * A recorded transfer impact assessment (after Schrems II). Where public-authority access risk
100
+ * is high, a technical measure that keeps data unintelligible to the importer is needed to
101
+ * proceed. A structured record of the assessment, not legal advice.
102
+ */
103
+ export function transferImpactAssessment(input: { destination: string; mechanism: 'scc' | 'bcr' | 'adequacy' | 'derogation'; accessRisk: 'low' | 'medium' | 'high'; measures: string[]; assessedBy: string; ts: string }) {
104
+ const technical = input.measures.some((m) => m === 'exporter-held-keys' || m === 'pseudonymisation' || m === 'split-processing');
105
+ const outcome = input.mechanism === 'adequacy' || input.accessRisk === 'low' ? 'proceed' : input.accessRisk === 'medium' ? (input.measures.length ? 'proceed-with-measures' : 'review') : technical ? 'proceed-with-measures' : 'suspend';
106
+ const record = { v: 1, type: 'subprocessor.tia', ...input, outcome };
107
+ return { ...record, hash: jcsHash(record) };
108
+ }
109
+
110
+ export type AiActRole = 'provider' | 'deployer' | 'importer' | 'distributor' | 'authorised-representative';
111
+
112
+ /** Annotate each transfer edge with the parties' AI Act roles; edges with an unknown role are listed. */
113
+ export function aiActRoles(transfers: Transfer[], roles: Record<string, AiActRole>) {
114
+ const edges = transfers.map((t) => ({ from: t.from, to: t.to, fromRole: roles[t.from] ?? null, toRole: roles[t.to] ?? null }));
115
+ return { edges, unknown: [...new Set(edges.flatMap((e) => [...(e.fromRole ? [] : [e.from]), ...(e.toRole ? [] : [e.to])]))].sort() };
116
+ }
117
+
118
+ /**
119
+ * After a breach at one party: which data objects had reached it, and through which senders.
120
+ * Traced per object (`ref`), so another object that merely shared an intermediary is not
121
+ * implicated; transfers without a ref are traced together as one group.
122
+ */
123
+ export function breachPropagation(transfers: Transfer[], breached: string) {
124
+ const groups = new Map<string, Transfer[]>();
125
+ for (const t of transfers) groups.set(t.ref ?? '', [...(groups.get(t.ref ?? '') ?? []), t]);
126
+ const upstream = new Set<string>();
127
+ const objects = new Set<string>();
128
+ for (const [ref, ts] of groups) {
129
+ const reached = new Set([breached]);
130
+ let grew = true;
131
+ while (grew) {
132
+ grew = false;
133
+ for (const t of ts) if (reached.has(t.to) && !reached.has(t.from)) { reached.add(t.from); grew = true; }
134
+ }
135
+ reached.delete(breached);
136
+ if (reached.size === 0) continue;
137
+ reached.forEach((p) => upstream.add(p));
138
+ if (ref) objects.add(ref);
139
+ }
140
+ return { upstream: [...upstream].sort(), objects: [...objects].sort() };
141
+ }
142
+
143
+ // ------------------------------------------------------------------------------ //
144
+ // Publishing
145
+ // ------------------------------------------------------------------------------ //
146
+
147
+ /** A public subprocessor list from recorded transfers: first and last seen per declared party, plus declared-but-unused. */
148
+ export function trustCenterFeed(transfers: Transfer[], declared: Array<{ name: string; purpose: string; region?: string }>) {
149
+ const seen = new Map<string, { first: string; last: string; count: number }>();
150
+ for (const t of transfers) {
151
+ const s = seen.get(t.to);
152
+ seen.set(t.to, s ? { first: s.first < t.ts ? s.first : t.ts, last: s.last > t.ts ? s.last : t.ts, count: s.count + 1 } : { first: t.ts, last: t.ts, count: 1 });
153
+ }
154
+ return {
155
+ subprocessors: declared.map((d) => ({ ...d, inUse: seen.has(d.name), firstSeen: seen.get(d.name)?.first ?? null, lastSeen: seen.get(d.name)?.last ?? null })),
156
+ generatedFrom: transfers.length,
157
+ };
158
+ }
159
+
160
+ /** One export for a supervisor: nodes, edges, verdict and a hash over all of it. */
161
+ export function regulatorExport(transfers: Transfer[], declared: string[], controller: string) {
162
+ const graph = subprocessorGraph(transfers, declared, { controller });
163
+ const verdict = verifyTransfers(transfers, declared, { controller });
164
+ const body = { v: 1, type: 'subprocessor.regulator_export', controller, declared: [...declared].sort(), graph, verdict, transfers: transfers.map((t) => jcsHash(t as never)) };
165
+ return { ...body, hash: jcsHash(body) };
166
+ }
package/src/index.ts CHANGED
@@ -167,3 +167,4 @@ export function verifyTransfers(transfers: Transfer[], declared: string[], opts?
167
167
  for (const m of g.missing_agreement_id) reasons.push(`transfer to '${m.to}' at ${m.ts} has no agreement id (dpa/scc requires one)`);
168
168
  return { ok: reasons.length === 0, reasons };
169
169
  }
170
+ export * from './dpa.js';