vet-data-utils-ts 0.7.0 → 0.7.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/dist/animal-identity-assurance.d.ts +182 -0
- package/dist/animal-identity-assurance.js +231 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
export declare const VeterinaryAnimalIdentityCredentialTypes: Readonly<{
|
|
2
|
+
Assurance: "VeterinaryAnimalIdentityAssuranceCredential";
|
|
3
|
+
}>;
|
|
4
|
+
export type VeterinaryAnimalControllerRelationship = 'owner' | 'caregiver';
|
|
5
|
+
export type VeterinaryIdentityDocumentDigest = Readonly<{
|
|
6
|
+
contentType: 'application/pdf' | 'image/jpeg' | 'image/png';
|
|
7
|
+
/** SHA3-384 multihash encoded as base58btc. Raw document bytes never belong in the credential. */
|
|
8
|
+
sha3_384: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type VeterinaryAnimalIdentityAssuranceCredential = Readonly<{
|
|
11
|
+
'@context': readonly ['https://www.w3.org/ns/credentials/v2', 'https://schema.org'];
|
|
12
|
+
id: string;
|
|
13
|
+
type: readonly ['VerifiableCredential', 'VeterinaryAnimalIdentityAssuranceCredential'];
|
|
14
|
+
issuer: string;
|
|
15
|
+
validFrom: string;
|
|
16
|
+
validUntil: string;
|
|
17
|
+
credentialSubject: Readonly<{
|
|
18
|
+
id: string;
|
|
19
|
+
'@type': 'Person';
|
|
20
|
+
holdsAnimalIdentity: Readonly<{
|
|
21
|
+
id: string;
|
|
22
|
+
'@type': 'Animal';
|
|
23
|
+
name: string;
|
|
24
|
+
species: Readonly<{
|
|
25
|
+
'@type': 'Taxon';
|
|
26
|
+
taxonRank: 'species';
|
|
27
|
+
identifier: string;
|
|
28
|
+
}>;
|
|
29
|
+
identifier: Readonly<{
|
|
30
|
+
'@type': 'PropertyValue';
|
|
31
|
+
propertyID: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
relationshipToAnimal: VeterinaryAnimalControllerRelationship;
|
|
36
|
+
verified_claims: Readonly<{
|
|
37
|
+
verification: Readonly<{
|
|
38
|
+
trust_framework: 'veterinarian_in_person_document_check';
|
|
39
|
+
time: string;
|
|
40
|
+
verification_process: string;
|
|
41
|
+
evidence: readonly [
|
|
42
|
+
Readonly<{
|
|
43
|
+
type: 'document';
|
|
44
|
+
method: 'physical_in_person_check';
|
|
45
|
+
verifier: Readonly<{
|
|
46
|
+
organization: string;
|
|
47
|
+
professional: string;
|
|
48
|
+
role: 'ISCO-08|2250';
|
|
49
|
+
}>;
|
|
50
|
+
time: string;
|
|
51
|
+
check_details: readonly [Readonly<{
|
|
52
|
+
check_method: 'physical_in_person_check';
|
|
53
|
+
time: string;
|
|
54
|
+
}>];
|
|
55
|
+
attachments: Readonly<{
|
|
56
|
+
content_type: string;
|
|
57
|
+
digest: Readonly<{
|
|
58
|
+
alg: 'sha3-384';
|
|
59
|
+
value: string;
|
|
60
|
+
}>;
|
|
61
|
+
}>;
|
|
62
|
+
}>
|
|
63
|
+
];
|
|
64
|
+
}>;
|
|
65
|
+
claims: Readonly<{
|
|
66
|
+
name: string;
|
|
67
|
+
identifier: Readonly<{
|
|
68
|
+
type: string;
|
|
69
|
+
value: string;
|
|
70
|
+
country: string;
|
|
71
|
+
}>;
|
|
72
|
+
}>;
|
|
73
|
+
}>;
|
|
74
|
+
}>;
|
|
75
|
+
evidence: readonly [
|
|
76
|
+
Readonly<{
|
|
77
|
+
type: 'VeterinaryAnimalIdentityEvidence';
|
|
78
|
+
verifier: string;
|
|
79
|
+
time: string;
|
|
80
|
+
content_type: string;
|
|
81
|
+
digest: Readonly<{
|
|
82
|
+
alg: 'sha3-384';
|
|
83
|
+
value: string;
|
|
84
|
+
}>;
|
|
85
|
+
}>,
|
|
86
|
+
Readonly<{
|
|
87
|
+
type: 'AnimalControllerRelationshipEvidence';
|
|
88
|
+
relationship: VeterinaryAnimalControllerRelationship;
|
|
89
|
+
verifier: string;
|
|
90
|
+
time: string;
|
|
91
|
+
content_type: string;
|
|
92
|
+
digest: Readonly<{
|
|
93
|
+
alg: 'sha3-384';
|
|
94
|
+
value: string;
|
|
95
|
+
}>;
|
|
96
|
+
}>
|
|
97
|
+
];
|
|
98
|
+
credentialStatus: Readonly<{
|
|
99
|
+
id: string;
|
|
100
|
+
type: 'SimpleCredentialStatus2026';
|
|
101
|
+
}>;
|
|
102
|
+
proof?: unknown;
|
|
103
|
+
}>;
|
|
104
|
+
export type VeterinaryAnimalIdentityAssuranceInput = Readonly<{
|
|
105
|
+
credentialId: string;
|
|
106
|
+
issuerDid: string;
|
|
107
|
+
veterinarianOrganizationId: string;
|
|
108
|
+
veterinarianRole: 'ISCO-08|2250';
|
|
109
|
+
holderDid: string;
|
|
110
|
+
validFrom: string;
|
|
111
|
+
validUntil: string;
|
|
112
|
+
animal: Readonly<{
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
speciesTaxonomyId: string;
|
|
116
|
+
identifier: Readonly<{
|
|
117
|
+
system: string;
|
|
118
|
+
value: string;
|
|
119
|
+
}>;
|
|
120
|
+
}>;
|
|
121
|
+
controller: Readonly<{
|
|
122
|
+
id: string;
|
|
123
|
+
legalName: string;
|
|
124
|
+
identifier: Readonly<{
|
|
125
|
+
type: string;
|
|
126
|
+
value: string;
|
|
127
|
+
country: string;
|
|
128
|
+
}>;
|
|
129
|
+
}>;
|
|
130
|
+
relationship: VeterinaryAnimalControllerRelationship;
|
|
131
|
+
evidence: Readonly<{
|
|
132
|
+
animalDocument: VeterinaryIdentityDocumentDigest;
|
|
133
|
+
controllerDocument: VeterinaryIdentityDocumentDigest;
|
|
134
|
+
relationshipDocument: VeterinaryIdentityDocumentDigest;
|
|
135
|
+
checkedAt: string;
|
|
136
|
+
}>;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Builds the unsigned W3C VC 2.0 payload attested by a veterinarian.
|
|
140
|
+
*
|
|
141
|
+
* OpenID Identity Assurance `verified_claims` is deliberately scoped to the
|
|
142
|
+
* natural person. Animal identity and the owner/caregiver relationship use
|
|
143
|
+
* separate veterinary evidence entries. All physical files are hash-only.
|
|
144
|
+
*/
|
|
145
|
+
export declare function buildVeterinaryAnimalIdentityAssuranceCredential(input: VeterinaryAnimalIdentityAssuranceInput): VeterinaryAnimalIdentityAssuranceCredential;
|
|
146
|
+
/** Validates the governed credential shape before wallet storage or presentation. */
|
|
147
|
+
export declare function parseVeterinaryAnimalIdentityAssuranceCredential(value: unknown): VeterinaryAnimalIdentityAssuranceCredential;
|
|
148
|
+
/** Builds the bounded OpenID4VP 1.0 request used by airline, police and insurer verifiers. */
|
|
149
|
+
export declare function buildVeterinaryAnimalIdentityOpenId4VpRequest(input: Readonly<{
|
|
150
|
+
clientId: string;
|
|
151
|
+
responseUri: string;
|
|
152
|
+
nonce: string;
|
|
153
|
+
state: string;
|
|
154
|
+
animalId: string;
|
|
155
|
+
}>): Readonly<{
|
|
156
|
+
client_id: string;
|
|
157
|
+
response_uri: string;
|
|
158
|
+
response_type: "vp_token";
|
|
159
|
+
response_mode: "direct_post";
|
|
160
|
+
nonce: string;
|
|
161
|
+
state: string;
|
|
162
|
+
presentation_definition: Readonly<{
|
|
163
|
+
id: `vetchain-animal-identity-${string}`;
|
|
164
|
+
input_descriptors: readonly Readonly<{
|
|
165
|
+
id: "veterinary-animal-identity-assurance";
|
|
166
|
+
format: Readonly<{
|
|
167
|
+
jwt_vc_json: Readonly<{
|
|
168
|
+
alg: readonly string[];
|
|
169
|
+
}>;
|
|
170
|
+
}>;
|
|
171
|
+
constraints: Readonly<{
|
|
172
|
+
fields: readonly Readonly<{
|
|
173
|
+
path: readonly string[];
|
|
174
|
+
filter: Readonly<{
|
|
175
|
+
type: "string";
|
|
176
|
+
const: string;
|
|
177
|
+
}>;
|
|
178
|
+
}>[];
|
|
179
|
+
}>;
|
|
180
|
+
}>[];
|
|
181
|
+
}>;
|
|
182
|
+
}>;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
export const VeterinaryAnimalIdentityCredentialTypes = Object.freeze({
|
|
2
|
+
Assurance: 'VeterinaryAnimalIdentityAssuranceCredential',
|
|
3
|
+
});
|
|
4
|
+
function record(value) {
|
|
5
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
|
|
6
|
+
}
|
|
7
|
+
function firstRecord(value) {
|
|
8
|
+
return Array.isArray(value) ? value.map(record).find(Boolean) : undefined;
|
|
9
|
+
}
|
|
10
|
+
function required(value, error) {
|
|
11
|
+
const text = typeof value === 'string' ? value.trim() : '';
|
|
12
|
+
if (!text)
|
|
13
|
+
throw new TypeError(error);
|
|
14
|
+
return text;
|
|
15
|
+
}
|
|
16
|
+
function did(value, error) {
|
|
17
|
+
const text = required(value, error);
|
|
18
|
+
if (!text.startsWith('did:'))
|
|
19
|
+
throw new TypeError(error);
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
function instant(value, error) {
|
|
23
|
+
const text = required(value, error);
|
|
24
|
+
if (!Number.isFinite(Date.parse(text)))
|
|
25
|
+
throw new TypeError(error);
|
|
26
|
+
return text;
|
|
27
|
+
}
|
|
28
|
+
function digest(value, error) {
|
|
29
|
+
const contentType = required(value?.contentType, error);
|
|
30
|
+
if (!['application/pdf', 'image/jpeg', 'image/png'].includes(contentType))
|
|
31
|
+
throw new TypeError(error);
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
contentType: contentType,
|
|
34
|
+
sha3_384: required(value?.sha3_384, error),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Builds the unsigned W3C VC 2.0 payload attested by a veterinarian.
|
|
39
|
+
*
|
|
40
|
+
* OpenID Identity Assurance `verified_claims` is deliberately scoped to the
|
|
41
|
+
* natural person. Animal identity and the owner/caregiver relationship use
|
|
42
|
+
* separate veterinary evidence entries. All physical files are hash-only.
|
|
43
|
+
*/
|
|
44
|
+
export function buildVeterinaryAnimalIdentityAssuranceCredential(input) {
|
|
45
|
+
const credentialId = required(input.credentialId, 'animal_identity_credential_id_required');
|
|
46
|
+
const issuerDid = did(input.issuerDid, 'animal_identity_credential_issuer_invalid');
|
|
47
|
+
const holderDid = did(input.holderDid, 'animal_identity_credential_holder_invalid');
|
|
48
|
+
const controllerId = did(input.controller?.id, 'animal_identity_controller_id_invalid');
|
|
49
|
+
if (holderDid !== controllerId)
|
|
50
|
+
throw new TypeError('holder_controller_identity_mismatch');
|
|
51
|
+
const animalId = did(input.animal?.id, 'animal_identity_subject_invalid');
|
|
52
|
+
const validFrom = instant(input.validFrom, 'animal_identity_credential_valid_from_invalid');
|
|
53
|
+
const validUntil = instant(input.validUntil, 'animal_identity_credential_valid_until_invalid');
|
|
54
|
+
if (Date.parse(validFrom) > Date.parse(validUntil))
|
|
55
|
+
throw new TypeError('animal_identity_credential_validity_invalid');
|
|
56
|
+
if (input.relationship !== 'owner' && input.relationship !== 'caregiver') {
|
|
57
|
+
throw new TypeError('animal_controller_relationship_invalid');
|
|
58
|
+
}
|
|
59
|
+
if (input.veterinarianRole !== 'ISCO-08|2250')
|
|
60
|
+
throw new TypeError('veterinarian_role_invalid');
|
|
61
|
+
const organization = required(input.veterinarianOrganizationId, 'veterinarian_organization_required');
|
|
62
|
+
const checkedAt = instant(input.evidence?.checkedAt, 'animal_identity_evidence_time_invalid');
|
|
63
|
+
const animalDocument = digest(input.evidence?.animalDocument, 'animal_identity_evidence_digest_required');
|
|
64
|
+
const controllerDocument = digest(input.evidence?.controllerDocument, 'controller_identity_evidence_digest_required');
|
|
65
|
+
const relationshipDocument = digest(input.evidence?.relationshipDocument, 'relationship_evidence_digest_required');
|
|
66
|
+
const statusId = `${credentialId}#status`;
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
'@context': Object.freeze(['https://www.w3.org/ns/credentials/v2', 'https://schema.org']),
|
|
69
|
+
id: credentialId,
|
|
70
|
+
type: Object.freeze(['VerifiableCredential', VeterinaryAnimalIdentityCredentialTypes.Assurance]),
|
|
71
|
+
issuer: issuerDid,
|
|
72
|
+
validFrom,
|
|
73
|
+
validUntil,
|
|
74
|
+
credentialSubject: Object.freeze({
|
|
75
|
+
id: holderDid,
|
|
76
|
+
'@type': 'Person',
|
|
77
|
+
holdsAnimalIdentity: Object.freeze({
|
|
78
|
+
id: animalId,
|
|
79
|
+
'@type': 'Animal',
|
|
80
|
+
name: required(input.animal?.name, 'animal_identity_name_required'),
|
|
81
|
+
species: Object.freeze({
|
|
82
|
+
'@type': 'Taxon',
|
|
83
|
+
taxonRank: 'species',
|
|
84
|
+
identifier: required(input.animal?.speciesTaxonomyId, 'animal_identity_species_required'),
|
|
85
|
+
}),
|
|
86
|
+
identifier: Object.freeze({
|
|
87
|
+
'@type': 'PropertyValue',
|
|
88
|
+
propertyID: required(input.animal?.identifier?.system, 'animal_identity_identifier_system_required'),
|
|
89
|
+
value: required(input.animal?.identifier?.value, 'animal_identity_identifier_value_required'),
|
|
90
|
+
}),
|
|
91
|
+
}),
|
|
92
|
+
relationshipToAnimal: input.relationship,
|
|
93
|
+
verified_claims: Object.freeze({
|
|
94
|
+
verification: Object.freeze({
|
|
95
|
+
trust_framework: 'veterinarian_in_person_document_check',
|
|
96
|
+
time: checkedAt,
|
|
97
|
+
verification_process: credentialId,
|
|
98
|
+
evidence: Object.freeze([Object.freeze({
|
|
99
|
+
type: 'document',
|
|
100
|
+
method: 'physical_in_person_check',
|
|
101
|
+
verifier: Object.freeze({ organization, professional: issuerDid, role: input.veterinarianRole }),
|
|
102
|
+
time: checkedAt,
|
|
103
|
+
check_details: Object.freeze([Object.freeze({ check_method: 'physical_in_person_check', time: checkedAt })]),
|
|
104
|
+
attachments: Object.freeze({
|
|
105
|
+
content_type: controllerDocument.contentType,
|
|
106
|
+
digest: Object.freeze({ alg: 'sha3-384', value: controllerDocument.sha3_384 }),
|
|
107
|
+
}),
|
|
108
|
+
})]),
|
|
109
|
+
}),
|
|
110
|
+
claims: Object.freeze({
|
|
111
|
+
name: required(input.controller?.legalName, 'controller_identity_name_required'),
|
|
112
|
+
identifier: Object.freeze({
|
|
113
|
+
type: required(input.controller?.identifier?.type, 'controller_identity_identifier_type_required'),
|
|
114
|
+
value: required(input.controller?.identifier?.value, 'controller_identity_identifier_value_required'),
|
|
115
|
+
country: required(input.controller?.identifier?.country, 'controller_identity_identifier_country_required').toUpperCase(),
|
|
116
|
+
}),
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
}),
|
|
120
|
+
evidence: Object.freeze([
|
|
121
|
+
Object.freeze({
|
|
122
|
+
type: 'VeterinaryAnimalIdentityEvidence',
|
|
123
|
+
verifier: issuerDid,
|
|
124
|
+
time: checkedAt,
|
|
125
|
+
content_type: animalDocument.contentType,
|
|
126
|
+
digest: Object.freeze({ alg: 'sha3-384', value: animalDocument.sha3_384 }),
|
|
127
|
+
}),
|
|
128
|
+
Object.freeze({
|
|
129
|
+
type: 'AnimalControllerRelationshipEvidence',
|
|
130
|
+
relationship: input.relationship,
|
|
131
|
+
verifier: issuerDid,
|
|
132
|
+
time: checkedAt,
|
|
133
|
+
content_type: relationshipDocument.contentType,
|
|
134
|
+
digest: Object.freeze({ alg: 'sha3-384', value: relationshipDocument.sha3_384 }),
|
|
135
|
+
}),
|
|
136
|
+
]),
|
|
137
|
+
credentialStatus: Object.freeze({ id: statusId, type: 'SimpleCredentialStatus2026' }),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** Validates the governed credential shape before wallet storage or presentation. */
|
|
141
|
+
export function parseVeterinaryAnimalIdentityAssuranceCredential(value) {
|
|
142
|
+
const credential = record(value);
|
|
143
|
+
const subject = record(credential?.credentialSubject);
|
|
144
|
+
const animal = record(subject?.holdsAnimalIdentity);
|
|
145
|
+
const humanEvidence = firstRecord(record(record(subject?.verified_claims)?.verification)?.evidence);
|
|
146
|
+
const humanVerifier = record(humanEvidence?.verifier);
|
|
147
|
+
const types = Array.isArray(credential?.type) ? credential.type : [];
|
|
148
|
+
if (!types.includes('VerifiableCredential') || !types.includes(VeterinaryAnimalIdentityCredentialTypes.Assurance)) {
|
|
149
|
+
throw new TypeError('animal_identity_credential_type_invalid');
|
|
150
|
+
}
|
|
151
|
+
const rebuilt = buildVeterinaryAnimalIdentityAssuranceCredential({
|
|
152
|
+
credentialId: required(credential?.id, 'animal_identity_credential_id_required'),
|
|
153
|
+
issuerDid: required(credential?.issuer, 'animal_identity_credential_issuer_invalid'),
|
|
154
|
+
veterinarianOrganizationId: required(humanVerifier?.organization, 'veterinarian_organization_required'),
|
|
155
|
+
veterinarianRole: 'ISCO-08|2250',
|
|
156
|
+
holderDid: required(subject?.id, 'animal_identity_credential_holder_invalid'),
|
|
157
|
+
validFrom: required(credential?.validFrom, 'animal_identity_credential_valid_from_invalid'),
|
|
158
|
+
validUntil: required(credential?.validUntil, 'animal_identity_credential_valid_until_invalid'),
|
|
159
|
+
animal: {
|
|
160
|
+
id: required(animal?.id, 'animal_identity_subject_invalid'),
|
|
161
|
+
name: required(animal?.name, 'animal_identity_name_required'),
|
|
162
|
+
speciesTaxonomyId: required(record(animal?.species)?.identifier, 'animal_identity_species_required'),
|
|
163
|
+
identifier: {
|
|
164
|
+
system: required(record(animal?.identifier)?.propertyID, 'animal_identity_identifier_system_required'),
|
|
165
|
+
value: required(record(animal?.identifier)?.value, 'animal_identity_identifier_value_required'),
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
controller: {
|
|
169
|
+
id: required(subject?.id, 'animal_identity_controller_id_invalid'),
|
|
170
|
+
legalName: required(record(record(subject?.verified_claims)?.claims)?.name, 'controller_identity_name_required'),
|
|
171
|
+
identifier: record(record(record(subject?.verified_claims)?.claims)?.identifier),
|
|
172
|
+
},
|
|
173
|
+
relationship: subject?.relationshipToAnimal,
|
|
174
|
+
evidence: parseCredentialEvidence(credential, subject),
|
|
175
|
+
});
|
|
176
|
+
return Object.freeze({ ...rebuilt, ...(credential?.proof !== undefined ? { proof: credential.proof } : {}) });
|
|
177
|
+
}
|
|
178
|
+
function parseCredentialEvidence(credential, subject) {
|
|
179
|
+
const evidence = Array.isArray(credential.evidence) ? credential.evidence.map(record).filter(Boolean) : [];
|
|
180
|
+
const animal = evidence.find(item => item.type === 'VeterinaryAnimalIdentityEvidence');
|
|
181
|
+
const relationship = evidence.find(item => item.type === 'AnimalControllerRelationshipEvidence');
|
|
182
|
+
const human = firstRecord(record(record(subject.verified_claims)?.verification)?.evidence);
|
|
183
|
+
const humanAttachment = record(human?.attachments);
|
|
184
|
+
const humanDigest = record(humanAttachment?.digest);
|
|
185
|
+
const animalDigest = record(animal?.digest);
|
|
186
|
+
const relationshipDigest = record(relationship?.digest);
|
|
187
|
+
return {
|
|
188
|
+
animalDocument: {
|
|
189
|
+
contentType: animal?.content_type,
|
|
190
|
+
sha3_384: required(animalDigest?.value, 'animal_identity_evidence_digest_required'),
|
|
191
|
+
},
|
|
192
|
+
controllerDocument: {
|
|
193
|
+
contentType: humanAttachment?.content_type,
|
|
194
|
+
sha3_384: required(humanDigest?.value, 'controller_identity_evidence_digest_required'),
|
|
195
|
+
},
|
|
196
|
+
relationshipDocument: {
|
|
197
|
+
contentType: relationship?.content_type,
|
|
198
|
+
sha3_384: required(relationshipDigest?.value, 'relationship_evidence_digest_required'),
|
|
199
|
+
},
|
|
200
|
+
checkedAt: required(animal?.time, 'animal_identity_evidence_time_invalid'),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/** Builds the bounded OpenID4VP 1.0 request used by airline, police and insurer verifiers. */
|
|
204
|
+
export function buildVeterinaryAnimalIdentityOpenId4VpRequest(input) {
|
|
205
|
+
const clientId = required(input.clientId, 'animal_identity_verifier_client_id_required');
|
|
206
|
+
const responseUri = required(input.responseUri, 'animal_identity_verifier_response_uri_required');
|
|
207
|
+
const nonce = required(input.nonce, 'animal_identity_presentation_nonce_required');
|
|
208
|
+
const state = required(input.state, 'animal_identity_presentation_state_required');
|
|
209
|
+
const animalId = did(input.animalId, 'animal_identity_subject_invalid');
|
|
210
|
+
return Object.freeze({
|
|
211
|
+
client_id: clientId,
|
|
212
|
+
response_uri: responseUri,
|
|
213
|
+
response_type: 'vp_token',
|
|
214
|
+
response_mode: 'direct_post',
|
|
215
|
+
nonce,
|
|
216
|
+
state,
|
|
217
|
+
presentation_definition: Object.freeze({
|
|
218
|
+
id: `vetchain-animal-identity-${state}`,
|
|
219
|
+
input_descriptors: Object.freeze([Object.freeze({
|
|
220
|
+
id: 'veterinary-animal-identity-assurance',
|
|
221
|
+
format: Object.freeze({ jwt_vc_json: Object.freeze({ alg: Object.freeze(['ES256', 'ML-DSA-65']) }) }),
|
|
222
|
+
constraints: Object.freeze({
|
|
223
|
+
fields: Object.freeze([
|
|
224
|
+
Object.freeze({ path: Object.freeze(['$.type']), filter: Object.freeze({ type: 'string', const: VeterinaryAnimalIdentityCredentialTypes.Assurance }) }),
|
|
225
|
+
Object.freeze({ path: Object.freeze(['$.credentialSubject.holdsAnimalIdentity.id']), filter: Object.freeze({ type: 'string', const: animalId }) }),
|
|
226
|
+
]),
|
|
227
|
+
}),
|
|
228
|
+
})]),
|
|
229
|
+
}),
|
|
230
|
+
});
|
|
231
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vet-data-utils-ts",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Browser-safe governed VetChain data contracts",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Connecting Solution & Applications Ltd",
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"types": "./dist/animal-card.d.ts",
|
|
17
17
|
"default": "./dist/animal-card.js"
|
|
18
18
|
},
|
|
19
|
+
"./animal-identity-assurance": {
|
|
20
|
+
"types": "./dist/animal-identity-assurance.d.ts",
|
|
21
|
+
"default": "./dist/animal-identity-assurance.js"
|
|
22
|
+
},
|
|
19
23
|
"./animal-behavior": {
|
|
20
24
|
"types": "./dist/animal-behavior.d.ts",
|
|
21
25
|
"default": "./dist/animal-behavior.js"
|