vet-data-utils-ts 0.5.16 → 0.5.17
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 +6 -0
- package/dist/shc.d.ts +7 -0
- package/dist/shc.js +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,12 @@ shows FHIR `Immunization.occurrenceDateTime`, `vaccineCode` and
|
|
|
30
30
|
`protocolApplied.targetDisease`. Its issuer-supplied validity interval is not
|
|
31
31
|
FHIR `Immunization.expirationDate`, which means vaccine-batch expiry.
|
|
32
32
|
|
|
33
|
+
`buildSmartHealthCardJwsProofReference(...)` serves a different purpose: it
|
|
34
|
+
hashes the exact compact SHC JWS, including its ES256 signature, with a domain
|
|
35
|
+
separator. A product ledger/resolver may use that key to retrieve the existing
|
|
36
|
+
detached `pqc:/` proofs when only the SHC QR is printed and internet access is
|
|
37
|
+
available. Offline PQC verification still requires the companion QR labels.
|
|
38
|
+
|
|
33
39
|
Development and releases follow the mandatory
|
|
34
40
|
[`local-first TDD and release contract`](docs/LOCAL_FIRST_RELEASE_CONTRACT.md).
|
|
35
41
|
|
package/dist/shc.d.ts
CHANGED
|
@@ -55,6 +55,13 @@ export declare function assembleSmartHealthCardJws(prepared: Pick<PreparedSmartH
|
|
|
55
55
|
* content identifier. They are deliberately not aliases.
|
|
56
56
|
*/
|
|
57
57
|
export declare function buildSmartHealthCardPayloadReferences(payloadBytes: Uint8Array): SmartHealthCardPayloadReferences;
|
|
58
|
+
/**
|
|
59
|
+
* Builds the optional online lookup key for a PQC companion proof from the
|
|
60
|
+
* exact compact SHC JWS printed by `shc:/`. This is intentionally distinct
|
|
61
|
+
* from the canonical payload references above: it includes the ES256
|
|
62
|
+
* signature and uses a domain separator so the two namespaces cannot collide.
|
|
63
|
+
*/
|
|
64
|
+
export declare function buildSmartHealthCardJwsProofReference(compactJws: string): string;
|
|
58
65
|
/** Encodes one compact SHC JWS into one or more standard numeric QR payloads. */
|
|
59
66
|
export declare function encodeSmartHealthCardQr(compactJws: string): readonly string[];
|
|
60
67
|
/** Reassembles standard SHC QR payloads regardless of scan order. */
|
package/dist/shc.js
CHANGED
|
@@ -156,6 +156,19 @@ export function buildSmartHealthCardPayloadReferences(payloadBytes) {
|
|
|
156
156
|
cidV1: buildRawCidV1FromUtf8String(payloadText),
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Builds the optional online lookup key for a PQC companion proof from the
|
|
161
|
+
* exact compact SHC JWS printed by `shc:/`. This is intentionally distinct
|
|
162
|
+
* from the canonical payload references above: it includes the ES256
|
|
163
|
+
* signature and uses a domain separator so the two namespaces cannot collide.
|
|
164
|
+
*/
|
|
165
|
+
export function buildSmartHealthCardJwsProofReference(compactJws) {
|
|
166
|
+
const jws = nonEmptyString(compactJws, 'shc_compact_jws_required');
|
|
167
|
+
if (jws.split('.').length !== 3)
|
|
168
|
+
throw new TypeError('shc_compact_jws_required');
|
|
169
|
+
const lookupBytes = Content.stringToBytesUTF8(`vetchain:shc-jws-pqc-proof:v1\0${jws}`);
|
|
170
|
+
return `urn:multibase:${encodeMultibaseSha3(lookupBytes, 384)}`;
|
|
171
|
+
}
|
|
159
172
|
/** Encodes one compact SHC JWS into one or more standard numeric QR payloads. */
|
|
160
173
|
export function encodeSmartHealthCardQr(compactJws) {
|
|
161
174
|
const jws = nonEmptyString(compactJws, 'shc_compact_jws_required');
|