@bsv/vsc 0.2.0-beta.1
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 +58 -0
- package/README.md +107 -0
- package/artifacts/context-0.1.0.jsonld +127 -0
- package/artifacts/disclosure-0.1.0.schema.json +526 -0
- package/artifacts/epcis/NOTICE.md +11 -0
- package/artifacts/epcis/epcis-context-2.0.1.jsonld +593 -0
- package/artifacts/epcis/epcis-json-schema-2.0.1.json +2352 -0
- package/artifacts/epcis/query-schema-2.0.1.json +968 -0
- package/artifacts/external/NOTICE.md +3 -0
- package/artifacts/external/dpp-external-passport-1.context.jsonld +8 -0
- package/artifacts/external/dpp-external-passport-1.schema.json +158 -0
- package/artifacts/profile-0.1.0.json +100 -0
- package/artifacts/seal-0.1.0.schema.json +535 -0
- package/artifacts/w3c/NOTICE.md +3 -0
- package/artifacts/w3c/credentials-v2.jsonld +340 -0
- package/dist/context.d.ts +9 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +50 -0
- package/dist/context.js.map +1 -0
- package/dist/crypto.d.ts +50 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +141 -0
- package/dist/crypto.js.map +1 -0
- package/dist/did-web.d.ts +9 -0
- package/dist/did-web.d.ts.map +1 -0
- package/dist/did-web.js +66 -0
- package/dist/did-web.js.map +1 -0
- package/dist/epcis-source.d.ts +251 -0
- package/dist/epcis-source.d.ts.map +1 -0
- package/dist/epcis-source.js +573 -0
- package/dist/epcis-source.js.map +1 -0
- package/dist/epcis.d.ts +51 -0
- package/dist/epcis.d.ts.map +1 -0
- package/dist/epcis.js +171 -0
- package/dist/epcis.js.map +1 -0
- package/dist/exchange.d.ts +175 -0
- package/dist/exchange.d.ts.map +1 -0
- package/dist/exchange.js +491 -0
- package/dist/exchange.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/jcs.d.ts +25 -0
- package/dist/jcs.d.ts.map +1 -0
- package/dist/jcs.js +67 -0
- package/dist/jcs.js.map +1 -0
- package/dist/schema.d.ts +414 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +537 -0
- package/dist/schema.js.map +1 -0
- package/dist/types.d.ts +159 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +22 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +147 -0
- package/dist/validation.js.map +1 -0
- package/dist/verification.d.ts +10 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +350 -0
- package/dist/verification.js.map +1 -0
- package/package.json +68 -0
package/dist/epcis.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { JsonObject, Seal, StatusEntry } from './types.js';
|
|
2
|
+
import { type EpcisSourceReference, type EpcisValidationFindings } from './epcis-source.js';
|
|
3
|
+
export declare const EPCIS_VOCABULARY = "urn:bsv:vsc:vocab:epcis-roundtrip:0.1.0";
|
|
4
|
+
export declare const EPCIS_TYPES: readonly ["ObjectEvent", "AggregationEvent", "TransformationEvent", "TransactionEvent", "AssociationEvent"];
|
|
5
|
+
export interface EpcisMappingOptions {
|
|
6
|
+
id?: string;
|
|
7
|
+
issuer: string;
|
|
8
|
+
assertionMethod: string;
|
|
9
|
+
actorRole: string;
|
|
10
|
+
jurisdiction: string;
|
|
11
|
+
issuedAt: string;
|
|
12
|
+
recordedAt?: string;
|
|
13
|
+
validUntil?: string;
|
|
14
|
+
credentialStatus: StatusEntry;
|
|
15
|
+
chainOfCustody: Seal['chainOfCustody'];
|
|
16
|
+
/** EPCIS TransformationEvent has no action. Its VSC action requires an explicit mapping decision. */
|
|
17
|
+
transformationAction?: 'ADD' | 'OBSERVE' | 'DELETE';
|
|
18
|
+
}
|
|
19
|
+
/** Retains the complete source event in a signed JSON extension, allowing lossless round trips. */
|
|
20
|
+
export declare function mapEpcisEvent(event: JsonObject, options: EpcisMappingOptions): Seal;
|
|
21
|
+
/** Extraction preserves source data; callers must verify the credential before trusting it. */
|
|
22
|
+
export declare function extractEpcisEvent(seal: Seal): JsonObject;
|
|
23
|
+
export type EpcisMappingOutcome = 'lossless' | 'transformed' | 'unsupported' | 'insufficient-data';
|
|
24
|
+
export interface EpcisMappingReport {
|
|
25
|
+
/** lossless: every source semantic the profile knows is carried; transformed: carried with the named losses; unsupported: the profile cannot express the event or a decision is missing; insufficient-data: the source lacks a required input that is never fabricated. */
|
|
26
|
+
mapping: EpcisMappingOutcome;
|
|
27
|
+
/** The unsigned SEAL, present for lossless and transformed only. */
|
|
28
|
+
seal?: Seal;
|
|
29
|
+
/** What the source lacks (insufficient-data) or what decision or feature is missing (unsupported). */
|
|
30
|
+
missing: string[];
|
|
31
|
+
/** Source semantics the SEAL's event vector does not carry and only the round-trip extension retains. */
|
|
32
|
+
unmapped: string[];
|
|
33
|
+
/** Source members retained in the signed round-trip extension. */
|
|
34
|
+
preserved: string[];
|
|
35
|
+
validation?: EpcisValidationFindings;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The explicit outcome of mapping one EPCIS event into the VSC profile.
|
|
39
|
+
* Wraps `mapEpcisEvent` without changing it: a refusal becomes a named
|
|
40
|
+
* outcome rather than an exception, a success is `lossless` only when the
|
|
41
|
+
* event carries nothing the profile cannot express, and a supplied source
|
|
42
|
+
* reference is signed into the SEAL beside the round-trip extension so the
|
|
43
|
+
* credential names the exact bytes and pointer it was mapped from. The SEAL
|
|
44
|
+
* is unsigned and unpublished: issuance is a separate, separately authorised
|
|
45
|
+
* step that also requires issuer, status and custody evidence.
|
|
46
|
+
*/
|
|
47
|
+
export declare function mapEpcisEventWithReport(event: JsonObject, options: EpcisMappingOptions, report?: {
|
|
48
|
+
sourceReference?: EpcisSourceReference;
|
|
49
|
+
validation?: EpcisValidationFindings;
|
|
50
|
+
}): EpcisMappingReport;
|
|
51
|
+
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G;IACtG,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yGAAyG;IACzG,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kEAAkE;IAClE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC;AA+CD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,GAAE;IAAE,eAAe,CAAC,EAAE,oBAAoB,CAAC;IAAC,UAAU,CAAC,EAAE,uBAAuB,CAAA;CAAO,GAAG,kBAAkB,CAyB1M"}
|
package/dist/epcis.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { SEAL_CONTEXTS } from './context.js';
|
|
3
|
+
import { validateSealStructure } from './validation.js';
|
|
4
|
+
import { EPCIS_SOURCE_VOCABULARY } from './epcis-source.js';
|
|
5
|
+
export const EPCIS_VOCABULARY = 'urn:bsv:vsc:vocab:epcis-roundtrip:0.1.0';
|
|
6
|
+
export const EPCIS_TYPES = ['ObjectEvent', 'AggregationEvent', 'TransformationEvent', 'TransactionEvent', 'AssociationEvent'];
|
|
7
|
+
/** Retains the complete source event in a signed JSON extension, allowing lossless round trips. */
|
|
8
|
+
export function mapEpcisEvent(event, options) {
|
|
9
|
+
if (typeof event.type !== 'string' || !EPCIS_TYPES.includes(event.type))
|
|
10
|
+
throw new Error('Unsupported EPCIS event type');
|
|
11
|
+
const identifiers = [];
|
|
12
|
+
const add = (value) => {
|
|
13
|
+
if (typeof value !== 'string' || !/^(urn:epc:|https:\/\/)/.test(value))
|
|
14
|
+
throw new Error('Product identifier requires a supported EPCIS URI');
|
|
15
|
+
if (!identifiers.some(p => p.value === value))
|
|
16
|
+
identifiers.push({ scheme: 'EPC', value, schemeAuthority: 'GS1' });
|
|
17
|
+
};
|
|
18
|
+
const idFields = event.type === 'TransformationEvent' ? ['inputEPCList', 'outputEPCList'] : event.type === 'AggregationEvent' || event.type === 'AssociationEvent' ? ['childEPCs'] : ['epcList'];
|
|
19
|
+
for (const field of idFields) {
|
|
20
|
+
if (event[field] !== undefined && !Array.isArray(event[field]))
|
|
21
|
+
throw new Error(`Invalid ${field}`);
|
|
22
|
+
for (const value of event[field] ?? [])
|
|
23
|
+
add(value);
|
|
24
|
+
}
|
|
25
|
+
if (event.parentID !== undefined)
|
|
26
|
+
add(event.parentID);
|
|
27
|
+
for (const field of ['quantityList', 'inputQuantityList', 'outputQuantityList', 'childQuantityList']) {
|
|
28
|
+
if (event[field] !== undefined && !Array.isArray(event[field]))
|
|
29
|
+
throw new Error(`Invalid ${field}`);
|
|
30
|
+
for (const item of event[field] ?? []) {
|
|
31
|
+
if (!item || typeof item !== 'object' || typeof item.quantity !== 'number' || !Number.isFinite(item.quantity) || item.quantity < 0)
|
|
32
|
+
throw new Error(`Invalid ${field} quantity`);
|
|
33
|
+
add(item.epcClass);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!identifiers.length)
|
|
37
|
+
throw new Error('Insufficient product identifiers for VSC mapping');
|
|
38
|
+
const disposition = typeof event.disposition === 'string' ? event.disposition.replace(/^urn:epcglobal:cbv:disp:|^https:\/\/ref\.gs1\.org\/cbv\/Disp-/, '') : undefined;
|
|
39
|
+
if (typeof event.eventTime !== 'string' || typeof event.eventTimeZoneOffset !== 'string' || typeof event.bizStep !== 'string' || !disposition)
|
|
40
|
+
throw new Error('Event time, timezone, business step and disposition are required; they are never fabricated');
|
|
41
|
+
const action = event.type === 'TransformationEvent' ? options.transformationAction : event.action;
|
|
42
|
+
if (!['ADD', 'OBSERVE', 'DELETE'].includes(action))
|
|
43
|
+
throw new Error('An explicit supported action mapping is required');
|
|
44
|
+
const recordedAt = event.recordTime ?? options.recordedAt;
|
|
45
|
+
if (typeof recordedAt !== 'string')
|
|
46
|
+
throw new Error('Recorded time is required');
|
|
47
|
+
const id = options.id ?? `urn:uuid:${randomUUID()}`;
|
|
48
|
+
const seal = {
|
|
49
|
+
'@context': [...SEAL_CONTEXTS], type: ['VerifiableCredential', 'VSC-SEAL'], id,
|
|
50
|
+
issuer: options.issuer, issuanceDate: options.issuedAt, validFrom: options.issuedAt,
|
|
51
|
+
...(options.validUntil ? { validUntil: options.validUntil } : {}), sealVersion: '1.0', sealTimestamp: options.issuedAt, correctionOf: null,
|
|
52
|
+
credentialSubject: { id, ...(options.chainOfCustody.parentSeals.length ? { predecessorCredentials: [...options.chainOfCustody.parentSeals] } : {}) },
|
|
53
|
+
credentialStatus: structuredClone(options.credentialStatus),
|
|
54
|
+
eventVector: {
|
|
55
|
+
what: { productIdentifiers: identifiers },
|
|
56
|
+
when: { eventTime: event.eventTime, recordedAt, timezone: event.eventTimeZoneOffset, timePrecision: /\.\d+/.test(event.eventTime) ? 'millisecond' : 'second' },
|
|
57
|
+
where: { jurisdiction: options.jurisdiction, ...(event.readPoint ? { readPoint: structuredClone(event.readPoint) } : {}), ...(event.bizLocation ? { businessLocation: structuredClone(event.bizLocation) } : {}) },
|
|
58
|
+
who: { actorDid: options.issuer, actorRole: options.actorRole, assertionMethod: options.assertionMethod },
|
|
59
|
+
how: { eventType: event.type, eventTypeVocab: 'urn:epcis:cbv:v2', businessStep: event.bizStep, disposition, action: action },
|
|
60
|
+
},
|
|
61
|
+
extensions: { '+Dn': { '+D1': { vocabularyUrn: EPCIS_VOCABULARY, event: structuredClone(event) } } },
|
|
62
|
+
chainOfCustody: structuredClone(options.chainOfCustody),
|
|
63
|
+
};
|
|
64
|
+
const result = validateSealStructure(seal, { requireProof: false });
|
|
65
|
+
if (!result.valid)
|
|
66
|
+
throw new Error(result.errors.map(e => `${e.path}: ${e.message}`).join('; '));
|
|
67
|
+
return seal;
|
|
68
|
+
}
|
|
69
|
+
/** Extraction preserves source data; callers must verify the credential before trusting it. */
|
|
70
|
+
export function extractEpcisEvent(seal) {
|
|
71
|
+
const source = Object.values(seal.extensions['+Dn']).find(v => v.vocabularyUrn === EPCIS_VOCABULARY);
|
|
72
|
+
if (!source || !source.event || typeof source.event !== 'object' || Array.isArray(source.event))
|
|
73
|
+
throw new Error('No supported EPCIS round-trip mapping');
|
|
74
|
+
return structuredClone(source.event);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Members whose meaning the VSC profile does not carry in its event vector:
|
|
78
|
+
* present in the round-trip extension, absent from any custody or event
|
|
79
|
+
* semantics a verifier evaluates. Each name matches an epcis-vsc@1
|
|
80
|
+
* mappingLimits entry so a result can cite it.
|
|
81
|
+
*/
|
|
82
|
+
const TRANSFORMED_MEMBERS = {
|
|
83
|
+
sensorElementList: 'sensor-elements',
|
|
84
|
+
sourceList: 'source-destination-parties',
|
|
85
|
+
destinationList: 'source-destination-parties',
|
|
86
|
+
bizTransactionList: 'business-transactions',
|
|
87
|
+
persistentDisposition: 'persistent-disposition',
|
|
88
|
+
ilmd: 'instance-lot-master-data',
|
|
89
|
+
certificationInfo: 'certification-info',
|
|
90
|
+
errorDeclaration: 'error-declaration',
|
|
91
|
+
transformationID: 'transformation-id',
|
|
92
|
+
quantityList: 'quantities',
|
|
93
|
+
childQuantityList: 'quantities',
|
|
94
|
+
inputQuantityList: 'quantities',
|
|
95
|
+
outputQuantityList: 'quantities',
|
|
96
|
+
'@context': 'event-level-context',
|
|
97
|
+
};
|
|
98
|
+
const CARRIED_MEMBERS = new Set(['type', 'eventTime', 'eventTimeZoneOffset', 'recordTime', 'eventID', 'action', 'bizStep', 'disposition', 'readPoint', 'bizLocation', 'epcList', 'childEPCs', 'parentID', 'inputEPCList', 'outputEPCList']);
|
|
99
|
+
function classifyFailure(event, message) {
|
|
100
|
+
if (message.startsWith('Unsupported EPCIS event type'))
|
|
101
|
+
return { mapping: 'unsupported', missing: [`event type ${JSON.stringify(event.type)} is outside the five types the profile maps`] };
|
|
102
|
+
if (message.startsWith('An explicit supported action mapping is required')) {
|
|
103
|
+
return { mapping: 'unsupported', missing: [event.type === 'TransformationEvent' ? 'a TransformationEvent has no action; the mapping decision transformationAction was not supplied' : `action ${JSON.stringify(event.action)} is not ADD, OBSERVE or DELETE`] };
|
|
104
|
+
}
|
|
105
|
+
if (message.startsWith('Insufficient product identifiers'))
|
|
106
|
+
return { mapping: 'insufficient-data', missing: ['no product identifier the profile carries'] };
|
|
107
|
+
if (message.startsWith('Product identifier requires a supported EPCIS URI'))
|
|
108
|
+
return { mapping: 'unsupported', missing: ['an identifier is neither an EPC URN nor an HTTPS URI'] };
|
|
109
|
+
if (message.startsWith('Event time, timezone, business step and disposition are required')) {
|
|
110
|
+
const missing = [];
|
|
111
|
+
if (typeof event.eventTime !== 'string')
|
|
112
|
+
missing.push('eventTime');
|
|
113
|
+
if (typeof event.eventTimeZoneOffset !== 'string')
|
|
114
|
+
missing.push('eventTimeZoneOffset');
|
|
115
|
+
if (typeof event.bizStep !== 'string')
|
|
116
|
+
missing.push('bizStep');
|
|
117
|
+
if (typeof event.disposition !== 'string')
|
|
118
|
+
missing.push('disposition');
|
|
119
|
+
return { mapping: 'insufficient-data', missing: missing.length ? missing : ['eventTime, eventTimeZoneOffset, bizStep or disposition'] };
|
|
120
|
+
}
|
|
121
|
+
if (message.startsWith('Recorded time is required'))
|
|
122
|
+
return { mapping: 'insufficient-data', missing: ['recordTime, and no recordedAt was supplied'] };
|
|
123
|
+
if (/disposition/.test(message))
|
|
124
|
+
return { mapping: 'unsupported', missing: [`disposition ${JSON.stringify(event.disposition)} is not one the VSC profile's custody model names`] };
|
|
125
|
+
if (/quantity/.test(message))
|
|
126
|
+
return { mapping: 'unsupported', missing: ['a quantity element is not a finite non-negative number'] };
|
|
127
|
+
return { mapping: 'unsupported', missing: [message] };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The explicit outcome of mapping one EPCIS event into the VSC profile.
|
|
131
|
+
* Wraps `mapEpcisEvent` without changing it: a refusal becomes a named
|
|
132
|
+
* outcome rather than an exception, a success is `lossless` only when the
|
|
133
|
+
* event carries nothing the profile cannot express, and a supplied source
|
|
134
|
+
* reference is signed into the SEAL beside the round-trip extension so the
|
|
135
|
+
* credential names the exact bytes and pointer it was mapped from. The SEAL
|
|
136
|
+
* is unsigned and unpublished: issuance is a separate, separately authorised
|
|
137
|
+
* step that also requires issuer, status and custody evidence.
|
|
138
|
+
*/
|
|
139
|
+
export function mapEpcisEventWithReport(event, options, report = {}) {
|
|
140
|
+
const preserved = Object.keys(event).filter((key) => key !== 'type');
|
|
141
|
+
const base = { preserved, ...(report.validation == null ? {} : { validation: report.validation }) };
|
|
142
|
+
let seal;
|
|
143
|
+
try {
|
|
144
|
+
seal = mapEpcisEvent(event, options);
|
|
145
|
+
}
|
|
146
|
+
catch (cause) {
|
|
147
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
148
|
+
return { ...classifyFailure(event, message), unmapped: [], ...base };
|
|
149
|
+
}
|
|
150
|
+
if (report.sourceReference != null) {
|
|
151
|
+
if (report.sourceReference.vocabularyUrn !== EPCIS_SOURCE_VOCABULARY)
|
|
152
|
+
throw new Error('a source reference carries the epcis-source vocabulary');
|
|
153
|
+
seal.extensions['+Dn'][EPCIS_SOURCE_VOCABULARY] = structuredClone(report.sourceReference);
|
|
154
|
+
const check = validateSealStructure(seal, { requireProof: false });
|
|
155
|
+
if (!check.valid)
|
|
156
|
+
throw new Error(check.errors.map(e => `${e.path}: ${e.message}`).join('; '));
|
|
157
|
+
}
|
|
158
|
+
const unmapped = new Set();
|
|
159
|
+
for (const key of Object.keys(event)) {
|
|
160
|
+
if (CARRIED_MEMBERS.has(key))
|
|
161
|
+
continue;
|
|
162
|
+
unmapped.add(TRANSFORMED_MEMBERS[key] ?? `extension:${key}`);
|
|
163
|
+
}
|
|
164
|
+
if (event.type === 'TransformationEvent')
|
|
165
|
+
unmapped.add('transformation-action-decision');
|
|
166
|
+
const identifierCount = seal.eventVector.what.productIdentifiers.length;
|
|
167
|
+
if (identifierCount > 1)
|
|
168
|
+
unmapped.add('multi-product-event');
|
|
169
|
+
return { mapping: unmapped.size === 0 ? 'lossless' : 'transformed', seal, missing: [], unmapped: [...unmapped].sort(), ...base };
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=epcis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epcis.js","sourceRoot":"","sources":["../src/epcis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAA2D,MAAM,mBAAmB,CAAC;AACrH,MAAM,CAAC,MAAM,gBAAgB,GAAG,yCAAyC,CAAC;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,aAAa,EAAC,kBAAkB,EAAC,qBAAqB,EAAC,kBAAkB,EAAC,kBAAkB,CAAU,CAAC;AAQnI,mGAAmG;AACnG,MAAM,UAAU,aAAa,CAAC,KAAiB,EAAE,OAA4B;IAC3E,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAkC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACvJ,MAAM,WAAW,GAAwB,EAAE,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,KAAc,EAAE,EAAE;QAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAC7I,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC;YAAE,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,E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qBAAqB,CAAC,CAAC;IAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;AACnI,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { type ValidateFunction } from 'ajv/dist/2020.js';
|
|
2
|
+
import type { Check, DocumentLoader, Issue, JsonObject, StatusPolicy } from './types.js';
|
|
3
|
+
export declare const EXTERNAL_REPRESENTATIONS: readonly ["vc-di-ecdsa-rdfc-2019@1"];
|
|
4
|
+
export type ExternalRepresentation = (typeof EXTERNAL_REPRESENTATIONS)[number];
|
|
5
|
+
export declare const EXTERNAL_MEDIA_TYPE: "application/vc+ld+json";
|
|
6
|
+
export declare const EXTERNAL_CRYPTOSUITE = "ecdsa-rdfc-2019";
|
|
7
|
+
/** The profile limit on one credential's exact bytes: 256 KiB. */
|
|
8
|
+
export declare const EXTERNAL_CREDENTIAL_LIMIT_BYTES = 262144;
|
|
9
|
+
export declare const VC_V2_CONTEXT = "https://www.w3.org/ns/credentials/v2";
|
|
10
|
+
export declare const DATA_INTEGRITY_V2_CONTEXT = "https://w3id.org/security/data-integrity/v2";
|
|
11
|
+
export declare const MULTIKEY_V1_CONTEXT = "https://w3id.org/security/multikey/v1";
|
|
12
|
+
export declare const DID_V1_CONTEXT = "https://www.w3.org/ns/did/v1";
|
|
13
|
+
/** The owned payload context of the profile, served from the package's artefact bytes and never fetched. */
|
|
14
|
+
export declare const EXTERNAL_PASSPORT_CONTEXT_URL = "urn:bsv:dpp:external-passport:context:1";
|
|
15
|
+
export declare const EXTERNAL_PASSPORT_SCHEMA_ID = "urn:bsv:dpp:external-passport:schema:1";
|
|
16
|
+
export declare const EXTERNAL_PASSPORT_CONTEXT: JsonObject;
|
|
17
|
+
export declare const EXTERNAL_PASSPORT_SCHEMA: JsonObject;
|
|
18
|
+
/** The context sets the profile accepts by default: the VC 2.0 context alone, or with the Data Integrity context, each optionally followed by the owned payload context. */
|
|
19
|
+
export declare const DEFAULT_CONTEXT_SETS: readonly (readonly string[])[];
|
|
20
|
+
/** The compiled owned schema, compiled once. */
|
|
21
|
+
export declare function externalPassportSchemaValidator(): ValidateFunction;
|
|
22
|
+
export interface ExternalLoaderOptions {
|
|
23
|
+
/** A bounded `did:web` resolver for identifiers the caller has not pinned; absent, an unpinned DID is unavailable. */
|
|
24
|
+
didWeb?: {
|
|
25
|
+
allowedOrigins: readonly string[];
|
|
26
|
+
fetcher?: typeof globalThis.fetch;
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
maxBytes?: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The profile's document loader: the maintained VC 2.0, Data Integrity,
|
|
33
|
+
* Multikey and DID contexts, the owned payload context from the package's
|
|
34
|
+
* own bytes, and the caller's pinned documents (issuer DID documents, keys,
|
|
35
|
+
* status list credentials). Nothing else is served: a context or document a
|
|
36
|
+
* credential names that is not pinned is unavailable, and the SEAL profile
|
|
37
|
+
* context is refused by name so a foreign credential cannot borrow it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createExternalDocumentLoader(documents?: ReadonlyMap<string, JsonObject>, options?: ExternalLoaderOptions): DocumentLoader;
|
|
40
|
+
export interface ParsedExternalCredential {
|
|
41
|
+
credential: JsonObject;
|
|
42
|
+
/** SHA-256 of the exact bytes, lower-case hex. */
|
|
43
|
+
digest: string;
|
|
44
|
+
byteLength: number;
|
|
45
|
+
}
|
|
46
|
+
/** Parse exact bytes strictly (duplicate keys, malformed UTF-8 and depth refused) under the profile's 256 KiB limit. The bytes are never re-serialised. */
|
|
47
|
+
export declare function parseExternalCredentialBytes(bytes: Uint8Array, limits?: {
|
|
48
|
+
maxBytes?: number;
|
|
49
|
+
}): ParsedExternalCredential;
|
|
50
|
+
export interface ExternalContextPolicy {
|
|
51
|
+
allowedContextSets: readonly (readonly string[])[];
|
|
52
|
+
}
|
|
53
|
+
export interface ExternalIssuerPolicy {
|
|
54
|
+
/** DID methods the profile accepts for the issuer, for example `did:web`. */
|
|
55
|
+
allowedMethods: readonly string[];
|
|
56
|
+
/** Resolves an issuer DID to its document; defaults to the document loader. */
|
|
57
|
+
resolve?: (did: string) => Promise<JsonObject>;
|
|
58
|
+
}
|
|
59
|
+
export type ExternalAuthorityPolicy = {
|
|
60
|
+
id: string;
|
|
61
|
+
required: false;
|
|
62
|
+
reason: string;
|
|
63
|
+
} | {
|
|
64
|
+
id: string;
|
|
65
|
+
required: true;
|
|
66
|
+
trustedIssuers: readonly string[];
|
|
67
|
+
};
|
|
68
|
+
export interface SubjectBindingPolicy {
|
|
69
|
+
id: string;
|
|
70
|
+
bindings: ReadonlyArray<{
|
|
71
|
+
credentialSubject: string;
|
|
72
|
+
passportId: string;
|
|
73
|
+
evidenceRef: string;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
export interface ExternalVerificationPolicy {
|
|
77
|
+
documentLoader: DocumentLoader;
|
|
78
|
+
contextPolicy?: ExternalContextPolicy;
|
|
79
|
+
/** A compiled JSON Schema 2020-12 validator; defaults to the owned external passport schema. */
|
|
80
|
+
payloadSchema?: ValidateFunction;
|
|
81
|
+
issuerPolicy?: ExternalIssuerPolicy;
|
|
82
|
+
statusPolicy?: StatusPolicy;
|
|
83
|
+
/** Only with no status policy: a profile option recording that a credential without status is accepted with a stated limitation. */
|
|
84
|
+
statusOptional?: boolean;
|
|
85
|
+
authorityPolicy: ExternalAuthorityPolicy;
|
|
86
|
+
expectedSubject?: string;
|
|
87
|
+
subjectBindingPolicy?: SubjectBindingPolicy;
|
|
88
|
+
evaluationTime: string;
|
|
89
|
+
}
|
|
90
|
+
export interface ExternalVerification {
|
|
91
|
+
representation: ExternalRepresentation;
|
|
92
|
+
mediaType: typeof EXTERNAL_MEDIA_TYPE;
|
|
93
|
+
credentialId?: string;
|
|
94
|
+
issuer?: string;
|
|
95
|
+
subjects: string[];
|
|
96
|
+
types: string[];
|
|
97
|
+
digest: string;
|
|
98
|
+
checks: {
|
|
99
|
+
parse: Check;
|
|
100
|
+
contexts: Check;
|
|
101
|
+
schema: Check;
|
|
102
|
+
proof: Check;
|
|
103
|
+
issuerBinding: Check;
|
|
104
|
+
subjectBinding: Check;
|
|
105
|
+
temporal: Check;
|
|
106
|
+
status: Check;
|
|
107
|
+
authority: Check;
|
|
108
|
+
availability: Check;
|
|
109
|
+
};
|
|
110
|
+
issues: Issue[];
|
|
111
|
+
/** Verification concerns the supplied bytes and the pinned or resolved documents; it establishes no global freshness. */
|
|
112
|
+
evidenceScope: 'provided-evidence';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The W3C Bitstring Status List rules of the SEAL verifier, with the proof
|
|
116
|
+
* verifier a parameter so the list is checked under this profile's suite.
|
|
117
|
+
* Identifier, authorised list issuer, proof, validity, signed freshness,
|
|
118
|
+
* purpose, canonical encoding, bounded decompression and the bit are
|
|
119
|
+
* separate refusals; a stale list stays stale however recently fetched.
|
|
120
|
+
*/
|
|
121
|
+
export declare function verifyBitstringStatus(credential: JsonObject, options: {
|
|
122
|
+
statusPolicy?: StatusPolicy;
|
|
123
|
+
statusOptional?: boolean;
|
|
124
|
+
evaluationTime: string;
|
|
125
|
+
}, verifyProof: (list: JsonObject) => Promise<Check>): Promise<Check>;
|
|
126
|
+
/**
|
|
127
|
+
* Verify one external credential from its exact bytes under the profile.
|
|
128
|
+
* Every check answers for itself; `issues` is the union of their issues.
|
|
129
|
+
* Nothing here consults a trust list the credential carries, and nothing
|
|
130
|
+
* here reads the credential under the SEAL profile's rules.
|
|
131
|
+
*/
|
|
132
|
+
export declare function verifyExternalCredential({ bytes, representation, policy }: {
|
|
133
|
+
bytes: Uint8Array;
|
|
134
|
+
representation: string;
|
|
135
|
+
policy: ExternalVerificationPolicy;
|
|
136
|
+
}): Promise<ExternalVerification>;
|
|
137
|
+
/** A check's answer in the verification report's vocabulary (`spec/verification.md`); the shape mirrors `PartialCheck` in @bsv/dpp-core, restated here because this package does not depend on it. */
|
|
138
|
+
export interface ReportPartialCheck {
|
|
139
|
+
status: 'pass' | 'fail' | 'unknown' | 'not-applicable';
|
|
140
|
+
reasonCode?: string;
|
|
141
|
+
evidenceRefs?: string[];
|
|
142
|
+
detail?: unknown;
|
|
143
|
+
}
|
|
144
|
+
/** What the report's credential verifier slot returns; mirrors `ExternalCredentialVerification` in @bsv/dpp-core. */
|
|
145
|
+
export interface ReportCredentialVerification {
|
|
146
|
+
id?: string;
|
|
147
|
+
issuer?: string;
|
|
148
|
+
subjects?: string[];
|
|
149
|
+
attestationType?: string;
|
|
150
|
+
proof: ReportPartialCheck;
|
|
151
|
+
schema: ReportPartialCheck;
|
|
152
|
+
time: ReportPartialCheck;
|
|
153
|
+
status: ReportPartialCheck;
|
|
154
|
+
authority: ReportPartialCheck;
|
|
155
|
+
availability?: ReportPartialCheck;
|
|
156
|
+
}
|
|
157
|
+
export type ReportCredentialVerifier = (input: {
|
|
158
|
+
representation: string;
|
|
159
|
+
mediaType?: string;
|
|
160
|
+
bytes: number[];
|
|
161
|
+
digest: string;
|
|
162
|
+
checkedAt: string;
|
|
163
|
+
}) => Promise<ReportCredentialVerification>;
|
|
164
|
+
/**
|
|
165
|
+
* The verifier the report's `credentialVerifier` slot takes for this
|
|
166
|
+
* representation. The proof and issuer-binding checks answer `proof`
|
|
167
|
+
* together (a proof whose key its issuer never authorised does not verify
|
|
168
|
+
* under its own suite's controller rule); the schema, validity interval,
|
|
169
|
+
* status, authority and availability checks answer their own slots. The
|
|
170
|
+
* attestation type is the credential's first type after VerifiableCredential.
|
|
171
|
+
*/
|
|
172
|
+
export declare function externalCredentialVerifierFor(policy: Omit<ExternalVerificationPolicy, 'evaluationTime'> & {
|
|
173
|
+
evaluationTime?: string;
|
|
174
|
+
}):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