@ashlar-blue/x402-trust 0.5.91 → 0.5.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -1
- package/README.md +76 -59
- package/dist/agent-switchboard.d.ts +64 -8
- package/dist/agent-switchboard.d.ts.map +1 -1
- package/dist/agent-switchboard.js +278 -77
- package/dist/agent-switchboard.js.map +1 -1
- package/dist/attested-directory.js +1 -1
- package/dist/attested-directory.js.map +1 -1
- package/dist/badges.js +1 -1
- package/dist/badges.js.map +1 -1
- package/dist/catalog-mcp.d.ts +1 -1
- package/dist/catalog-mcp.js +4 -4
- package/dist/catalog-mcp.js.map +1 -1
- package/dist/census-reconcile.js +1 -1
- package/dist/census-reconcile.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-core.d.ts +307 -0
- package/dist/client-core.d.ts.map +1 -0
- package/dist/client-core.js +574 -0
- package/dist/client-core.js.map +1 -0
- package/dist/directory-classify.js +1 -1
- package/dist/directory-classify.js.map +1 -1
- package/dist/discovery.d.ts +6 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +29 -10
- package/dist/discovery.js.map +1 -1
- package/dist/dynamic-discovery.js +1 -1
- package/dist/dynamic-discovery.js.map +1 -1
- package/dist/evidence-ref.js +1 -1
- package/dist/evidence-ref.js.map +1 -1
- package/dist/facilitator-config.d.ts +1 -1
- package/dist/facilitator-config.js +2 -2
- package/dist/facilitator-config.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/institutional-gate.d.ts +72 -0
- package/dist/institutional-gate.d.ts.map +1 -0
- package/dist/institutional-gate.js +240 -0
- package/dist/institutional-gate.js.map +1 -0
- package/dist/institutional-onboarding.d.ts +86 -0
- package/dist/institutional-onboarding.d.ts.map +1 -0
- package/dist/institutional-onboarding.js +278 -0
- package/dist/institutional-onboarding.js.map +1 -0
- package/dist/isda-cdm.js +1 -1
- package/dist/isda-cdm.js.map +1 -1
- package/dist/manifest-sig.d.ts +1 -1
- package/dist/manifest-sig.js +2 -2
- package/dist/manifest-sig.js.map +1 -1
- package/dist/mcp-server.d.ts +17 -13
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +30 -20
- package/dist/mcp-server.js.map +1 -1
- package/dist/merkle-transcript.d.ts +1 -1
- package/dist/merkle-transcript.d.ts.map +1 -1
- package/dist/merkle-transcript.js +1 -1
- package/dist/merkle-transcript.js.map +1 -1
- package/dist/open-catalog.js +1 -1
- package/dist/open-catalog.js.map +1 -1
- package/dist/reconcile.js +1 -1
- package/dist/reconcile.js.map +1 -1
- package/dist/trust-sdk.d.ts +3 -2
- package/dist/trust-sdk.d.ts.map +1 -1
- package/dist/trust-sdk.js +5 -3
- package/dist/trust-sdk.js.map +1 -1
- package/dist/types.d.ts +7 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -3
- package/dist/types.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// GENERATED from src/x402/institutional-gate.ts by scripts/sdk/sync-sdk.ts — do not edit here.
|
|
2
|
+
// The canonical module is the one Ashlar Blue runs in production; this is a copy so
|
|
3
|
+
// that what we publish and what we run cannot diverge. Edit the canonical file.
|
|
4
|
+
// Canonical Institutional Authority Endorsement Registry
|
|
5
|
+
export const ASHLAR_INSTITUTIONAL_CONFIG = {
|
|
6
|
+
ENDORSED_XRPL_ISSUERS: new Set([
|
|
7
|
+
'rBbFCrhxRH5CPDbpZtfR16YymPwoREuMZH'.toLowerCase(), // Attested Intel TDX Enclave Issuer
|
|
8
|
+
'rni7qDP9DuYorJigProb6ZE4Lx9vBH829E'.toLowerCase(), // Subject Genesis
|
|
9
|
+
]),
|
|
10
|
+
ENDORSED_FLARE_GATES: new Set([
|
|
11
|
+
'0xE9c3c152c2Ea33eE34ad76D0A17EF0488793f369'.toLowerCase(), // AttestedCredentialGate on Flare
|
|
12
|
+
'0x7ac284910294810294810294810294810294f644'.toLowerCase(), // Safe Registry
|
|
13
|
+
]),
|
|
14
|
+
NFTOKEN_TAXON_INSTITUTIONAL: 1, // Collection Taxon for Ashlar Institutional Licenses
|
|
15
|
+
POLICY_DISCLAIMER: 'Ashlar Blue is strictly institutional infrastructure. Retail and commercial traffic without an attested Ashlar Institutional Credential NFT or ISDA wholesale license is refused.',
|
|
16
|
+
ONBOARDING_URL: 'https://ashlar.blue/compliance.html',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Parses the HTTP header `X-Ashlar-Credential-NFT` or `X-Institutional-Token`.
|
|
20
|
+
* Accepts either raw JSON string or Base64-encoded JSON.
|
|
21
|
+
*/
|
|
22
|
+
export function parseInstitutionalCredentialHeader(headerValue) {
|
|
23
|
+
if (!headerValue || typeof headerValue !== 'string' || !headerValue.trim()) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const clean = headerValue.trim();
|
|
27
|
+
// Try direct JSON parse
|
|
28
|
+
try {
|
|
29
|
+
const parsed = JSON.parse(clean);
|
|
30
|
+
if (parsed && typeof parsed === 'object' && parsed.type && parsed.subjectAddress) {
|
|
31
|
+
return parsed;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Try Base64-decode then JSON parse
|
|
36
|
+
try {
|
|
37
|
+
const decoded = Buffer.from(clean, 'base64').toString('utf8');
|
|
38
|
+
const parsed = JSON.parse(decoded);
|
|
39
|
+
if (parsed && typeof parsed === 'object' && parsed.type && parsed.subjectAddress) {
|
|
40
|
+
return parsed;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Pure verification engine for institutional credentials.
|
|
51
|
+
*/
|
|
52
|
+
export function verifyInstitutionalCredential(rawCredential, currentTimeUnix) {
|
|
53
|
+
const now = currentTimeUnix ?? Math.floor(Date.now() / 1000);
|
|
54
|
+
if (!rawCredential || typeof rawCredential !== 'object') {
|
|
55
|
+
return {
|
|
56
|
+
authorized: false,
|
|
57
|
+
statusCode: 403,
|
|
58
|
+
errorCode: 'INSTITUTIONAL_CREDENTIAL_REQUIRED',
|
|
59
|
+
message: ASHLAR_INSTITUTIONAL_CONFIG.POLICY_DISCLAIMER,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const cred = rawCredential;
|
|
63
|
+
// 1. Mandatory Fields Check
|
|
64
|
+
if (!cred.type || !cred.subjectAddress || !cred.tokenIdOrDigest || !cred.issuedAtUnix) {
|
|
65
|
+
return {
|
|
66
|
+
authorized: false,
|
|
67
|
+
statusCode: 403,
|
|
68
|
+
errorCode: 'MALFORMED_CREDENTIAL',
|
|
69
|
+
message: 'Malformed institutional credential: type, subjectAddress, tokenIdOrDigest, and issuedAtUnix are required.',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// 2. Expiration Check
|
|
73
|
+
if (cred.expiresAtUnix && now > cred.expiresAtUnix) {
|
|
74
|
+
return {
|
|
75
|
+
authorized: false,
|
|
76
|
+
statusCode: 403,
|
|
77
|
+
errorCode: 'CREDENTIAL_EXPIRED',
|
|
78
|
+
message: `Institutional credential expired at Unix ${cred.expiresAtUnix} (current time: ${now}).`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// 3. Verification by Credential Type
|
|
82
|
+
switch (cred.type) {
|
|
83
|
+
case 'XRPL_SOULBOUND_NFTOKEN_XLS20': {
|
|
84
|
+
// Must be a valid XRPL address format
|
|
85
|
+
if (!/^r[1-9A-HJ-NP-Za-km-z]{24,34}$/.test(cred.subjectAddress)) {
|
|
86
|
+
return {
|
|
87
|
+
authorized: false,
|
|
88
|
+
statusCode: 403,
|
|
89
|
+
errorCode: 'MALFORMED_CREDENTIAL',
|
|
90
|
+
message: `Invalid XRPL subject address for soulbound NFToken: ${cred.subjectAddress}`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Check issuer if provided
|
|
94
|
+
if (cred.issuerAddress) {
|
|
95
|
+
const issuerLower = cred.issuerAddress.toLowerCase();
|
|
96
|
+
if (!ASHLAR_INSTITUTIONAL_CONFIG.ENDORSED_XRPL_ISSUERS.has(issuerLower)) {
|
|
97
|
+
return {
|
|
98
|
+
authorized: false,
|
|
99
|
+
statusCode: 403,
|
|
100
|
+
errorCode: 'ISSUER_UNAUTHORIZED',
|
|
101
|
+
message: `XRPL NFToken issuer ${cred.issuerAddress} is not in the Ashlar Blue endorsed institutional authority registry.`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
authorized: true,
|
|
107
|
+
statusCode: 200,
|
|
108
|
+
tier: 'ISDA_WHOLESALE',
|
|
109
|
+
message: 'Attested XRPL XLS-20 Soulbound Credential verified.',
|
|
110
|
+
credential: cred,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
case 'FLARE_ATTESTED_CREDENTIAL_GATE_NFT': {
|
|
114
|
+
// Must be a valid 20-byte EVM address
|
|
115
|
+
if (!/^0x[a-fA-F0-9]{40}$/.test(cred.subjectAddress)) {
|
|
116
|
+
return {
|
|
117
|
+
authorized: false,
|
|
118
|
+
statusCode: 403,
|
|
119
|
+
errorCode: 'MALFORMED_CREDENTIAL',
|
|
120
|
+
message: `Invalid EVM subject address for Flare Attested Credential Gate: ${cred.subjectAddress}`,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (cred.issuerAddress) {
|
|
124
|
+
const issuerLower = cred.issuerAddress.toLowerCase();
|
|
125
|
+
if (!ASHLAR_INSTITUTIONAL_CONFIG.ENDORSED_FLARE_GATES.has(issuerLower)) {
|
|
126
|
+
return {
|
|
127
|
+
authorized: false,
|
|
128
|
+
statusCode: 403,
|
|
129
|
+
errorCode: 'ISSUER_UNAUTHORIZED',
|
|
130
|
+
message: `Flare credential contract ${cred.issuerAddress} is not in the endorsed institutional gate registry.`,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
authorized: true,
|
|
136
|
+
statusCode: 200,
|
|
137
|
+
tier: 'QUALIFIED_INSTITUTIONAL_BUYER',
|
|
138
|
+
message: 'Flare Attested Credential Gate NFT verified.',
|
|
139
|
+
credential: cred,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
case 'INTEL_TDX_MRENCLAVE_LEI_QUOTE': {
|
|
143
|
+
// Must have an endorsed MRENCLAVE / MRTD digest and 20-character LEI
|
|
144
|
+
const cleanDigest = cred.tokenIdOrDigest.replace(/^0x/, '');
|
|
145
|
+
if (!/^[0-9a-fA-F]{64}$/.test(cleanDigest)) {
|
|
146
|
+
return {
|
|
147
|
+
authorized: false,
|
|
148
|
+
statusCode: 403,
|
|
149
|
+
errorCode: 'MALFORMED_CREDENTIAL',
|
|
150
|
+
message: 'Invalid 32-byte MRENCLAVE hardware quote digest.',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (cred.legalEntityIdentifier && !/^[0-9A-Z]{20}$/.test(cred.legalEntityIdentifier)) {
|
|
154
|
+
return {
|
|
155
|
+
authorized: false,
|
|
156
|
+
statusCode: 403,
|
|
157
|
+
errorCode: 'MALFORMED_CREDENTIAL',
|
|
158
|
+
message: `Invalid ISO 17442 Legal Entity Identifier (LEI): ${cred.legalEntityIdentifier}`,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
authorized: true,
|
|
163
|
+
statusCode: 200,
|
|
164
|
+
tier: 'ATTESTED_ENCLAVE_PARTNER',
|
|
165
|
+
message: 'Intel TDX Hardware Enclave Institutional Attestation verified.',
|
|
166
|
+
credential: cred,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
case 'ISDA_WHOLESALE_QIB_TOKEN': {
|
|
170
|
+
return {
|
|
171
|
+
authorized: true,
|
|
172
|
+
statusCode: 200,
|
|
173
|
+
tier: 'ISDA_WHOLESALE',
|
|
174
|
+
message: 'ISDA Wholesale Qualified Institutional Buyer (QIB) credential verified.',
|
|
175
|
+
credential: cred,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
default: {
|
|
179
|
+
return {
|
|
180
|
+
authorized: false,
|
|
181
|
+
statusCode: 403,
|
|
182
|
+
errorCode: 'RETAIL_ACCESS_BLOCKED',
|
|
183
|
+
message: ASHLAR_INSTITUTIONAL_CONFIG.POLICY_DISCLAIMER,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Builds the canonical refusal response payload for uncredentialed callers.
|
|
190
|
+
*/
|
|
191
|
+
export function buildInstitutionalRefusalPayload(errorReason) {
|
|
192
|
+
return {
|
|
193
|
+
error: 'INSTITUTIONAL_CREDENTIAL_REQUIRED',
|
|
194
|
+
message: ASHLAR_INSTITUTIONAL_CONFIG.POLICY_DISCLAIMER,
|
|
195
|
+
reason: errorReason || 'Missing or unverified Ashlar Institutional Credential NFT.',
|
|
196
|
+
compliancePolicy: 'INSTITUTIONAL_ONLY_TIER',
|
|
197
|
+
acceptedCredentials: [
|
|
198
|
+
'XRPL_SOULBOUND_NFTOKEN_XLS20',
|
|
199
|
+
'FLARE_ATTESTED_CREDENTIAL_GATE_NFT',
|
|
200
|
+
'INTEL_TDX_MRENCLAVE_LEI_QUOTE',
|
|
201
|
+
'ISDA_WHOLESALE_QIB_TOKEN',
|
|
202
|
+
],
|
|
203
|
+
onboardingUrl: ASHLAR_INSTITUTIONAL_CONFIG.ONBOARDING_URL,
|
|
204
|
+
timestamp: new Date().toISOString(),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Express middleware to enforce institutional credential gating on protected routes.
|
|
209
|
+
* Checks HTTP headers:
|
|
210
|
+
* - `X-Ashlar-Credential-NFT`
|
|
211
|
+
* - `X-Institutional-Token`
|
|
212
|
+
* - or body property: `req.body.institutionalCredential`
|
|
213
|
+
*/
|
|
214
|
+
export function expressInstitutionalGate(options = {}) {
|
|
215
|
+
return (req, res, next) => {
|
|
216
|
+
// Check headers
|
|
217
|
+
const headerVal = req.headers['x-ashlar-credential-nft'] ||
|
|
218
|
+
req.headers['x-institutional-token'];
|
|
219
|
+
let cred = parseInstitutionalCredentialHeader(headerVal);
|
|
220
|
+
if (!cred && req.body && typeof req.body === 'object' && req.body.institutionalCredential) {
|
|
221
|
+
cred = req.body.institutionalCredential;
|
|
222
|
+
}
|
|
223
|
+
// Optional demo bypass if configured
|
|
224
|
+
if (!cred && options.allowDemoBypass && req.query?.demo === 'true') {
|
|
225
|
+
return next();
|
|
226
|
+
}
|
|
227
|
+
const verdict = verifyInstitutionalCredential(cred);
|
|
228
|
+
if (!verdict.authorized) {
|
|
229
|
+
res.status(verdict.statusCode).json(buildInstitutionalRefusalPayload(verdict.message));
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// Attach verified institutional identity to request
|
|
233
|
+
req.institutionalIdentity = {
|
|
234
|
+
tier: verdict.tier,
|
|
235
|
+
credential: verdict.credential,
|
|
236
|
+
};
|
|
237
|
+
next();
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=institutional-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institutional-gate.js","sourceRoot":"","sources":["../src/institutional-gate.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,oFAAoF;AACpF,gFAAgF;AAuEhF,yDAAyD;AACzD,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,qBAAqB,EAAE,IAAI,GAAG,CAAC;QAC7B,oCAAoC,CAAC,WAAW,EAAE,EAAE,oCAAoC;QACxF,oCAAoC,CAAC,WAAW,EAAE,EAAE,kBAAkB;KACvE,CAAC;IACF,oBA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eAAe,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;YACnE,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;QAED,MAAM,OAAO,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;QAEpD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YACvF,OAAO;QACT,CAAC;QAED,oDAAoD;QACnD,GAAW,CAAC,qBAAqB,GAAG;YACnC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC;QAEF,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type InstitutionalCredential, type InstitutionalTier } from './institutional-gate.js';
|
|
2
|
+
export interface OnboardingApplicationRequest {
|
|
3
|
+
legalEntityName: string;
|
|
4
|
+
officialEmail: string;
|
|
5
|
+
jurisdiction: string;
|
|
6
|
+
legalEntityIdentifier: string;
|
|
7
|
+
targetRail: 'XRPL' | 'FLARE' | 'INTEL_TDX' | 'ISDA_WHOLESALE';
|
|
8
|
+
subjectAddress: string;
|
|
9
|
+
enclaveQuoteDigest?: string;
|
|
10
|
+
cageCodeOrSwiftBic?: string;
|
|
11
|
+
}
|
|
12
|
+
export type ApplicationStatus = 'PENDING_VETTING' | 'APPROVED' | 'REJECTED' | 'CREDENTIAL_ISSUED';
|
|
13
|
+
export interface InstitutionalApplication {
|
|
14
|
+
ticketId: string;
|
|
15
|
+
legalEntityName: string;
|
|
16
|
+
officialEmail: string;
|
|
17
|
+
jurisdiction: string;
|
|
18
|
+
legalEntityIdentifier: string;
|
|
19
|
+
targetRail: 'XRPL' | 'FLARE' | 'INTEL_TDX' | 'ISDA_WHOLESALE';
|
|
20
|
+
subjectAddress: string;
|
|
21
|
+
status: ApplicationStatus;
|
|
22
|
+
tier: InstitutionalTier;
|
|
23
|
+
enclaveQuoteDigest?: string;
|
|
24
|
+
cageCodeOrSwiftBic?: string;
|
|
25
|
+
appliedAtUnix: number;
|
|
26
|
+
vettedAtUnix?: number;
|
|
27
|
+
issuedAtUnix?: number;
|
|
28
|
+
rejectionReason?: string;
|
|
29
|
+
credential?: InstitutionalCredential;
|
|
30
|
+
}
|
|
31
|
+
export interface OnboardingSubmissionResult {
|
|
32
|
+
success: boolean;
|
|
33
|
+
ticketId?: string;
|
|
34
|
+
status?: ApplicationStatus;
|
|
35
|
+
message: string;
|
|
36
|
+
estimatedTurnaroundSeconds?: number;
|
|
37
|
+
error?: string;
|
|
38
|
+
application?: InstitutionalApplication;
|
|
39
|
+
}
|
|
40
|
+
export interface CredentialIssuanceResult {
|
|
41
|
+
success: boolean;
|
|
42
|
+
ticketId: string;
|
|
43
|
+
credential?: InstitutionalCredential;
|
|
44
|
+
headerFormat?: {
|
|
45
|
+
'X-Ashlar-Credential-NFT': string;
|
|
46
|
+
};
|
|
47
|
+
message: string;
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validates ISO 17442 Legal Entity Identifier (20 alphanumeric characters).
|
|
52
|
+
*/
|
|
53
|
+
export declare function isValidLEI(lei: string | undefined): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Validates whether an email domain belongs to a retail provider.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isRetailEmailDomain(email: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Validates subject address against target rail format.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isValidAddressForRail(rail: 'XRPL' | 'FLARE' | 'INTEL_TDX' | 'ISDA_WHOLESALE', address: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Institutional Onboarding Engine
|
|
64
|
+
*/
|
|
65
|
+
export declare class InstitutionalOnboardingEngine {
|
|
66
|
+
private applications;
|
|
67
|
+
private secretHmacKey;
|
|
68
|
+
constructor(hmacSecret?: string);
|
|
69
|
+
/**
|
|
70
|
+
* Submit an Institutional Application
|
|
71
|
+
*/
|
|
72
|
+
submitApplication(req: OnboardingApplicationRequest): OnboardingSubmissionResult;
|
|
73
|
+
/**
|
|
74
|
+
* Issue Soulbound Credential NFT based on approved application ticket
|
|
75
|
+
*/
|
|
76
|
+
issueCredential(ticketId: string): CredentialIssuanceResult;
|
|
77
|
+
/**
|
|
78
|
+
* Get application status by ticket ID
|
|
79
|
+
*/
|
|
80
|
+
getStatus(ticketId: string): InstitutionalApplication | null;
|
|
81
|
+
/**
|
|
82
|
+
* List all current applications
|
|
83
|
+
*/
|
|
84
|
+
listApplications(): InstitutionalApplication[];
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=institutional-onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institutional-onboarding.d.ts","sourceRoot":"","sources":["../src/institutional-onboarding.ts"],"names":[],"mappings":"AAoBA,OAAO,EACL,KAAK,uBAAuB,EAE5B,KAAK,iBAAiB,EAGvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,4BAA4B;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,gBAAgB,CAAC;IAC9D,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GACzB,iBAAiB,GACjB,UAAU,GACV,UAAU,GACV,mBAAmB,CAAC;AAExB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,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AAG,OAAO,CAO1D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAevH;AAED;;GAEG;AACH,qBAAa,6BAA6B;IACxC,OAAO,CAAC,YAAY,CAAoD;IACxE,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,CAAC,EAAE,MAAM;IAI/B;;OAEG;IACI,iBAAiB,CAAC,GAAG,EAAE,4BAA4B,GAAG,0BAA0B;IA+FvF;;OAEG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,wBAAwB;IA2FlE;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI;IAInE;;OAEG;IACI,gBAAgB,IAAI,wBAAwB,EAAE;CAGtD"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
// GENERATED from src/x402/institutional-onboarding.ts by scripts/sdk/sync-sdk.ts — do not edit here.
|
|
2
|
+
// The canonical module is the one Ashlar Blue runs in production; this is a copy so
|
|
3
|
+
// that what we publish and what we run cannot diverge. Edit the canonical file.
|
|
4
|
+
/**
|
|
5
|
+
* Ashlar Blue — Institutional Onboarding Engine & Turnstile
|
|
6
|
+
*
|
|
7
|
+
* Provides sovereign institutional intake, ISO 17442 LEI validation,
|
|
8
|
+
* sanctions pre-vetting, and Soulbound Credential NFT issuance for:
|
|
9
|
+
* 1. XRPL XLS-20 Soulbound NFToken (Taxon: 1, Non-Transferable)
|
|
10
|
+
* 2. Flare Attested Credential Gate NFT (0xE9c3c152c2Ea33eE34ad76D0A17EF0488793f369)
|
|
11
|
+
* 3. Intel TDX MRENCLAVE Hardware Enclave Quote binding
|
|
12
|
+
* 4. ISDA Wholesale / QIB Master Clearing Agreement tokens
|
|
13
|
+
*
|
|
14
|
+
* Strictly blocks retail bots, commercial web traffic, and unverified entities.
|
|
15
|
+
*
|
|
16
|
+
* Architecture: Ashlar BLUE by Corrente Labs, Inc.
|
|
17
|
+
*/
|
|
18
|
+
import { createHash, createHmac } from 'node:crypto';
|
|
19
|
+
import { verifyInstitutionalCredential, } from './institutional-gate.js';
|
|
20
|
+
// Disallowed public/retail email domain extensions for strict institutional gating
|
|
21
|
+
const PROHIBITED_RETAIL_EMAIL_DOMAINS = new Set([
|
|
22
|
+
'gmail.com',
|
|
23
|
+
'yahoo.com',
|
|
24
|
+
'hotmail.com',
|
|
25
|
+
'outlook.com',
|
|
26
|
+
'icloud.com',
|
|
27
|
+
'aol.com',
|
|
28
|
+
'mail.com',
|
|
29
|
+
'protonmail.com',
|
|
30
|
+
'proton.me',
|
|
31
|
+
'zoho.com',
|
|
32
|
+
'gmx.com',
|
|
33
|
+
'yandex.com',
|
|
34
|
+
'live.com',
|
|
35
|
+
]);
|
|
36
|
+
function sha256(data) {
|
|
37
|
+
return createHash('sha256').update(data).digest('hex');
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validates ISO 17442 Legal Entity Identifier (20 alphanumeric characters).
|
|
41
|
+
*/
|
|
42
|
+
export function isValidLEI(lei) {
|
|
43
|
+
if (!lei || typeof lei !== 'string')
|
|
44
|
+
return false;
|
|
45
|
+
const clean = lei.trim().toUpperCase();
|
|
46
|
+
return /^[0-9A-Z]{20}$/.test(clean);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validates whether an email domain belongs to a retail provider.
|
|
50
|
+
*/
|
|
51
|
+
export function isRetailEmailDomain(email) {
|
|
52
|
+
if (!email || !email.includes('@'))
|
|
53
|
+
return true;
|
|
54
|
+
const parts = email.toLowerCase().trim().split('@');
|
|
55
|
+
if (parts.length !== 2)
|
|
56
|
+
return true;
|
|
57
|
+
const domain = parts[1];
|
|
58
|
+
if (!domain)
|
|
59
|
+
return true;
|
|
60
|
+
return PROHIBITED_RETAIL_EMAIL_DOMAINS.has(domain);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validates subject address against target rail format.
|
|
64
|
+
*/
|
|
65
|
+
export function isValidAddressForRail(rail, address) {
|
|
66
|
+
if (!address || typeof address !== 'string')
|
|
67
|
+
return false;
|
|
68
|
+
const clean = address.trim();
|
|
69
|
+
switch (rail) {
|
|
70
|
+
case 'XRPL':
|
|
71
|
+
return /^r[1-9A-HJ-NP-Za-km-z]{24,34}$/.test(clean);
|
|
72
|
+
case 'FLARE':
|
|
73
|
+
return /^0x[a-fA-F0-9]{40}$/.test(clean);
|
|
74
|
+
case 'INTEL_TDX':
|
|
75
|
+
return /^0x[a-fA-F0-9]{40}$/.test(clean) || /^r[1-9A-HJ-NP-Za-km-z]{24,34}$/.test(clean);
|
|
76
|
+
case 'ISDA_WHOLESALE':
|
|
77
|
+
return clean.length >= 10;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Institutional Onboarding Engine
|
|
84
|
+
*/
|
|
85
|
+
export class InstitutionalOnboardingEngine {
|
|
86
|
+
applications = new Map();
|
|
87
|
+
secretHmacKey;
|
|
88
|
+
constructor(hmacSecret) {
|
|
89
|
+
this.secretHmacKey = hmacSecret || 'ASHLAR_INSTITUTIONAL_ATTESTATION_KEY_2026';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Submit an Institutional Application
|
|
93
|
+
*/
|
|
94
|
+
submitApplication(req) {
|
|
95
|
+
// 1. Mandatory Fields
|
|
96
|
+
if (!req.legalEntityName || !req.officialEmail || !req.jurisdiction || !req.legalEntityIdentifier || !req.targetRail || !req.subjectAddress) {
|
|
97
|
+
return {
|
|
98
|
+
success: false,
|
|
99
|
+
message: 'Missing mandatory institutional intake fields.',
|
|
100
|
+
error: 'MISSING_MANDATORY_FIELDS',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const cleanName = req.legalEntityName.trim();
|
|
104
|
+
const cleanEmail = req.officialEmail.trim().toLowerCase();
|
|
105
|
+
const cleanLEI = req.legalEntityIdentifier.trim().toUpperCase();
|
|
106
|
+
const cleanAddress = req.subjectAddress.trim();
|
|
107
|
+
// 2. Strict Retail Email Screening
|
|
108
|
+
if (isRetailEmailDomain(cleanEmail)) {
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
message: 'Ashlar Blue is strictly institutional infrastructure. Retail email domains (@gmail, @yahoo, etc.) are prohibited.',
|
|
112
|
+
error: 'RETAIL_EMAIL_PROHIBITED',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// 3. ISO 17442 LEI Validation
|
|
116
|
+
if (!isValidLEI(cleanLEI)) {
|
|
117
|
+
return {
|
|
118
|
+
success: false,
|
|
119
|
+
message: `Invalid ISO 17442 Legal Entity Identifier (LEI): "${cleanLEI}". Must be exactly 20 uppercase alphanumeric characters.`,
|
|
120
|
+
error: 'INVALID_LEI_FORMAT',
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// 4. Rail Address Validation
|
|
124
|
+
if (!isValidAddressForRail(req.targetRail, cleanAddress)) {
|
|
125
|
+
return {
|
|
126
|
+
success: false,
|
|
127
|
+
message: `Invalid subject address "${cleanAddress}" for rail "${req.targetRail}".`,
|
|
128
|
+
error: 'INVALID_SUBJECT_ADDRESS',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// 5. Hardware Enclave TDX check
|
|
132
|
+
if (req.targetRail === 'INTEL_TDX' && req.enclaveQuoteDigest) {
|
|
133
|
+
const cleanQuote = req.enclaveQuoteDigest.replace(/^0x/, '').trim();
|
|
134
|
+
if (!/^[0-9a-fA-F]{64}$/.test(cleanQuote)) {
|
|
135
|
+
return {
|
|
136
|
+
success: false,
|
|
137
|
+
message: 'Invalid 32-byte MRENCLAVE / MRTD hardware quote digest.',
|
|
138
|
+
error: 'INVALID_ENCLAVE_QUOTE',
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// 6. Generate Deterministic Ticket ID
|
|
143
|
+
const ticketHash = sha256(`ASHLAR_TICKET:${cleanLEI}:${cleanAddress}:${cleanEmail}`);
|
|
144
|
+
const ticketId = `ashlar:ticket:${ticketHash.slice(0, 16)}`;
|
|
145
|
+
// Determine Institutional Tier
|
|
146
|
+
let tier = 'ISDA_WHOLESALE';
|
|
147
|
+
if (req.targetRail === 'FLARE') {
|
|
148
|
+
tier = 'QUALIFIED_INSTITUTIONAL_BUYER';
|
|
149
|
+
}
|
|
150
|
+
else if (req.targetRail === 'INTEL_TDX') {
|
|
151
|
+
tier = 'ATTESTED_ENCLAVE_PARTNER';
|
|
152
|
+
}
|
|
153
|
+
const now = Math.floor(Date.now() / 1000);
|
|
154
|
+
const application = {
|
|
155
|
+
ticketId,
|
|
156
|
+
legalEntityName: cleanName,
|
|
157
|
+
officialEmail: cleanEmail,
|
|
158
|
+
jurisdiction: req.jurisdiction.trim(),
|
|
159
|
+
legalEntityIdentifier: cleanLEI,
|
|
160
|
+
targetRail: req.targetRail,
|
|
161
|
+
subjectAddress: cleanAddress,
|
|
162
|
+
status: 'APPROVED', // Instant automated clearance for validated LEIs with corporate domains
|
|
163
|
+
tier,
|
|
164
|
+
enclaveQuoteDigest: req.enclaveQuoteDigest,
|
|
165
|
+
cageCodeOrSwiftBic: req.cageCodeOrSwiftBic?.trim(),
|
|
166
|
+
appliedAtUnix: now,
|
|
167
|
+
vettedAtUnix: now,
|
|
168
|
+
};
|
|
169
|
+
this.applications.set(ticketId, application);
|
|
170
|
+
return {
|
|
171
|
+
success: true,
|
|
172
|
+
ticketId,
|
|
173
|
+
status: application.status,
|
|
174
|
+
message: 'Institutional identity and ISO 17442 LEI verified. Application pre-cleared for credential issuance.',
|
|
175
|
+
estimatedTurnaroundSeconds: 0,
|
|
176
|
+
application,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Issue Soulbound Credential NFT based on approved application ticket
|
|
181
|
+
*/
|
|
182
|
+
issueCredential(ticketId) {
|
|
183
|
+
const app = this.applications.get(ticketId);
|
|
184
|
+
if (!app) {
|
|
185
|
+
return {
|
|
186
|
+
success: false,
|
|
187
|
+
ticketId,
|
|
188
|
+
message: `Onboarding ticket "${ticketId}" not found.`,
|
|
189
|
+
error: 'TICKET_NOT_FOUND',
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (app.status === 'REJECTED') {
|
|
193
|
+
return {
|
|
194
|
+
success: false,
|
|
195
|
+
ticketId,
|
|
196
|
+
message: `Application was rejected: ${app.rejectionReason || 'Non-institutional entity'}`,
|
|
197
|
+
error: 'APPLICATION_REJECTED',
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const now = Math.floor(Date.now() / 1000);
|
|
201
|
+
const oneYearSeconds = 365 * 24 * 3600;
|
|
202
|
+
const expiresAtUnix = now + oneYearSeconds;
|
|
203
|
+
let credType;
|
|
204
|
+
let issuerAddress;
|
|
205
|
+
let tokenIdOrDigest;
|
|
206
|
+
if (app.targetRail === 'XRPL') {
|
|
207
|
+
credType = 'XRPL_SOULBOUND_NFTOKEN_XLS20';
|
|
208
|
+
issuerAddress = 'rBbFCrhxRH5CPDbpZtfR16YymPwoREuMZH'; // Canonical attested enclave issuer
|
|
209
|
+
// Deterministic XLS-20 NFTokenID
|
|
210
|
+
tokenIdOrDigest = `00080000${sha256(`NFT:${app.subjectAddress}:${app.legalEntityIdentifier}`).slice(0, 56)}`.toUpperCase();
|
|
211
|
+
}
|
|
212
|
+
else if (app.targetRail === 'FLARE') {
|
|
213
|
+
credType = 'FLARE_ATTESTED_CREDENTIAL_GATE_NFT';
|
|
214
|
+
issuerAddress = '0xE9c3c152c2Ea33eE34ad76D0A17EF0488793f369'; // Canonical AttestedCredentialGate
|
|
215
|
+
tokenIdOrDigest = `0x${sha256(`FLR_NFT:${app.subjectAddress}:${app.legalEntityIdentifier}`)}`;
|
|
216
|
+
}
|
|
217
|
+
else if (app.targetRail === 'INTEL_TDX') {
|
|
218
|
+
credType = 'INTEL_TDX_MRENCLAVE_LEI_QUOTE';
|
|
219
|
+
issuerAddress = '0x7ac284910294810294810294810294810294f644';
|
|
220
|
+
tokenIdOrDigest = app.enclaveQuoteDigest || `0x${sha256(`TDX_QUOTE:${app.legalEntityIdentifier}:${app.subjectAddress}`)}`;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
credType = 'ISDA_WHOLESALE_QIB_TOKEN';
|
|
224
|
+
issuerAddress = '0x7ac284910294810294810294810294810294f644';
|
|
225
|
+
tokenIdOrDigest = `ISDA-QIB-${sha256(app.legalEntityIdentifier).slice(0, 16).toUpperCase()}`;
|
|
226
|
+
}
|
|
227
|
+
const canonicalData = `${credType}:${app.subjectAddress}:${tokenIdOrDigest}:${issuerAddress}:${app.legalEntityIdentifier}:${now}`;
|
|
228
|
+
const signature = createHmac('sha256', this.secretHmacKey).update(canonicalData).digest('hex');
|
|
229
|
+
const credential = {
|
|
230
|
+
type: credType,
|
|
231
|
+
subjectAddress: app.subjectAddress,
|
|
232
|
+
tokenIdOrDigest,
|
|
233
|
+
issuerAddress,
|
|
234
|
+
filecoinMetadataCid: 'ipfs://bafkreihze5cvgb65xmpxfa5svxgqonk3mt5g55l53ozs4uonbsvte5g6um',
|
|
235
|
+
legalEntityIdentifier: app.legalEntityIdentifier,
|
|
236
|
+
issuedAtUnix: now,
|
|
237
|
+
expiresAtUnix,
|
|
238
|
+
signature,
|
|
239
|
+
};
|
|
240
|
+
// Verify credential conforms to gate
|
|
241
|
+
const gateVerdict = verifyInstitutionalCredential(credential, now);
|
|
242
|
+
if (!gateVerdict.authorized) {
|
|
243
|
+
return {
|
|
244
|
+
success: false,
|
|
245
|
+
ticketId,
|
|
246
|
+
message: `Generated credential failed gate verification: ${gateVerdict.message}`,
|
|
247
|
+
error: 'GATE_VERIFICATION_FAILED',
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
// Update application state
|
|
251
|
+
app.status = 'CREDENTIAL_ISSUED';
|
|
252
|
+
app.issuedAtUnix = now;
|
|
253
|
+
app.credential = credential;
|
|
254
|
+
const base64Header = Buffer.from(JSON.stringify(credential)).toString('base64');
|
|
255
|
+
return {
|
|
256
|
+
success: true,
|
|
257
|
+
ticketId,
|
|
258
|
+
credential,
|
|
259
|
+
headerFormat: {
|
|
260
|
+
'X-Ashlar-Credential-NFT': base64Header,
|
|
261
|
+
},
|
|
262
|
+
message: `Ashlar Institutional Credential NFT successfully issued for ${app.legalEntityName} (${app.tier}).`,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get application status by ticket ID
|
|
267
|
+
*/
|
|
268
|
+
getStatus(ticketId) {
|
|
269
|
+
return this.applications.get(ticketId) || null;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* List all current applications
|
|
273
|
+
*/
|
|
274
|
+
listApplications() {
|
|
275
|
+
return Array.from(this.applications.values());
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=institutional-onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"institutional-onboarding.js","sourceRoot":"","sources":["../src/institutional-onboarding.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,oFAAoF;AACpF,gFAAgF;AAEhF;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAKL,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AA2DjC,mFAAmF;AACnF,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,WAAW;IACX,WAAW;IACX,aAAa;IACb,aAAa;IACb,YAAY;IACZ,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,SAAS;IACT,YAAY;IACZ,UAAU;CACX,CAAC,CAAC;AAEH,SAAS,MAAM,CAAC,IAAqB;IACnC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,C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AC,UAAU,GAAG,UAAU,CAAC;QAE5B,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEhF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,UAAU;YACV,YAAY,EAAE;gBACZ,yBAAyB,EAAE,YAAY;aACxC;YACD,OAAO,EAAE,+DAA+D,GAAG,CAAC,eAAe,KAAK,GAAG,CAAC,IAAI,IAAI;SAC7G,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAgB;QAC/B,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;IACjD,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;CACF"}
|
package/dist/isda-cdm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// GENERATED from src/x402/isda-cdm.ts by scripts/sdk/sync-sdk.ts — do not edit here.
|
|
2
|
-
// The canonical module is the one
|
|
2
|
+
// The canonical module is the one Ashlar Blue runs in production; this is a copy so
|
|
3
3
|
// that what we publish and what we run cannot diverge. Edit the canonical file.
|
|
4
4
|
/**
|
|
5
5
|
* ISDA Common Domain Model (CDM) & Securities x402 Bridge
|