CropPath for developers

All guides

Verify a lot as a buyer

Available

Check a sealed lot's signed documents and the daily fingerprints without an account or CropPath software.

When a lot is sealed, CropPath issues its documents once, signed with the packing facility's key, and never changes them: the lot's EPCIS 2.0 document (GET /v1/public/lots/{publicId}/epcis.jsonld), the lot credential and each fruit's credential (…/credential, a UNTP Digital Product Passport as a signed JWT, application/vc+jwt), and the packing facility's UNTP Digital Facility Record (…/facility-record). Anything recorded after the seal is on the public page but not in these documents.

  1. Read the credential's header (its first part, base64url JSON): alg is ES256 and kid names the facility's key, did:web:<domain>:<slug>#key-<n>.
  2. Fetch https://<domain>/<slug>/did.json and take the verificationMethod whose id equals the kid; it must also be listed in assertionMethod.
  3. Verify the signature with that publicKeyJwk and any JOSE library.
  4. In the credential (UNTP 0.7.0), take the EPCIS document's link in relatedDocument: its digestMultibase is u followed by the unpadded base64url of the bytes 0x12 0x20 and the SHA-256 of the document's bytes; compute it and compare. A credential sealed before UNTP 0.7.0 holds the hex SHA-256 in the hashDigest of its traceabilityInformation.
  5. Check that the seal is in the published daily fingerprints: python3 verify_anchors.py proof --api https://<host> --lot <publicId> (see the Tamper evidence guide).
import { compactVerify, importJWK } from "jose";

const did = await (await fetch("https://<domain>/<slug>/did.json")).json();
const jws = await (await fetch("https://<domain>/v1/public/lots/<publicId>/credential")).text();
const kid = JSON.parse(Buffer.from(jws.split(".")[0], "base64url")).kid;
const method = did.verificationMethod.find((m) => m.id === kid);
const { payload } = await compactVerify(jws, await importJWK(method.publicKeyJwk, "ES256"));
const credential = JSON.parse(new TextDecoder().decode(payload));

A credential whose key was revoked for compromise is withdrawn: its download answers 404 and the lot record's issuer is null. A key retired by a rotation stays in did.json, so what it signed still verifies.

The documents carry no operator, grower, parcel, coordinates, device id or device signature. Lab results in the credential are the facility's statement of the lab's result, naming the lab, its key and the report's SHA-256, not the lab's own credential.

In the API reference

Downloads

This portal serves these files: you do not need access to the source repository.