vet-sdk-core-ts 0.4.28 → 0.4.29
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ml_dsa44 } from '@noble/post-quantum/ml-dsa.js';
|
|
2
2
|
import { ml_kem768 } from '@noble/post-quantum/ml-kem.js';
|
|
3
|
+
import { prepareVeterinaryIndexTaggedBundle } from 'vet-data-utils-ts/index-projection-tags';
|
|
3
4
|
const encoder = new TextEncoder();
|
|
4
5
|
const decoder = new TextDecoder();
|
|
5
6
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -138,12 +139,15 @@ function sign(sender, plaintext) {
|
|
|
138
139
|
return `${header}.${payload}.${base64Url(ml_dsa44.sign(encoder.encode(`${header}.${payload}`), sender.signingSecretKey))}`;
|
|
139
140
|
}
|
|
140
141
|
export async function sealVeterinarySecureClinicMessage(input) {
|
|
141
|
-
const
|
|
142
|
+
const taggedBundle = prepareVeterinaryIndexTaggedBundle(input.bundle, {
|
|
143
|
+
allowedTagSystems: input.indexPolicy.allowedTagSystems,
|
|
144
|
+
});
|
|
145
|
+
const indexProjection = extractIndexProjection(taggedBundle, input.indexPolicy);
|
|
142
146
|
const signed = sign(input.sender, {
|
|
143
147
|
id: input.messageId, thid: input.threadId,
|
|
144
148
|
type: 'https://vetchain.app/protocols/private-fhir-document/1.0/ips',
|
|
145
149
|
from: input.from, to: [input.to], created_time: Math.floor(Date.now() / 1000),
|
|
146
|
-
body: { mediaType: 'application/fhir+json', bundle:
|
|
150
|
+
body: { mediaType: 'application/fhir+json', bundle: taggedBundle },
|
|
147
151
|
});
|
|
148
152
|
const cek = crypto.getRandomValues(new Uint8Array(32));
|
|
149
153
|
const header = base64Url(canonicalize({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vet-sdk-core-ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.29",
|
|
4
4
|
"description": "Browser-safe VetChain core contracts and governed animal species identifiers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Connecting Solution & Applications Ltd",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"@noble/hashes": "^2.2.0",
|
|
82
82
|
"@noble/post-quantum": "0.5.4",
|
|
83
83
|
"gdc-common-utils-ts": "2.9.10",
|
|
84
|
-
"vet-data-utils-ts": "0.5.
|
|
84
|
+
"vet-data-utils-ts": "0.5.18"
|
|
85
85
|
}
|
|
86
86
|
}
|