# Provision a Prototyping Device with Secure Vault

This workflow is for development and Secure Vault evaluation. The prototype credentials and private keys are created in the cloud and then provisioned to the device, where Secure Vault protects the private keys. Because the keys are generated outside the device, this is not the production credential-generation flow. For production, use [On-Device Certificate Generation](/amazon-sidewalk/2.9.3/sidewalk-manufacture-product/on-device-certificate-generation.md).

The cloud prototyping script creates a `DeviceProfile.json` and a `WirelessDevice.json` files. The Secure Vault provisioning scripts use these files instead of the manufacturing image produced by the basic prototype flow. The scripts are under `tools/scripts/public/pdp` in the Amazon Sidewalk extension.

## Prerequisites

1. Create a prototype device and download its `WirelessDevice.json` and `DeviceProfile.json` files using the [prototyping script workflow](soc-empty-app#provision-your-device-using-scripts) or the [Sidewalk Assistant](/amazon-sidewalk/2.9.3/sidewalk-getting-started/assistant-user-guide.md#end-device-tab).
2. Enable Secure Vault in the Sidewalk application as described in [Secure Vault Integration](/amazon-sidewalk/2.9.3/sidewalk-manufacture-product/secure-vault-walkthrough.md).
3. Build the Production Device Provisioner application, following [Secure Vault Integration](/amazon-sidewalk/2.9.3/sidewalk-manufacture-product/secure-vault-walkthrough.md#production-device-provisioner).
4. Install the PDP script requirements and use the Simplicity Commander and J-Link RTT versions required by your extension release.

## Generate the shared image

From `tools/scripts/public/pdp`, run the initialization script. It creates a common image for devices using the same profile; the product application can optionally be included.

```sh
pip3 install -r requirements.txt

python3 initialize_silabs.py \
  --sid-cert <path/to/WirelessDevice.json> \
  --sid-cert-type proto \
  --sid-dev-prof <path/to/DeviceProfile.json> \
  --part <EFR32-part-number> \
  --sid-usr-app-img <optional/path/to/application.s37> \
  --pdp-mode priv_key_prov
```

The generated shared image is written under the script's `out` directory. Use the exact options provided by the script version in your extension release.

## Provision each device

Run the provisioning script for each device. The shared initialization image must be flashed before device-specific data is written. If you already flashed the initialization image, omit `--sid-init-img`.

```sh
python3 provision_silabs.py \
  --sid-cert <path/to/WirelessDevice.json> \
  --sid-cert-type proto \
  --part <EFR32-part-number> \
  --sid-init-img out/sid_init_img.s37 \
  --pdp-img <path/to/pdp/app.s37> \
  --pdp-mode priv_key_prov
```

The device-specific information is provisioned through the Production Device Provisioner (PDP) application. The private keys are wrapped by Secure Vault, and the manufacturing data refers to the protected key slots. The cloud-created prototype credentials may contain private key material; handle the JSON file as sensitive and do not use this development flow for factory production.

For the production model and the difference between provisioning and registration, see [Production Provisioning Principles](/amazon-sidewalk/2.9.3/sidewalk-manufacture-product/principles.md).