Notarizations
The NotarizationsResource is the core integrity engine of the SDK. It allows you to take a Digital Product Passport (DPP) and "freeze" its state by generating a cryptographic proof that is stored securely on the blockchain.
The Notarization Process
When you trigger a notarization, the SDK performs the following steps:
- Data Enrichment: Collects all Tech Cards, Files, and Tabs associated with the DPP.
- Document Generation: Creates a standardized JSON and a human-readable PDF.
- Hashing: Generates a
SHA-256hash of the JSON data. - Digital Signature: Signs the hash using the user's private key via
ethers.js. - On-Chain Submission: Sends the proof, signature, and generated files to the notarization service.
Methods
notarizeDpp
Performs a full notarization for a single Digital Product Passport.
Signature
async notarizeDpp(dppId: string, options?: RequestOptions): Promise<{ ok: boolean }>
Parameters
| Parameter | Type | Description |
|---|---|---|
dppId | string | The unique identifier (UUID) of the DPP to be notarized. |
options | RequestOptions | (Optional) Configuration for the request, such as custom headers. |
Example
const result = await sdk.notarizations.notarizeDpp("dpp_uuid_123");
if (result.ok) {
console.log("DPP successfully notarized on-chain.");
}
Returns
Promise<{ ok: boolean }>: An object indicating the success of the operation.
Exceptions
SDKError: Thrown if the DPP is not found (404), data is incomplete, or the cryptographic signature fails.
notarizeAllModelsDpps
Performs a batch notarization for all Digital Product Passports belonging to a specific Model. This is significantly more efficient than calling notarizeDpp individually when dealing with large volumes of passports.
Signature
async notarizeAllModelsDpps(modelId: string, options?: RequestOptions): Promise<{ ok: boolean }>
Parameters
| Parameter | Type | Description |
|---|---|---|
modelId | string | The parent Model ID that owns the collection of DPPs. |
options | RequestOptions | (Optional) Configuration for the request. |
Example
const result = await sdk.notarizations.notarizeAllModelsDpps("model_uuid_123");
if (result.ok) {
console.log("All DPPs in the model successfully notarized.");
}
Returns
Promise<{ ok: boolean }>: A promise resolving to an object indicating if the batch was accepted and processed.
Exceptions
SDKError: Thrown if the batch processing fails, credentials are invalid, or no DPPs are found for the provided model.
[!IMPORTANT] Notarization requires a valid Wallet Private Key and Company ID to be configured during SDK initialization. Ensure the wallet has sufficient permissions to sign messages for the target DPPs.