signet-protocol 0.1.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.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/dist/anomaly.d.ts +42 -0
  4. package/dist/anomaly.d.ts.map +1 -0
  5. package/dist/anomaly.js +209 -0
  6. package/dist/anomaly.js.map +1 -0
  7. package/dist/badge.d.ts +56 -0
  8. package/dist/badge.d.ts.map +1 -0
  9. package/dist/badge.js +171 -0
  10. package/dist/badge.js.map +1 -0
  11. package/dist/bonds.d.ts +39 -0
  12. package/dist/bonds.d.ts.map +1 -0
  13. package/dist/bonds.js +149 -0
  14. package/dist/bonds.js.map +1 -0
  15. package/dist/challenges.d.ts +18 -0
  16. package/dist/challenges.d.ts.map +1 -0
  17. package/dist/challenges.js +145 -0
  18. package/dist/challenges.js.map +1 -0
  19. package/dist/cold-call.d.ts +74 -0
  20. package/dist/cold-call.d.ts.map +1 -0
  21. package/dist/cold-call.js +176 -0
  22. package/dist/cold-call.js.map +1 -0
  23. package/dist/compliance.d.ts +82 -0
  24. package/dist/compliance.d.ts.map +1 -0
  25. package/dist/compliance.js +478 -0
  26. package/dist/compliance.js.map +1 -0
  27. package/dist/connections.d.ts +63 -0
  28. package/dist/connections.d.ts.map +1 -0
  29. package/dist/connections.js +170 -0
  30. package/dist/connections.js.map +1 -0
  31. package/dist/constants.d.ts +86 -0
  32. package/dist/constants.d.ts.map +1 -0
  33. package/dist/constants.js +124 -0
  34. package/dist/constants.js.map +1 -0
  35. package/dist/credentials.d.ts +190 -0
  36. package/dist/credentials.d.ts.map +1 -0
  37. package/dist/credentials.js +686 -0
  38. package/dist/credentials.js.map +1 -0
  39. package/dist/crypto.d.ts +27 -0
  40. package/dist/crypto.d.ts.map +1 -0
  41. package/dist/crypto.js +75 -0
  42. package/dist/crypto.js.map +1 -0
  43. package/dist/errors.d.ts +17 -0
  44. package/dist/errors.d.ts.map +1 -0
  45. package/dist/errors.js +29 -0
  46. package/dist/errors.js.map +1 -0
  47. package/dist/i18n.d.ts +98 -0
  48. package/dist/i18n.d.ts.map +1 -0
  49. package/dist/i18n.js +1118 -0
  50. package/dist/i18n.js.map +1 -0
  51. package/dist/identity-bridge.d.ts +52 -0
  52. package/dist/identity-bridge.d.ts.map +1 -0
  53. package/dist/identity-bridge.js +228 -0
  54. package/dist/identity-bridge.js.map +1 -0
  55. package/dist/identity-tree.d.ts +47 -0
  56. package/dist/identity-tree.d.ts.map +1 -0
  57. package/dist/identity-tree.js +69 -0
  58. package/dist/identity-tree.js.map +1 -0
  59. package/dist/index.d.ts +55 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +86 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/key-derivation.d.ts +43 -0
  64. package/dist/key-derivation.d.ts.map +1 -0
  65. package/dist/key-derivation.js +212 -0
  66. package/dist/key-derivation.js.map +1 -0
  67. package/dist/lsag.d.ts +23 -0
  68. package/dist/lsag.d.ts.map +1 -0
  69. package/dist/lsag.js +35 -0
  70. package/dist/lsag.js.map +1 -0
  71. package/dist/merkle.d.ts +19 -0
  72. package/dist/merkle.d.ts.map +1 -0
  73. package/dist/merkle.js +155 -0
  74. package/dist/merkle.js.map +1 -0
  75. package/dist/policies.d.ts +22 -0
  76. package/dist/policies.d.ts.map +1 -0
  77. package/dist/policies.js +123 -0
  78. package/dist/policies.js.map +1 -0
  79. package/dist/range-proof.d.ts +6 -0
  80. package/dist/range-proof.d.ts.map +1 -0
  81. package/dist/range-proof.js +45 -0
  82. package/dist/range-proof.js.map +1 -0
  83. package/dist/relay.d.ts +106 -0
  84. package/dist/relay.d.ts.map +1 -0
  85. package/dist/relay.js +336 -0
  86. package/dist/relay.js.map +1 -0
  87. package/dist/ring-signature.d.ts +35 -0
  88. package/dist/ring-signature.d.ts.map +1 -0
  89. package/dist/ring-signature.js +56 -0
  90. package/dist/ring-signature.js.map +1 -0
  91. package/dist/shamir.d.ts +55 -0
  92. package/dist/shamir.d.ts.map +1 -0
  93. package/dist/shamir.js +253 -0
  94. package/dist/shamir.js.map +1 -0
  95. package/dist/signet-words.d.ts +42 -0
  96. package/dist/signet-words.d.ts.map +1 -0
  97. package/dist/signet-words.js +82 -0
  98. package/dist/signet-words.js.map +1 -0
  99. package/dist/store.d.ts +65 -0
  100. package/dist/store.d.ts.map +1 -0
  101. package/dist/store.js +290 -0
  102. package/dist/store.js.map +1 -0
  103. package/dist/trust-score.d.ts +9 -0
  104. package/dist/trust-score.d.ts.map +1 -0
  105. package/dist/trust-score.js +186 -0
  106. package/dist/trust-score.js.map +1 -0
  107. package/dist/types.d.ts +358 -0
  108. package/dist/types.d.ts.map +1 -0
  109. package/dist/types.js +15 -0
  110. package/dist/types.js.map +1 -0
  111. package/dist/utils.d.ts +11 -0
  112. package/dist/utils.d.ts.map +1 -0
  113. package/dist/utils.js +21 -0
  114. package/dist/utils.js.map +1 -0
  115. package/dist/validation.d.ts +33 -0
  116. package/dist/validation.d.ts.map +1 -0
  117. package/dist/validation.js +312 -0
  118. package/dist/validation.js.map +1 -0
  119. package/dist/verifiers.d.ts +18 -0
  120. package/dist/verifiers.d.ts.map +1 -0
  121. package/dist/verifiers.js +118 -0
  122. package/dist/verifiers.js.map +1 -0
  123. package/dist/vouches.d.ts +14 -0
  124. package/dist/vouches.d.ts.map +1 -0
  125. package/dist/vouches.js +103 -0
  126. package/dist/vouches.js.map +1 -0
  127. package/package.json +76 -0
  128. package/src/anomaly.ts +307 -0
  129. package/src/badge.ts +208 -0
  130. package/src/bonds.ts +203 -0
  131. package/src/challenges.ts +187 -0
  132. package/src/cold-call.ts +238 -0
  133. package/src/compliance.ts +612 -0
  134. package/src/connections.ts +216 -0
  135. package/src/constants.ts +146 -0
  136. package/src/credentials.ts +908 -0
  137. package/src/crypto.ts +85 -0
  138. package/src/errors.ts +31 -0
  139. package/src/i18n.ts +1347 -0
  140. package/src/identity-bridge.ts +262 -0
  141. package/src/identity-tree.ts +90 -0
  142. package/src/index.ts +452 -0
  143. package/src/lsag.ts +53 -0
  144. package/src/merkle.ts +176 -0
  145. package/src/policies.ts +154 -0
  146. package/src/range-proof.ts +66 -0
  147. package/src/relay.ts +433 -0
  148. package/src/ring-signature.ts +76 -0
  149. package/src/signet-words.ts +122 -0
  150. package/src/store.ts +336 -0
  151. package/src/trust-score.ts +208 -0
  152. package/src/types.ts +482 -0
  153. package/src/utils.ts +20 -0
  154. package/src/validation.ts +391 -0
  155. package/src/verifiers.ts +156 -0
  156. package/src/vouches.ts +141 -0
