signet-protocol 1.11.0 → 1.11.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 +22 -10
- package/docs/bot-ownership-v1.md +43 -0
- package/docs/implementation-levels.md +235 -0
- package/docs/private-vault-v1.md +104 -0
- package/docs/signet-in-5-minutes.md +181 -0
- package/examples/full-flow.ts +260 -0
- package/examples/jurisdictions/brazil-lawyer.ts +186 -0
- package/examples/jurisdictions/eu-doctor.ts +160 -0
- package/examples/jurisdictions/india-doctor.ts +207 -0
- package/examples/jurisdictions/japan-notary.ts +157 -0
- package/examples/jurisdictions/multi-jurisdiction.ts +174 -0
- package/examples/jurisdictions/uae-professional.ts +190 -0
- package/examples/jurisdictions/uk-solicitor.ts +170 -0
- package/examples/jurisdictions/us-attorney.ts +161 -0
- package/examples/signet-me.ts +253 -0
- package/llms-full.txt +3775 -0
- package/llms.txt +152 -0
- package/package.json +14 -3
- package/spec/protocol.md +2628 -0
- package/spec/voting.md +563 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Signet Protocol — UAE Professional Example
|
|
2
|
+
// Demonstrates identity verification under PDPL (Federal Decree-Law No. 45/2021)
|
|
3
|
+
// Jurisdiction: United Arab Emirates (AE)
|
|
4
|
+
// Profession: Legal professional licensed by the Ministry of Justice
|
|
5
|
+
// Features: UAE data protection, Arabic output, GCC mutual recognition
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
generateKeyPair,
|
|
9
|
+
getJurisdiction,
|
|
10
|
+
getProfessionalBodies,
|
|
11
|
+
getMutualRecognitionPartners,
|
|
12
|
+
createProfessionalCredential,
|
|
13
|
+
verifyCredential,
|
|
14
|
+
parseCredential,
|
|
15
|
+
checkCredentialCompliance,
|
|
16
|
+
checkCrossBorderCompliance,
|
|
17
|
+
checkChildCompliance,
|
|
18
|
+
getConsentRequirements,
|
|
19
|
+
setLanguage,
|
|
20
|
+
t,
|
|
21
|
+
getTierDescription,
|
|
22
|
+
formatLocalizedTrustScore,
|
|
23
|
+
computeTrustScore,
|
|
24
|
+
} from '../../src/index.js';
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
console.log('=== Signet Protocol — UAE Professional Verification ===\n');
|
|
28
|
+
|
|
29
|
+
// --- 1. Jurisdiction lookup ---
|
|
30
|
+
const ae = getJurisdiction('AE');
|
|
31
|
+
if (!ae) throw new Error('AE jurisdiction not found');
|
|
32
|
+
|
|
33
|
+
// Arabic output first
|
|
34
|
+
setLanguage('ar');
|
|
35
|
+
console.log(`[Arabic] ${t('credential_professional')}`);
|
|
36
|
+
console.log(getTierDescription(3));
|
|
37
|
+
console.log();
|
|
38
|
+
|
|
39
|
+
// English output for detailed information
|
|
40
|
+
setLanguage('en');
|
|
41
|
+
console.log(`Jurisdiction: ${ae.name} (${ae.nameLocal})`);
|
|
42
|
+
console.log(`Legal system: ${ae.legalSystem}`);
|
|
43
|
+
console.log(`Data protection: ${ae.dataProtection.name} - ${ae.dataProtection.fullName}`);
|
|
44
|
+
console.log(`Year enacted: ${ae.dataProtection.year}`);
|
|
45
|
+
console.log(`Supervisory authority: ${ae.dataProtection.supervisoryAuthority}`);
|
|
46
|
+
if (ae.dataProtection.notes) {
|
|
47
|
+
console.log(`Note: ${ae.dataProtection.notes}`);
|
|
48
|
+
}
|
|
49
|
+
console.log();
|
|
50
|
+
|
|
51
|
+
// --- 2. Ministry of Justice / DHA lookup ---
|
|
52
|
+
// UAE has different licensing bodies: Ministry of Justice for legal,
|
|
53
|
+
// DHA (Dubai) and DoH (Abu Dhabi) for medical professionals.
|
|
54
|
+
const legalBodies = getProfessionalBodies('AE', 'legal');
|
|
55
|
+
const medicalBodies = getProfessionalBodies('AE', 'medical');
|
|
56
|
+
|
|
57
|
+
console.log('Legal professional bodies in UAE:');
|
|
58
|
+
for (const body of legalBodies) {
|
|
59
|
+
console.log(` - ${body.name}`);
|
|
60
|
+
if (body.nameEn) console.log(` (${body.nameEn})`);
|
|
61
|
+
console.log(` Digital credentials: ${body.issuesDigitalCredentials}`);
|
|
62
|
+
if (body.notes) console.log(` Note: ${body.notes}`);
|
|
63
|
+
}
|
|
64
|
+
console.log();
|
|
65
|
+
|
|
66
|
+
console.log('Medical professional bodies in UAE:');
|
|
67
|
+
for (const body of medicalBodies) {
|
|
68
|
+
console.log(` - ${body.name}`);
|
|
69
|
+
if (body.nameEn) console.log(` (${body.nameEn})`);
|
|
70
|
+
console.log(` Digital credentials: ${body.issuesDigitalCredentials}`);
|
|
71
|
+
}
|
|
72
|
+
console.log();
|
|
73
|
+
|
|
74
|
+
// --- 3. Generate identities ---
|
|
75
|
+
const professional = generateKeyPair(); // UAE legal professional
|
|
76
|
+
const subject = generateKeyPair(); // Person being verified
|
|
77
|
+
|
|
78
|
+
// --- 4. Create Tier 3 credential ---
|
|
79
|
+
console.log('--- Tier 3: Professional Verification ---');
|
|
80
|
+
|
|
81
|
+
const credential = await createProfessionalCredential(
|
|
82
|
+
professional.privateKey,
|
|
83
|
+
subject.publicKey,
|
|
84
|
+
{
|
|
85
|
+
profession: 'lawyer',
|
|
86
|
+
jurisdiction: 'AE',
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const verification = await verifyCredential(credential);
|
|
91
|
+
const parsed = parseCredential(credential)!;
|
|
92
|
+
|
|
93
|
+
console.log(`${t('credential_professional')}: ${t('status_valid')}`);
|
|
94
|
+
console.log(` Signature valid: ${verification.signatureValid}`);
|
|
95
|
+
console.log(` Tier: ${parsed.tier}, Profession: ${parsed.profession}`);
|
|
96
|
+
console.log(` Jurisdiction: ${parsed.jurisdiction}`);
|
|
97
|
+
console.log();
|
|
98
|
+
|
|
99
|
+
// Arabic credential display
|
|
100
|
+
setLanguage('ar');
|
|
101
|
+
console.log(`[Arabic] ${t('credential_professional')}: ${t('status_valid')}`);
|
|
102
|
+
console.log(` ${t('msg_signature_valid')}`);
|
|
103
|
+
console.log();
|
|
104
|
+
|
|
105
|
+
setLanguage('en');
|
|
106
|
+
|
|
107
|
+
// --- 5. UAE PDPL compliance check ---
|
|
108
|
+
// The UAE PDPL came into effect in 2021. DIFC and ADGM have their own
|
|
109
|
+
// separate data protection regimes.
|
|
110
|
+
console.log('--- UAE PDPL Compliance Check ---');
|
|
111
|
+
const compliance = checkCredentialCompliance(credential, 'AE');
|
|
112
|
+
console.log(`Compliant: ${compliance.compliant}`);
|
|
113
|
+
|
|
114
|
+
for (const issue of compliance.issues) {
|
|
115
|
+
const prefix = issue.severity === 'error' ? '[ERROR]'
|
|
116
|
+
: issue.severity === 'warning' ? '[WARN]'
|
|
117
|
+
: '[INFO]';
|
|
118
|
+
console.log(` ${prefix} ${issue.message}`);
|
|
119
|
+
console.log(` Regulation: ${issue.regulation}`);
|
|
120
|
+
if (issue.remediation) {
|
|
121
|
+
console.log(` Remediation: ${issue.remediation}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
console.log();
|
|
125
|
+
|
|
126
|
+
// --- 6. GCC mutual recognition ---
|
|
127
|
+
// UAE has mutual recognition agreements with GCC member states:
|
|
128
|
+
// Saudi Arabia, Bahrain, Qatar, Kuwait, and Oman.
|
|
129
|
+
console.log('--- GCC Mutual Recognition ---');
|
|
130
|
+
const partners = getMutualRecognitionPartners('AE');
|
|
131
|
+
console.log(`Mutual recognition partners: ${partners.join(', ')}`);
|
|
132
|
+
console.log();
|
|
133
|
+
|
|
134
|
+
// Cross-border to Saudi Arabia (GCC partner)
|
|
135
|
+
console.log('--- Cross-border: AE -> SA ---');
|
|
136
|
+
const aeToSa = checkCrossBorderCompliance('AE', 'SA');
|
|
137
|
+
console.log(`Allowed: ${aeToSa.allowed}`);
|
|
138
|
+
if (aeToSa.mechanism) {
|
|
139
|
+
console.log(`Mechanism: ${aeToSa.mechanism}`);
|
|
140
|
+
}
|
|
141
|
+
for (const issue of aeToSa.issues) {
|
|
142
|
+
console.log(` [${issue.severity.toUpperCase()}] ${issue.message}`);
|
|
143
|
+
}
|
|
144
|
+
console.log();
|
|
145
|
+
|
|
146
|
+
// Cross-border to UK (non-GCC)
|
|
147
|
+
console.log('--- Cross-border: AE -> GB ---');
|
|
148
|
+
const aeToGb = checkCrossBorderCompliance('AE', 'GB');
|
|
149
|
+
console.log(`Allowed: ${aeToGb.allowed}`);
|
|
150
|
+
if (aeToGb.mechanism) {
|
|
151
|
+
console.log(`Mechanism: ${aeToGb.mechanism}`);
|
|
152
|
+
}
|
|
153
|
+
for (const issue of aeToGb.issues) {
|
|
154
|
+
console.log(` [${issue.severity.toUpperCase()}] ${issue.message}`);
|
|
155
|
+
}
|
|
156
|
+
console.log();
|
|
157
|
+
|
|
158
|
+
// --- 7. Child protection under Wadeema's Law ---
|
|
159
|
+
// UAE digital consent age is 18 and age of majority is 21.
|
|
160
|
+
// Wadeema's Law provides additional child protection requirements.
|
|
161
|
+
console.log("--- Child Compliance (age 15, AE) — Wadeema's Law ---");
|
|
162
|
+
const childCompliance = checkChildCompliance(15, 'AE');
|
|
163
|
+
console.log(`Compliant: ${childCompliance.compliant}`);
|
|
164
|
+
console.log(`Min consent age: ${childCompliance.minConsentAge}`);
|
|
165
|
+
console.log(`Age of majority: ${childCompliance.ageOfMajority}`);
|
|
166
|
+
console.log(`Parental consent required: ${childCompliance.requiresParentalConsent}`);
|
|
167
|
+
|
|
168
|
+
for (const issue of childCompliance.issues) {
|
|
169
|
+
console.log(` [${issue.severity.toUpperCase()}] ${issue.message}`);
|
|
170
|
+
}
|
|
171
|
+
console.log();
|
|
172
|
+
|
|
173
|
+
// --- 8. Signet IQ ---
|
|
174
|
+
console.log('--- Signet IQ ---');
|
|
175
|
+
const trustScore = computeTrustScore(
|
|
176
|
+
subject.publicKey,
|
|
177
|
+
[credential],
|
|
178
|
+
[],
|
|
179
|
+
Math.floor(Date.now() / 1000) - 365 * 24 * 60 * 60
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
setLanguage('en');
|
|
183
|
+
console.log(`[English] ${formatLocalizedTrustScore(trustScore.score)}`);
|
|
184
|
+
setLanguage('ar');
|
|
185
|
+
console.log(`[Arabic] ${formatLocalizedTrustScore(trustScore.score)}`);
|
|
186
|
+
|
|
187
|
+
console.log('\n=== UAE Professional Example Complete ===');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Signet Protocol — UK Solicitor Example
|
|
2
|
+
// Demonstrates identity verification under UK GDPR + Age Appropriate Design Code
|
|
3
|
+
// Jurisdiction: United Kingdom (GB)
|
|
4
|
+
// Profession: Solicitor regulated by the Law Society of England and Wales
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
generateKeyPair,
|
|
8
|
+
getJurisdiction,
|
|
9
|
+
getProfessionalBodies,
|
|
10
|
+
createProfessionalCredential,
|
|
11
|
+
createChildSafetyCredential,
|
|
12
|
+
verifyCredential,
|
|
13
|
+
parseCredential,
|
|
14
|
+
checkCredentialCompliance,
|
|
15
|
+
checkChildCompliance,
|
|
16
|
+
getConsentRequirements,
|
|
17
|
+
setLanguage,
|
|
18
|
+
t,
|
|
19
|
+
getTierDescription,
|
|
20
|
+
formatLocalizedTrustScore,
|
|
21
|
+
computeTrustScore,
|
|
22
|
+
} from '../../src/index.js';
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
console.log('=== Signet Protocol — UK Solicitor Verification ===\n');
|
|
26
|
+
|
|
27
|
+
// Set language to English (UK primary language)
|
|
28
|
+
setLanguage('en');
|
|
29
|
+
|
|
30
|
+
// --- 1. Look up jurisdiction and professional bodies ---
|
|
31
|
+
const gb = getJurisdiction('GB');
|
|
32
|
+
if (!gb) throw new Error('GB jurisdiction not found');
|
|
33
|
+
|
|
34
|
+
console.log(`Jurisdiction: ${gb.name} (${gb.code})`);
|
|
35
|
+
console.log(`Legal system: ${gb.legalSystem}`);
|
|
36
|
+
console.log(`Data protection: ${gb.dataProtection.name}`);
|
|
37
|
+
console.log(`Supervisory authority: ${gb.dataProtection.supervisoryAuthority}`);
|
|
38
|
+
console.log(`e-Signature recognised: ${gb.eSignatureRecognised}`);
|
|
39
|
+
console.log();
|
|
40
|
+
|
|
41
|
+
// Look up the Law Society of England and Wales
|
|
42
|
+
const legalBodies = getProfessionalBodies('GB', 'legal');
|
|
43
|
+
console.log('Legal professional bodies in GB:');
|
|
44
|
+
for (const body of legalBodies) {
|
|
45
|
+
console.log(` - ${body.name}`);
|
|
46
|
+
console.log(` Public register: ${body.hasPublicRegister}`);
|
|
47
|
+
if (body.registerUrl) {
|
|
48
|
+
console.log(` Register URL: ${body.registerUrl}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
console.log();
|
|
52
|
+
|
|
53
|
+
// --- 2. Generate identities ---
|
|
54
|
+
const solicitor = generateKeyPair(); // The verifying solicitor
|
|
55
|
+
const subject = generateKeyPair(); // Person being verified
|
|
56
|
+
const parent = generateKeyPair(); // Parent (for child safety credential)
|
|
57
|
+
|
|
58
|
+
// --- 3. Create a Tier 3 professional credential ---
|
|
59
|
+
// Under UK GDPR, explicit consent must be obtained before processing personal data.
|
|
60
|
+
// The solicitor verifies identity in person and issues a Signet credential.
|
|
61
|
+
console.log('--- Tier 3: Professional Verification ---');
|
|
62
|
+
console.log(getTierDescription(3));
|
|
63
|
+
console.log();
|
|
64
|
+
|
|
65
|
+
const credential = await createProfessionalCredential(
|
|
66
|
+
solicitor.privateKey,
|
|
67
|
+
subject.publicKey,
|
|
68
|
+
{
|
|
69
|
+
profession: 'solicitor',
|
|
70
|
+
jurisdiction: 'GB',
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const verification = await verifyCredential(credential);
|
|
75
|
+
const parsed = parseCredential(credential)!;
|
|
76
|
+
|
|
77
|
+
console.log(`${t('credential_professional')}: ${t('status_valid')}`);
|
|
78
|
+
console.log(` Signature valid: ${verification.signatureValid}`);
|
|
79
|
+
console.log(` Structure valid: ${verification.structureValid}`);
|
|
80
|
+
console.log(` Tier: ${parsed.tier}, Profession: ${parsed.profession}`);
|
|
81
|
+
console.log(` Jurisdiction: ${parsed.jurisdiction}`);
|
|
82
|
+
console.log();
|
|
83
|
+
|
|
84
|
+
// --- 4. Check compliance with UK regulations ---
|
|
85
|
+
console.log('--- UK GDPR Compliance Check ---');
|
|
86
|
+
const compliance = checkCredentialCompliance(credential, 'GB');
|
|
87
|
+
console.log(`Compliant: ${compliance.compliant}`);
|
|
88
|
+
|
|
89
|
+
for (const issue of compliance.issues) {
|
|
90
|
+
const prefix = issue.severity === 'error' ? '[ERROR]'
|
|
91
|
+
: issue.severity === 'warning' ? '[WARN]'
|
|
92
|
+
: '[INFO]';
|
|
93
|
+
console.log(` ${prefix} ${issue.message}`);
|
|
94
|
+
console.log(` Regulation: ${issue.regulation}`);
|
|
95
|
+
if (issue.remediation) {
|
|
96
|
+
console.log(` Remediation: ${issue.remediation}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
console.log();
|
|
100
|
+
|
|
101
|
+
// --- 5. Consent requirements under UK GDPR ---
|
|
102
|
+
console.log('--- Consent Requirements ---');
|
|
103
|
+
const consent = getConsentRequirements('GB');
|
|
104
|
+
console.log(`Explicit consent required: ${consent.requiresExplicitConsent}`);
|
|
105
|
+
console.log(`Digital consent age: ${consent.consentAge}`);
|
|
106
|
+
console.log(`Parental consent required: ${consent.parentalConsentRequired}`);
|
|
107
|
+
console.log(`Data categories: ${consent.dataCategories.join(', ')}`);
|
|
108
|
+
if (consent.specialCategories.length > 0) {
|
|
109
|
+
console.log(`Special categories: ${consent.specialCategories.join(', ')}`);
|
|
110
|
+
}
|
|
111
|
+
if (consent.notes) {
|
|
112
|
+
console.log(`Note: ${consent.notes}`);
|
|
113
|
+
}
|
|
114
|
+
console.log();
|
|
115
|
+
|
|
116
|
+
// --- 6. Child safety credential under UK Age Appropriate Design Code ---
|
|
117
|
+
// The AADC (Children's Code) applies to services likely to be accessed by children.
|
|
118
|
+
// UK digital consent age is 13; below that, verifiable parental consent is required.
|
|
119
|
+
console.log('--- Tier 4: Child Safety (Age Appropriate Design Code) ---');
|
|
120
|
+
console.log(getTierDescription(4));
|
|
121
|
+
console.log();
|
|
122
|
+
|
|
123
|
+
const childCredential = await createChildSafetyCredential(
|
|
124
|
+
solicitor.privateKey,
|
|
125
|
+
parent.publicKey,
|
|
126
|
+
{
|
|
127
|
+
profession: 'solicitor',
|
|
128
|
+
jurisdiction: 'GB',
|
|
129
|
+
ageRange: '8-12',
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const childVerification = await verifyCredential(childCredential);
|
|
134
|
+
const childParsed = parseCredential(childCredential)!;
|
|
135
|
+
|
|
136
|
+
console.log(`${t('credential_professional_child')}: ${t('status_valid')}`);
|
|
137
|
+
console.log(` Scope: ${childParsed.scope}, Age range: ${childParsed.ageRange}`);
|
|
138
|
+
console.log(` Signature valid: ${childVerification.signatureValid}`);
|
|
139
|
+
console.log();
|
|
140
|
+
|
|
141
|
+
// Check child compliance for a 10-year-old under UK rules
|
|
142
|
+
console.log('--- Child Compliance Check (age 10, UK) ---');
|
|
143
|
+
const childCompliance = checkChildCompliance(10, 'GB');
|
|
144
|
+
console.log(`Compliant: ${childCompliance.compliant}`);
|
|
145
|
+
console.log(`Min consent age: ${childCompliance.minConsentAge}`);
|
|
146
|
+
console.log(`Age of majority: ${childCompliance.ageOfMajority}`);
|
|
147
|
+
console.log(`Parental consent required: ${childCompliance.requiresParentalConsent}`);
|
|
148
|
+
|
|
149
|
+
for (const issue of childCompliance.issues) {
|
|
150
|
+
const prefix = issue.severity === 'error' ? '[ERROR]'
|
|
151
|
+
: issue.severity === 'warning' ? '[WARN]'
|
|
152
|
+
: '[INFO]';
|
|
153
|
+
console.log(` ${prefix} ${issue.message}`);
|
|
154
|
+
}
|
|
155
|
+
console.log();
|
|
156
|
+
|
|
157
|
+
// --- 7. Signet IQ display ---
|
|
158
|
+
console.log('--- Signet IQ ---');
|
|
159
|
+
const trustScore = computeTrustScore(
|
|
160
|
+
subject.publicKey,
|
|
161
|
+
[credential],
|
|
162
|
+
[],
|
|
163
|
+
Math.floor(Date.now() / 1000) - 365 * 24 * 60 * 60
|
|
164
|
+
);
|
|
165
|
+
console.log(formatLocalizedTrustScore(trustScore.score));
|
|
166
|
+
|
|
167
|
+
console.log('\n=== UK Solicitor Example Complete ===');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// Signet Protocol — US Attorney Example
|
|
2
|
+
// Demonstrates identity verification under CCPA/COPPA
|
|
3
|
+
// Jurisdiction: United States (US)
|
|
4
|
+
// Profession: Attorney — licensing is state-level via bar associations
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
generateKeyPair,
|
|
8
|
+
getJurisdiction,
|
|
9
|
+
getProfessionalBodies,
|
|
10
|
+
createProfessionalCredential,
|
|
11
|
+
createChildSafetyCredential,
|
|
12
|
+
verifyCredential,
|
|
13
|
+
parseCredential,
|
|
14
|
+
checkCredentialCompliance,
|
|
15
|
+
checkChildCompliance,
|
|
16
|
+
getConsentRequirements,
|
|
17
|
+
setLanguage,
|
|
18
|
+
t,
|
|
19
|
+
getTierDescription,
|
|
20
|
+
formatLocalizedTrustScore,
|
|
21
|
+
computeTrustScore,
|
|
22
|
+
} from '../../src/index.js';
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
console.log('=== Signet Protocol — US Attorney Verification ===\n');
|
|
26
|
+
|
|
27
|
+
// --- 1. Jurisdiction lookup ---
|
|
28
|
+
const us = getJurisdiction('US');
|
|
29
|
+
if (!us) throw new Error('US jurisdiction not found');
|
|
30
|
+
|
|
31
|
+
console.log(`Jurisdiction: ${us.name} (${us.code})`);
|
|
32
|
+
console.log(`Legal system: ${us.legalSystem}`);
|
|
33
|
+
console.log(`Data protection: ${us.dataProtection.name}`);
|
|
34
|
+
console.log(`Note: ${us.dataProtection.notes}`);
|
|
35
|
+
console.log(`Supervisory authority: ${us.dataProtection.supervisoryAuthority}`);
|
|
36
|
+
console.log();
|
|
37
|
+
|
|
38
|
+
// State-level bar association lookup
|
|
39
|
+
// In the US, attorney licensing is handled by individual state bars.
|
|
40
|
+
// The ABA accredits law schools but does not license attorneys.
|
|
41
|
+
const legalBodies = getProfessionalBodies('US', 'legal');
|
|
42
|
+
console.log('Legal professional bodies in US:');
|
|
43
|
+
for (const body of legalBodies) {
|
|
44
|
+
console.log(` - ${body.name}`);
|
|
45
|
+
if (body.notes) console.log(` Note: ${body.notes}`);
|
|
46
|
+
}
|
|
47
|
+
console.log();
|
|
48
|
+
|
|
49
|
+
// --- 2. Generate identities ---
|
|
50
|
+
const attorney = generateKeyPair(); // The verifying attorney
|
|
51
|
+
const subject = generateKeyPair(); // Person being verified
|
|
52
|
+
const child = generateKeyPair(); // Child subject (for COPPA check)
|
|
53
|
+
|
|
54
|
+
// --- 3. English output: Create Tier 3 credential ---
|
|
55
|
+
setLanguage('en');
|
|
56
|
+
console.log('--- [English] Tier 3: Professional Verification ---');
|
|
57
|
+
console.log(getTierDescription(3));
|
|
58
|
+
console.log();
|
|
59
|
+
|
|
60
|
+
const credential = await createProfessionalCredential(
|
|
61
|
+
attorney.privateKey,
|
|
62
|
+
subject.publicKey,
|
|
63
|
+
{
|
|
64
|
+
profession: 'attorney',
|
|
65
|
+
jurisdiction: 'US',
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const verification = await verifyCredential(credential);
|
|
70
|
+
const parsed = parseCredential(credential)!;
|
|
71
|
+
|
|
72
|
+
console.log(`${t('credential_professional')}: ${t('status_valid')}`);
|
|
73
|
+
console.log(` Signature valid: ${verification.signatureValid}`);
|
|
74
|
+
console.log(` Tier: ${parsed.tier}, Profession: ${parsed.profession}`);
|
|
75
|
+
console.log(` Jurisdiction: ${parsed.jurisdiction}`);
|
|
76
|
+
console.log();
|
|
77
|
+
|
|
78
|
+
// --- 4. Spanish output (bilingual) ---
|
|
79
|
+
// The US has a significant Spanish-speaking population. Signet supports
|
|
80
|
+
// bilingual output for accessibility and regulatory compliance.
|
|
81
|
+
setLanguage('es');
|
|
82
|
+
console.log('--- [Espanol] Nivel 3: Verificacion Profesional ---');
|
|
83
|
+
console.log(getTierDescription(3));
|
|
84
|
+
console.log();
|
|
85
|
+
|
|
86
|
+
console.log(`${t('credential_professional')}: ${t('status_valid')}`);
|
|
87
|
+
console.log(` Firma valida: ${verification.signatureValid}`);
|
|
88
|
+
console.log(` Nivel: ${parsed.tier}, Profesion: ${parsed.profession}`);
|
|
89
|
+
console.log();
|
|
90
|
+
|
|
91
|
+
// Switch back to English for the rest
|
|
92
|
+
setLanguage('en');
|
|
93
|
+
|
|
94
|
+
// --- 5. CCPA/CPRA compliance check ---
|
|
95
|
+
console.log('--- CCPA/CPRA Compliance Check ---');
|
|
96
|
+
const compliance = checkCredentialCompliance(credential, 'US');
|
|
97
|
+
console.log(`Compliant: ${compliance.compliant}`);
|
|
98
|
+
|
|
99
|
+
for (const issue of compliance.issues) {
|
|
100
|
+
const prefix = issue.severity === 'error' ? '[ERROR]'
|
|
101
|
+
: issue.severity === 'warning' ? '[WARN]'
|
|
102
|
+
: '[INFO]';
|
|
103
|
+
console.log(` ${prefix} ${issue.message}`);
|
|
104
|
+
console.log(` Regulation: ${issue.regulation}`);
|
|
105
|
+
if (issue.remediation) {
|
|
106
|
+
console.log(` Remediation: ${issue.remediation}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
console.log();
|
|
110
|
+
|
|
111
|
+
// --- 6. COPPA child compliance check ---
|
|
112
|
+
// COPPA requires verifiable parental consent before collecting data from
|
|
113
|
+
// children under 13. The FTC strictly enforces this.
|
|
114
|
+
console.log('--- COPPA Child Compliance (age 11) ---');
|
|
115
|
+
const childCompliance = checkChildCompliance(11, 'US');
|
|
116
|
+
console.log(`Compliant: ${childCompliance.compliant}`);
|
|
117
|
+
console.log(`Min consent age: ${childCompliance.minConsentAge}`);
|
|
118
|
+
console.log(`Parental consent required: ${childCompliance.requiresParentalConsent}`);
|
|
119
|
+
|
|
120
|
+
for (const issue of childCompliance.issues) {
|
|
121
|
+
const prefix = issue.severity === 'error' ? '[ERROR]'
|
|
122
|
+
: issue.severity === 'warning' ? '[WARN]'
|
|
123
|
+
: '[INFO]';
|
|
124
|
+
console.log(` ${prefix} ${issue.message}`);
|
|
125
|
+
if (issue.remediation) {
|
|
126
|
+
console.log(` Remediation: ${issue.remediation}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
console.log();
|
|
130
|
+
|
|
131
|
+
// Also check a 14-year-old (above COPPA threshold but still a minor)
|
|
132
|
+
console.log('--- COPPA Child Compliance (age 14) ---');
|
|
133
|
+
const teenCompliance = checkChildCompliance(14, 'US');
|
|
134
|
+
console.log(`Compliant: ${teenCompliance.compliant}`);
|
|
135
|
+
console.log(`Parental consent required: ${teenCompliance.requiresParentalConsent}`);
|
|
136
|
+
console.log();
|
|
137
|
+
|
|
138
|
+
// --- 7. Consent requirements ---
|
|
139
|
+
console.log('--- US Consent Requirements ---');
|
|
140
|
+
const consent = getConsentRequirements('US');
|
|
141
|
+
// Note: US does not require explicit consent at the federal level (unlike GDPR).
|
|
142
|
+
// CCPA provides opt-out rights rather than opt-in consent.
|
|
143
|
+
console.log(`Explicit consent required: ${consent.requiresExplicitConsent}`);
|
|
144
|
+
console.log(`Digital consent age: ${consent.consentAge}`);
|
|
145
|
+
console.log(`Data categories: ${consent.dataCategories.join(', ')}`);
|
|
146
|
+
console.log();
|
|
147
|
+
|
|
148
|
+
// --- 8. Signet IQ ---
|
|
149
|
+
console.log('--- Signet IQ ---');
|
|
150
|
+
const trustScore = computeTrustScore(
|
|
151
|
+
subject.publicKey,
|
|
152
|
+
[credential],
|
|
153
|
+
[],
|
|
154
|
+
Math.floor(Date.now() / 1000) - 2 * 365 * 24 * 60 * 60
|
|
155
|
+
);
|
|
156
|
+
console.log(formatLocalizedTrustScore(trustScore.score));
|
|
157
|
+
|
|
158
|
+
console.log('\n=== US Attorney Example Complete ===');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
main().catch(console.error);
|