# `mix wallet_passes.gen.apple_nfc_key`
[🔗](https://gitlab.com/phinnaeus/wallet_passes/blob/main/lib/mix/tasks/wallet_passes.gen.apple_nfc_key.ex#L1)

Generates a P-256 (secp256r1) keypair for Apple Wallet NFC passes (VAS).

    $ mix wallet_passes.gen.apple_nfc_key [output_dir]

Defaults to `./nfc_keys` if no directory is given.

Three files are written:

  * `nfc_private.pem` — PKCS#8 private key. Hand this to your VAS reader vendor.
  * `nfc_public.pem` — SPKI public key in compressed-point form.
  * `nfc_public.b64` — single-line base64 of the SPKI key, ready to paste
    into `PassData`'s `:nfc_encryption_public_key` field (or `pass.json`'s
    `nfc.encryptionPublicKey`).

Existing files in the output directory are never overwritten — losing a
private key you've already shared with a reader vendor would be painful.

Apple NFC passes also require a special entitlement from Apple — apply at
https://developer.apple.com/contact/passkit/.

Requires `openssl` on `PATH`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
