Passbook (Passbook v0.1.10)

View Source

Documentation for Passbook.

Summary

Functions

generate(pass, files, wwdr_path, certificate_path, key_path, password, opts \\ [])

Generates a signed .pkpass file.

Options:

  • target_path: Where to generate the .pkpass file. Defaults to tmp folder.
  • pass_name: The name of the .pkpass file. Defaults to a random 8 char string.
  • delete_raw_pass - If the raw pass files should be deleted, leaving only the .pkpass file. Defaults to true.

Examples

iex> Passbook.generate(%Passbook.Pass{
  background_color: "rgb(23, 187, 82)",
  foreground_color: "rgb(100, 10, 110)",
  barcode: %Passbook.LowerLevel.Barcode{
    format: :qr,
    alt_text: "1234",
    message: "qr-code-content"
  },
  description: "This is a pass description",
  organization_name: "My Organization",
  pass_type_identifier: "123",
  serial_number: "serial-number-123",
  team_identifier: "team-identifier",
  generic: %Passbook.PassStructure{
    transit_type: :train,
    primary_fields: [
      %Passbook.LowerLevel.Field{
        key: "my-key",
        value: "my-value"
      }
    ]
  }}, ["icon.png": "path/to/file.png", "icon@2x.png": "path/to/file.png"], "path/to/wwdr.pem", "path/to/certificate.pem", "path/to/key.pem", "password", target_path: System.tmp_dir!(), pass_name: "mypass")
{:ok, "path/to/generated/mypass.pkpass"}