@@ -0,0 +1,82 @@
1
+ import type { NostrEvent } from './types.js';
2
+ export type ComplianceSeverity = 'error' | 'warning' | 'info';
3
+ export interface ComplianceIssue {
4
+ code: string;
5
+ severity: ComplianceSeverity;
6
+ jurisdiction: string;
7
+ message: string;
8
+ regulation: string;
9
+ remediation?: string;
10
+ }
11
+ export interface ComplianceResult {
12
+ compliant: boolean;
13
+ issues: ComplianceIssue[];
14
+ jurisdiction: string;
15
+ checkedAt: number;
16
+ }
17
+ export interface CrossBorderResult {
18
+ allowed: boolean;
19
+ mechanism?: string;
20
+ issues: ComplianceIssue[];
21
+ fromJurisdiction: string;
22
+ toJurisdiction: string;
23
+ }
24
+ export interface ChildComplianceResult {
25
+ compliant: boolean;
26
+ issues: ComplianceIssue[];
27
+ jurisdiction: string;
28
+ minConsentAge: number;
29
+ ageOfMajority: number;
30
+ requiresParentalConsent: boolean;
31
+ }
32
+ export interface ConsentRequirement {
33
+ jurisdiction: string;
34
+ requiresExplicitConsent: boolean;
35
+ consentAge: number;
36
+ parentalConsentRequired: boolean;
37
+ dataCategories: string[];
38
+ specialCategories: string[];
39
+ notes?: string;
40
+ }
41
+ /**
42
+ * Check if a credential complies with a jurisdiction's regulations.
43
+ */
44
+ export declare function checkCredentialCompliance(credential: NostrEvent, jurisdictionCode: string): ComplianceResult;
45
+ /**
46
+ * Check if a credential can be used across borders.
47
+ */
48
+ export declare function checkCrossBorderCompliance(fromJurisdiction: string, toJurisdiction: string): CrossBorderResult;
49
+ /**
50
+ * Check child data protection compliance for a jurisdiction.
51
+ */
52
+ export declare function checkChildCompliance(childAge: number, jurisdictionCode: string): ChildComplianceResult;
53
+ /**
54
+ * Get consent requirements for a jurisdiction.
55
+ */
56
+ export declare function getConsentRequirements(jurisdictionCode: string): ConsentRequirement;
57
+ /**
58
+ * Get data retention guidance for a jurisdiction.
59
+ */
60
+ export declare function getRetentionGuidance(jurisdictionCode: string): {
61
+ maxDays: number;
62
+ guidance: string;
63
+ regulation: string;
64
+ };
65
+ /**
66
+ * Check compliance across multiple jurisdictions simultaneously.
67
+ * Useful for credentials that may be used internationally.
68
+ */
69
+ export declare function checkMultiJurisdictionCompliance(credential: NostrEvent, jurisdictions: string[]): Map<string, ComplianceResult>;
70
+ /**
71
+ * Find the most restrictive requirements across jurisdictions.
72
+ * Useful for setting defaults that satisfy all target jurisdictions.
73
+ */
74
+ export declare function getMostRestrictiveRequirements(jurisdictions: string[]): {
75
+ highestConsentAge: number;
76
+ highestAgeOfMajority: number;
77
+ requiresExplicitConsent: boolean;
78
+ shortestBreachNotification: number;
79
+ allRequireErasure: boolean;
80
+ jurisdictions: string[];
81
+ };
82
+ //# sourceMappingURL=compliance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance.d.ts","sourceRoot":"","sources":["../src/compliance.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;I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;GAEG;AACH,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,GAAG;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAgCA;AAID;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,MAAM,EAAE,GACtB,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAM/B;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG;IACvE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,OAAO,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CA4BA"}
@@ -0,0 +1,478 @@
1
+ // Signet Compliance Module
2
+ // Jurisdiction-aware compliance checking for credentials, data transfers,
3
+ // child protection, and professional regulation.
4
+ import { getJurisdiction, canTransferData, isProfessionRegulated, } from 'jurisdiction-kit';
5
+ import { getTagValue } from './validation.js';
6
+ import { SignetValidationError } from './errors.js';
7
+ const GDPR_JURISDICTIONS = ['GB', 'FR', 'DE', 'ES', 'IT', 'NL', 'IE'];
8
+ // --- Credential Compliance ---
9
+ /**
10
+ * Check if a credential complies with a jurisdiction's regulations.
11
+ */
12
+ export function checkCredentialCompliance(credential, jurisdictionCode) {
13
+ const issues = [];
14
+ const j = getJurisdiction(jurisdictionCode);
15
+ if (!j) {
16
+ return {
17
+ compliant: false,
18
+ issues: [{
19
+ code: 'UNKNOWN_JURISDICTION',
20
+ severity: 'error',
21
+ jurisdiction: jurisdictionCode,
22
+ message: `Jurisdiction '${jurisdictionCode}' is not recognised in the Signet registry.`,
23
+ regulation: 'Signet Protocol',
24
+ }],
25
+ jurisdiction: jurisdictionCode,
26
+ checkedAt: Math.floor(Date.now() / 1000),
27
+ };
28
+ }
29
+ // Check profession regulation
30
+ const profession = getTagValue(credential, 'profession');
31
+ if (profession) {
32
+ const profType = mapProfessionString(profession);
33
+ if (profType && !isProfessionRegulated(jurisdictionCode, profType)) {
34
+ issues.push({
35
+ code: 'PROFESSION_NOT_REGULATED',
36
+ severity: 'warning',
37
+ jurisdiction: jurisdictionCode,
38
+ message: `Profession '${profession}' is not registered as regulated in ${j.name}.`,
39
+ regulation: 'Professional Regulation',
40
+ remediation: 'Verify the profession is regulated in this jurisdiction before issuing credentials.',
41
+ });
42
+ }
43
+ }
44
+ // Check credential expiry
45
+ const expiresStr = getTagValue(credential, 'expiration');
46
+ if (expiresStr) {
47
+ const expires = parseInt(expiresStr, 10);
48
+ const now = Math.floor(Date.now() / 1000);
49
+ if (isNaN(expires) || expires < now) {
50
+ issues.push({
51
+ code: 'CREDENTIAL_EXPIRED',
52
+ severity: 'error',
53
+ jurisdiction: jurisdictionCode,
54
+ message: 'Credential has expired.',
55
+ regulation: 'Credential Validity',
56
+ remediation: 'Renew the credential before use.',
57
+ });
58
+ }
59
+ }
60
+ // Check electronic signature recognition
61
+ if (!j.eSignatureRecognised) {
62
+ issues.push({
63
+ code: 'ESIGNATURE_NOT_RECOGNISED',
64
+ severity: 'warning',
65
+ jurisdiction: jurisdictionCode,
66
+ message: `Electronic signatures may not be fully recognised in ${j.name}.`,
67
+ regulation: 'Electronic Signatures',
68
+ remediation: 'Additional attestation or wet signature may be required.',
69
+ });
70
+ }
71
+ // Check scope for child-related credentials
72
+ const scope = getTagValue(credential, 'scope');
73
+ if (scope === 'adult+child') {
74
+ const childIssues = checkChildDataRequirements(credential, j);
75
+ issues.push(...childIssues);
76
+ }
77
+ // Check data protection consent requirements
78
+ if (j.dataProtection.requiresExplicitConsent) {
79
+ issues.push({
80
+ code: 'CONSENT_REQUIRED',
81
+ severity: 'info',
82
+ jurisdiction: jurisdictionCode,
83
+ message: `${j.dataProtection.name} requires explicit consent for processing personal data.`,
84
+ regulation: j.dataProtection.fullName,
85
+ remediation: 'Ensure explicit consent is obtained and recorded before credential issuance.',
86
+ });
87
+ }
88
+ // Check breach notification requirements
89
+ if (j.dataProtection.breachNotificationHours > 0) {
90
+ issues.push({
91
+ code: 'BREACH_NOTIFICATION',
92
+ severity: 'info',
93
+ jurisdiction: jurisdictionCode,
94
+ message: `Data breaches must be reported to ${j.dataProtection.supervisoryAuthority} within ${j.dataProtection.breachNotificationHours} hours.`,
95
+ regulation: j.dataProtection.fullName,
96
+ });
97
+ }
98
+ return {
99
+ compliant: !issues.some((i) => i.severity === 'error'),
100
+ issues,
101
+ jurisdiction: jurisdictionCode,
102
+ checkedAt: Math.floor(Date.now() / 1000),
103
+ };
104
+ }
105
+ // --- Cross-Border Compliance ---
106
+ /**
107
+ * Check if a credential can be used across borders.
108
+ */
109
+ export function checkCrossBorderCompliance(fromJurisdiction, toJurisdiction) {
110
+ const issues = [];
111
+ const transfer = canTransferData(fromJurisdiction, toJurisdiction);
112
+ const fromJ = getJurisdiction(fromJurisdiction);
113
+ const toJ = getJurisdiction(toJurisdiction);
114
+ if (!fromJ || !toJ) {
115
+ return {
116
+ allowed: false,
117
+ issues: [{
118
+ code: 'UNKNOWN_JURISDICTION',
119
+ severity: 'error',
120
+ jurisdiction: fromJurisdiction,
121
+ message: 'One or both jurisdictions are not recognised.',
122
+ regulation: 'Signet Protocol',
123
+ }],
124
+ fromJurisdiction,
125
+ toJurisdiction,
126
+ };
127
+ }
128
+ if (transfer.mechanism === 'safeguards-required') {
129
+ issues.push({
130
+ code: 'SAFEGUARDS_REQUIRED',
131
+ severity: 'warning',
132
+ jurisdiction: fromJurisdiction,
133
+ message: `Transfer from ${fromJ.name} to ${toJ.name} requires Standard Contractual Clauses or equivalent safeguards.`,
134
+ regulation: fromJ.dataProtection.fullName,
135
+ remediation: 'Implement SCCs, BCRs, or obtain an adequacy determination.',
136
+ });
137
+ }
138
+ // Special cases
139
+ if (fromJurisdiction === 'CN') {
140
+ issues.push({
141
+ code: 'CN_DATA_LOCALIZATION',
142
+ severity: 'warning',
143
+ jurisdiction: 'CN',
144
+ message: 'China\'s PIPL requires data localization. Cross-border transfers require security assessment by CAC.',
145
+ regulation: 'Personal Information Protection Law (PIPL)',
146
+ remediation: 'Complete a data export security assessment or obtain PPC certification.',
147
+ });
148
+ }
149
+ if (fromJurisdiction === 'IN') {
150
+ issues.push({
151
+ code: 'IN_DATA_LOCALIZATION',
152
+ severity: 'info',
153
+ jurisdiction: 'IN',
154
+ message: 'India\'s DPDPA 2023 may restrict transfers to certain jurisdictions via government notification.',
155
+ regulation: 'Digital Personal Data Protection Act 2023',
156
+ remediation: 'Check the list of restricted jurisdictions published by the Indian government.',
157
+ });
158
+ }
159
+ if (fromJurisdiction === 'SA') {
160
+ issues.push({
161
+ code: 'SA_CROSS_BORDER',
162
+ severity: 'warning',
163
+ jurisdiction: 'SA',
164
+ message: 'Saudi Arabia requires data to remain within the Kingdom unless specific conditions are met.',
165
+ regulation: 'Personal Data Protection Law (Royal Decree M/19)',
166
+ remediation: 'Ensure the transfer meets SDAIA cross-border transfer requirements.',
167
+ });
168
+ }
169
+ return {
170
+ allowed: transfer.allowed,
171
+ mechanism: transfer.mechanism,
172
+ issues,
173
+ fromJurisdiction,
174
+ toJurisdiction,
175
+ };
176
+ }
177
+ // --- Child Protection Compliance ---
178
+ /**
179
+ * Check child data protection compliance for a jurisdiction.
180
+ */
181
+ export function checkChildCompliance(childAge, jurisdictionCode) {
182
+ if (!Number.isFinite(childAge) || childAge < 0 || childAge > 150) {
183
+ throw new SignetValidationError(`Invalid childAge: ${childAge} (must be 0-150)`);
184
+ }
185
+ const issues = [];
186
+ const j = getJurisdiction(jurisdictionCode);
187
+ if (!j) {
188
+ return {
189
+ compliant: false,
190
+ issues: [{
191
+ code: 'UNKNOWN_JURISDICTION',
192
+ severity: 'error',
193
+ jurisdiction: jurisdictionCode,
194
+ message: `Jurisdiction '${jurisdictionCode}' is not recognised.`,
195
+ regulation: 'Signet Protocol',
196
+ }],
197
+ jurisdiction: jurisdictionCode,
198
+ minConsentAge: 16,
199
+ ageOfMajority: 18,
200
+ requiresParentalConsent: true,
201
+ };
202
+ }
203
+ const consentAge = j.childProtection.minAgeDigitalConsent;
204
+ const majority = j.childProtection.ageOfMajority;
205
+ const needsParental = childAge < consentAge;
206
+ if (needsParental) {
207
+ issues.push({
208
+ code: 'PARENTAL_CONSENT_REQUIRED',
209
+ severity: 'error',
210
+ jurisdiction: jurisdictionCode,
211
+ message: `Child age ${childAge} is below the digital consent age of ${consentAge} in ${j.name}. Verifiable parental consent is required.`,
212
+ regulation: j.childProtection.name,
213
+ remediation: 'Obtain and record verifiable parental consent before processing child data.',
214
+ });
215
+ }
216
+ if (j.childProtection.enhancedProtections) {
217
+ issues.push({
218
+ code: 'ENHANCED_CHILD_PROTECTIONS',
219
+ severity: 'info',
220
+ jurisdiction: jurisdictionCode,
221
+ message: `${j.name} requires enhanced protections for children's data under ${j.childProtection.name}.`,
222
+ regulation: j.childProtection.name,
223
+ remediation: 'Apply data minimisation, purpose limitation, and enhanced security for child data.',
224
+ });
225
+ }
226
+ if (j.childProtection.profilingRestrictions) {
227
+ issues.push({
228
+ code: 'PROFILING_RESTRICTED',
229
+ severity: 'warning',
230
+ jurisdiction: jurisdictionCode,
231
+ message: `Automated profiling of children is restricted in ${j.name}.`,
232
+ regulation: j.childProtection.name,
233
+ remediation: 'Do not use child data for automated profiling or targeted services.',
234
+ });
235
+ }
236
+ // Jurisdiction-specific child protection rules
237
+ if (jurisdictionCode === 'US') {
238
+ issues.push({
239
+ code: 'COPPA_COMPLIANCE',
240
+ severity: 'warning',
241
+ jurisdiction: 'US',
242
+ message: 'COPPA requires verifiable parental consent before collecting data from children under 13.',
243
+ regulation: "Children's Online Privacy Protection Act (COPPA)",
244
+ remediation: 'Implement COPPA-compliant consent mechanisms (signed form, credit card verification, etc.).',
245
+ });
246
+ }
247
+ if (jurisdictionCode === 'GB') {
248
+ issues.push({
249
+ code: 'AADC_COMPLIANCE',
250
+ severity: 'info',
251
+ jurisdiction: 'GB',
252
+ message: 'The Age Appropriate Design Code (Children\'s Code) applies to services likely to be accessed by children.',
253
+ regulation: 'Age Appropriate Design Code (ICO)',
254
+ remediation: 'Conduct a Data Protection Impact Assessment (DPIA) for child-facing features.',
255
+ });
256
+ }
257
+ return {
258
+ compliant: !issues.some((i) => i.severity === 'error'),
259
+ issues,
260
+ jurisdiction: jurisdictionCode,
261
+ minConsentAge: consentAge,
262
+ ageOfMajority: majority,
263
+ requiresParentalConsent: needsParental,
264
+ };
265
+ }
266
+ // --- Consent Requirements ---
267
+ /**
268
+ * Get consent requirements for a jurisdiction.
269
+ */
270
+ export function getConsentRequirements(jurisdictionCode) {
271
+ const j = getJurisdiction(jurisdictionCode);
272
+ if (!j) {
273
+ return {
274
+ jurisdiction: jurisdictionCode,
275
+ requiresExplicitConsent: true,
276
+ consentAge: 16,
277
+ parentalConsentRequired: true,
278
+ dataCategories: ['identity', 'professional-status'],
279
+ specialCategories: ['biometric-hash', 'child-age-range'],
280
+ };
281
+ }
282
+ const base = {
283
+ jurisdiction: jurisdictionCode,
284
+ requiresExplicitConsent: j.dataProtection.requiresExplicitConsent,
285
+ consentAge: j.childProtection.minAgeDigitalConsent,
286
+ parentalConsentRequired: j.childProtection.requiresParentalConsent,
287
+ dataCategories: ['identity', 'professional-status', 'jurisdiction'],
288
+ specialCategories: [],
289
+ };
290
+ // Add special category data based on credential types
291
+ if (j.childProtection.enhancedProtections) {
292
+ base.specialCategories.push('child-age-range');
293
+ }
294
+ // GDPR special categories
295
+ if (GDPR_JURISDICTIONS.includes(jurisdictionCode)) {
296
+ base.specialCategories.push('biometric-hash');
297
+ base.notes = 'GDPR Article 9 applies — biometric data used for identification is a special category.';
298
+ }
299
+ // Brazil LGPD sensitive data
300
+ if (jurisdictionCode === 'BR') {
301
+ base.specialCategories.push('biometric-hash');
302
+ base.notes = 'LGPD treats biometric data as sensitive personal data requiring specific legal basis.';
303
+ }
304
+ return base;
305
+ }
306
+ // --- Data Retention ---
307
+ /**
308
+ * Get data retention guidance for a jurisdiction.
309
+ */
310
+ export function getRetentionGuidance(jurisdictionCode) {
311
+ const j = getJurisdiction(jurisdictionCode);
312
+ if (!j) {
313
+ return {
314
+ maxDays: 365,
315
+ guidance: 'Unknown jurisdiction — apply a conservative 1-year retention period.',
316
+ regulation: 'Best Practice',
317
+ };
318
+ }
319
+ if (j.dataProtection.maxRetentionDays > 0) {
320
+ return {
321
+ maxDays: j.dataProtection.maxRetentionDays,
322
+ guidance: `${j.name} mandates a maximum retention of ${j.dataProtection.maxRetentionDays} days.`,
323
+ regulation: j.dataProtection.fullName,
324
+ };
325
+ }
326
+ // Default guidance based on jurisdiction type
327
+ if (GDPR_JURISDICTIONS.includes(jurisdictionCode)) {
328
+ return {
329
+ maxDays: 0,
330
+ guidance: 'GDPR requires data to be kept no longer than necessary for the purpose. Apply data minimisation. Signet credentials are inherently time-limited via the expires tag.',
331
+ regulation: j.dataProtection.fullName,
332
+ };
333
+ }
334
+ return {
335
+ maxDays: 0,
336
+ guidance: `${j.dataProtection.name} does not specify a fixed retention period. Data should be retained only as long as necessary for the processing purpose.`,
337
+ regulation: j.dataProtection.fullName,
338
+ };
339
+ }
340
+ // --- Multi-Jurisdiction Compliance ---
341
+ /**
342
+ * Check compliance across multiple jurisdictions simultaneously.
343
+ * Useful for credentials that may be used internationally.
344
+ */
345
+ export function checkMultiJurisdictionCompliance(credential, jurisdictions) {
346
+ const results = new Map();
347
+ for (const code of jurisdictions) {
348
+ results.set(code, checkCredentialCompliance(credential, code));
349
+ }
350
+ return results;
351
+ }
352
+ /**
353
+ * Find the most restrictive requirements across jurisdictions.
354
+ * Useful for setting defaults that satisfy all target jurisdictions.
355
+ */
356
+ export function getMostRestrictiveRequirements(jurisdictions) {
357
+ let highestConsentAge = 0;
358
+ let highestAgeOfMajority = 0;
359
+ let requiresExplicitConsent = false;
360
+ let shortestBreachNotification = Infinity;
361
+ let allRequireErasure = true;
362
+ for (const code of jurisdictions) {
363
+ const j = getJurisdiction(code);
364
+ if (!j)
365
+ continue;
366
+ highestConsentAge = Math.max(highestConsentAge, j.childProtection.minAgeDigitalConsent);
367
+ highestAgeOfMajority = Math.max(highestAgeOfMajority, j.childProtection.ageOfMajority);
368
+ if (j.dataProtection.requiresExplicitConsent)
369
+ requiresExplicitConsent = true;
370
+ if (j.dataProtection.breachNotificationHours > 0) {
371
+ shortestBreachNotification = Math.min(shortestBreachNotification, j.dataProtection.breachNotificationHours);
372
+ }
373
+ if (!j.dataProtection.rightToErasure)
374
+ allRequireErasure = false;
375
+ }
376
+ return {
377
+ highestConsentAge,
378
+ highestAgeOfMajority,
379
+ requiresExplicitConsent,
380
+ shortestBreachNotification: shortestBreachNotification === Infinity ? 0 : shortestBreachNotification,
381
+ allRequireErasure,
382
+ jurisdictions,
383
+ };
384
+ }
385
+ // --- Internal Helpers ---
386
+ function mapProfessionString(profession) {
387
+ const map = {
388
+ solicitor: 'legal', lawyer: 'legal', attorney: 'legal', advocate: 'legal',
389
+ barrister: 'legal', avocat: 'legal', abogado: 'legal', advogado: 'legal',
390
+ rechtsanwalt: 'legal', avvocato: 'legal', advocaat: 'legal',
391
+ doctor: 'medical', physician: 'medical', surgeon: 'medical',
392
+ médecin: 'medical', arzt: 'medical', medico: 'medical',
393
+ notary: 'notary', notaire: 'notary', notar: 'notary', notaio: 'notary',
394
+ accountant: 'accounting', cpa: 'accounting', 'chartered-accountant': 'accounting',
395
+ 'expert-comptable': 'accounting', wirtschaftsprüfer: 'accounting',
396
+ engineer: 'engineering', ingénieur: 'engineering', ingenieur: 'engineering',
397
+ ingeniero: 'engineering', engenheiro: 'engineering',
398
+ teacher: 'teaching', enseignant: 'teaching', lehrer: 'teaching',
399
+ profesor: 'teaching', professor: 'teaching',
400
+ veterinarian: 'veterinary', vet: 'veterinary',
401
+ veterinario: 'veterinary', vétérinaire: 'veterinary', tierarzt: 'veterinary',
402
+ pharmacist: 'pharmacy', 'pharmacy-technician': 'pharmacy',
403
+ farmacéutico: 'pharmacy', pharmacien: 'pharmacy', apotheker: 'pharmacy',
404
+ architect: 'architecture',
405
+ arquitecto: 'architecture', architecte: 'architecture', architekt: 'architecture',
406
+ 'social-worker': 'social-work', 'social worker': 'social-work',
407
+ nurse: 'medical', midwife: 'medical',
408
+ dentist: 'medical', 'dental-hygienist': 'medical',
409
+ optometrist: 'medical', optician: 'medical',
410
+ osteopath: 'medical', chiropractor: 'medical',
411
+ paramedic: 'medical', physiotherapist: 'medical',
412
+ radiographer: 'medical', dietitian: 'medical',
413
+ 'speech-therapist': 'medical', 'occupational-therapist': 'medical',
414
+ };
415
+ return map[profession.toLowerCase()];
416
+ }
417
+ function checkChildDataRequirements(credential, j) {
418
+ const issues = [];
419
+ // Check age range tag
420
+ const ageRange = getTagValue(credential, 'age-range');
421
+ if (!ageRange) {
422
+ issues.push({
423
+ code: 'MISSING_AGE_RANGE',
424
+ severity: 'error',
425
+ jurisdiction: j.code,
426
+ message: 'Child credential is missing the age-range tag.',
427
+ regulation: j.childProtection.name,
428
+ remediation: 'Include an age-range tag (e.g., "8-12") in the credential.',
429
+ });
430
+ return issues;
431
+ }
432
+ // Handle "18+" format (adults, no upper bound)
433
+ let minAge;
434
+ let maxAge;
435
+ if (ageRange.endsWith('+')) {
436
+ minAge = parseInt(ageRange.slice(0, -1), 10);
437
+ maxAge = 150;
438
+ }
439
+ else {
440
+ const [minStr, maxStr] = ageRange.split('-');
441
+ minAge = parseInt(minStr, 10);
442
+ maxAge = parseInt(maxStr, 10);
443
+ }
444
+ if (isNaN(minAge) || isNaN(maxAge)) {
445
+ issues.push({
446
+ code: 'INVALID_AGE_RANGE',
447
+ severity: 'error',
448
+ jurisdiction: j.code,
449
+ message: `Malformed age-range tag "${ageRange}" — cannot determine age bounds.`,
450
+ regulation: j.childProtection.name,
451
+ remediation: 'Use a valid age-range format: "0-3", "4-7", "8-12", "13-17", or "18+".',
452
+ });
453
+ return issues;
454
+ }
455
+ // Check if age range includes ages below digital consent age
456
+ if (minAge < j.childProtection.minAgeDigitalConsent) {
457
+ issues.push({
458
+ code: 'BELOW_CONSENT_AGE',
459
+ severity: 'warning',
460
+ jurisdiction: j.code,
461
+ message: `Age range ${ageRange} includes ages below the digital consent age of ${j.childProtection.minAgeDigitalConsent} in ${j.name}. Parental consent is required.`,
462
+ regulation: j.childProtection.name,
463
+ remediation: 'Ensure verifiable parental consent has been obtained.',
464
+ });
465
+ }
466
+ // Check that the age range is within expected bounds (skip upper check for open-ended "18+" ranges)
467
+ if (minAge < 0 || (!ageRange.endsWith('+') && maxAge > j.childProtection.ageOfMajority)) {
468
+ issues.push({
469
+ code: 'INVALID_AGE_RANGE',
470
+ severity: 'warning',
471
+ jurisdiction: j.code,
472
+ message: `Age range ${ageRange} extends beyond expected bounds for ${j.name} (0-${j.childProtection.ageOfMajority}).`,
473
+ regulation: j.childProtection.name,
474
+ });
475
+ }
476
+ return issues;
477
+ }
478
+ //# sourceMappingURL=compliance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compliance.js","sourceRoot":"","sources":["../src/compliance.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,0EAA0E;AAC1E,iDAAiD;AAEjD,OAAO,EACL,eAAe,EACf,eAAe,EACf,qBAAqB,GAGtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAkDpD,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEtE,gCAAgC;AAEhC;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAsB,EACtB,gBAAwB;IAExB,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,CAAC,GAAG,eAAe,CAAC,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B,OAAO,EAAE,aAAa,QAAQ,mDAAmD,CAAC,CAAC,eAAe,CAAC,oBAAoB,OAAO,CAAC,CAAC,IAAI,iCAAiC;YACrK,UAAU,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI;YAClC,WAAW,EAAE,uDAAuD;SACrE,CAAC,CAAC;IACL,CAAC;IAED,oGAAoG;IACpG,IAAI,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,CAAC;QACxF,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,SAAS;YACnB,YAAY,EAAE,CAAC,CAAC,IAAI;YACpB,OAAO,EAAE,aAAa,QAAQ,uCAAuC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,eAAe,CAAC,aAAa,IAAI;YACrH,UAAU,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI;SACnC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,63 @@
1
+ export interface ContactInfo {
2
+ name?: string;
3
+ mobile?: string;
4
+ email?: string;
5
+ address?: string;
6
+ childPubkeys?: string[];
7
+ }
8
+ /** SECURITY NOTE: sharedSecret is stored as a plain hex string in memory.
9
+ * For production use, secrets should be encrypted at rest (e.g. via OS keychain
10
+ * or encrypted storage). JS strings cannot be zeroed from memory. */
11
+ export interface Connection {
12
+ pubkey: string;
13
+ sharedSecret: string;
14
+ theirInfo: ContactInfo;
15
+ ourInfo: ContactInfo;
16
+ connectedAt: number;
17
+ method: 'qr-in-person' | 'online';
18
+ }
19
+ export interface QRPayload {
20
+ pubkey: string;
21
+ nonce: string;
22
+ info?: ContactInfo;
23
+ }
24
+ /** Compute an ECDH shared secret from our private key and their x-only public key.
25
+ * The result is the SHA-256 of the x-coordinate of the ECDH point, returned as
26
+ * a 32-byte hex string. The secret is symmetric: A(priv)+B(pub) === B(priv)+A(pub). */
27
+ export declare function computeSharedSecret(myPrivateKey: string, theirPublicKey: string): string;
28
+ /**
29
+ * Create a QR payload containing our public key and a random nonce.
30
+ *
31
+ * **SECURITY WARNING — unencrypted payload:** The returned object is serialised
32
+ * as cleartext JSON by `serializeQRPayload`. Any `ContactInfo` embedded in the
33
+ * payload (name, mobile, email, address, children's public keys) is transmitted
34
+ * without encryption. Only display this QR code on trusted screens in
35
+ * controlled environments. Do not transmit it over untrusted channels.
36
+ */
37
+ export declare function createQRPayload(publicKey: string, info?: ContactInfo): QRPayload;
38
+ /** Serialize a QR payload to a JSON string. */
39
+ export declare function serializeQRPayload(payload: QRPayload): string;
40
+ /** Parse and validate a QR payload from a JSON string.
41
+ * Throws if the data is not valid JSON or is missing required fields. */
42
+ export declare function parseQRPayload(data: string): QRPayload;
43
+ /** Create a Connection from our private key and a scanned QR payload. */
44
+ export declare function createConnection(myPrivateKey: string, qrPayload: QRPayload, ourInfo: ContactInfo): Connection;
45
+ /** Simple in-memory connection manager keyed by remote public key. */
46
+ export declare class ConnectionStore {
47
+ private connections;
48
+ /** Add a connection. If a connection with the same pubkey already exists it is replaced. */
49
+ add(connection: Connection): void;
50
+ /** Get a connection by remote public key. */
51
+ get(pubkey: string): Connection | undefined;
52
+ /** List all connections. */
53
+ list(): Connection[];
54
+ /** Remove a connection by remote public key. Returns true if a connection was removed. */
55
+ remove(pubkey: string): boolean;
56
+ /** Check whether a connection for the given public key exists. */
57
+ has(pubkey: string): boolean;
58
+ /** Export all connections as an array (for serialization). */
59
+ export(): Connection[];
60
+ /** Import connections from an array, replacing any existing connections with the same pubkey. */
61
+ import(connections: Connection[]): void;
62
+ }
63
+ //# sourceMappingURL=connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAA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