Skip to content

Commit

Permalink
bump version, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
justdmitry committed Feb 14, 2025
1 parent e640790 commit 9aea0b8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
3 changes: 1 addition & 2 deletions PassKitHelper.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113 d17.12
VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3DE6FB8D-8225-4E4A-B065-3A2ECCC88B06}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
GlobalSuppressions.cs = GlobalSuppressions.cs
how_to_create_pfx.md = how_to_create_pfx.md
README.md = README.md
sample_pass.jpg = sample_pass.jpg
EndProjectSection
Expand Down
4 changes: 2 additions & 2 deletions PassKitHelper/PassKitHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://github.com/justdmitry/PassKitHelper</PackageProjectUrl>
<RepositoryUrl>https://github.com/justdmitry/PassKitHelper.git</RepositoryUrl>
<Version>4.3.0-alpha.2</Version>
<Version>4.3.0</Version>
<Description>Helper library for all your Apple PassKit (Apple Wallet, Apple Passbook) needs: create passes, sign pass packages, receive webhooks into your aspnetcore app and send push updates to user devices. Apple Developer Account required!</Description>
<PackageTags>apple passkit passbook pass webservice</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes>Do not require Apple cert when sending push notifications (thanks oliverw).</PackageReleaseNotes>
<PackageReleaseNotes>Completely remove Apple cert (only PFX is needed).</PackageReleaseNotes>
<DocumentationFile>PassKitHelper.xml</DocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Helper library for all your Apple PassKit (Apple Wallet, Apple Passbook) needs:

**Attention:** Apple Developer Account required!

[![NuGet](https://img.shields.io/nuget/v/PassKitHelper.svg?maxAge=86400&style=flat)](https://www.nuget.org/packages/PassKitHelper/) ![.NET 9.0](https://img.shields.io/badge/.NET-9.0-512BD4?style=flat) ![.NET 8.0](https://img.shields.io/badge/.NET-8.0-512BD4?style=flat) ![.NET 6.0](https://img.shields.io/badge/.NET-6.0-512BD4?style=flat) ![.NET Standard 2.0](https://img.shields.io/badge/.NET_Standard-2.0-512BD4?style=flat)

[![NuGet](https://img.shields.io/nuget/v/PassKitHelper.svg)](https://www.nuget.org/packages/PassKitHelper/) ![.NET 9.0](https://img.shields.io/badge/.NET-9.0-512BD4) ![.NET 8.0](https://img.shields.io/badge/.NET-8.0-512BD4) ![.NET 6.0](https://img.shields.io/badge/.NET-6.0-512BD4) ![.NET Standard 2.0](https://img.shields.io/badge/.NET_Standard-2.0-512BD4) ![MIT License](https://img.shields.io/github/license/justdmitry/PassKitHelper)

## Features

Expand All @@ -18,6 +17,21 @@ Helper library for all your Apple PassKit (Apple Wallet, Apple Passbook) needs:
* Add `UsePassKitMiddleware` into your `Startup.Configure()`
* Implement `IPassKitService` for real processing.


## Get your own PKCS12 certificate file (using OpenSSL)

1. Join Apple Developer Program (https://developer.apple.com/account/)
2. Create certificate signing request:
* Obtain your copy of OpenSSL (see https://www.openssl.org/ and/or https://wiki.openssl.org/index.php/Binaries)
* Run: `openssl req -new -newkey rsa:2048 -nodes -keyout pass.key -out pass.csr` and answer questions it asks.
3. Obtain certificate:
* Go to https://developer.apple.com/account/resources/certificates/list and create new certificate, using `pass.csr` file from previous step.
* Download certificate (`pass.cer`)
4. Convert key and certificate into X509 file:
* Run `openssl x509 -in pass.cer -inform der -outform pem -out pass.cer.pem` to convert certificate from DER to PEM format
* Run `openssl pkcs12 -export -out pass.pfx -inkey pass.key -in pass.cer.pem` to combine certificate and key files into single `pass.pfx` file. Protect it with password (openssl will ask) to prevent unauthorized usage.
* Move `pass.pfx` to your production server, delete all other `pass.*` files.

## Samples

### 1. Configure to create passes
Expand All @@ -28,7 +42,6 @@ Helper library for all your Apple PassKit (Apple Wallet, Apple Passbook) needs:
var options = new PassKitOptions()
{
PassCertificate = new X509Certificate2(File.ReadAllBytes("pass.pfx")),
AppleCertificate = new X509Certificate2(File.ReadAllBytes("AppleWWDRCA.cer")),
ConfigureNewPass =
p => p.Standard
.PassTypeIdentifier("your-pass-type-identifier")
Expand All @@ -47,7 +60,6 @@ public void ConfigureServices(IServiceCollection services)
services.AddPassKitHelper(options =>
{
options.PassCertificate = new X509Certificate2(File.ReadAllBytes("pass.pfx"));
options.AppleCertificate = new X509Certificate2(File.ReadAllBytes("AppleWWDRCA.cer"));
options.ConfigureNewPass =
p => p.Standard
.PassTypeIdentifier("your-pass-type-identifier")
Expand All @@ -58,15 +70,15 @@ public void ConfigureServices(IServiceCollection services)

```

### 2. Creat pass and pass package file
### 2. Create pass and pass package file

Check Apple's [PassKit Package Format Reference](https://developer.apple.com/library/archive/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/Introduction.html) for detailed description of all fields and valid values.

Also, check [Pass Design and Creation](https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html) for accepted image types and sizes.

```csharp
var pass = passKitHelper.CreateNewPass()
// Ths pass already have `PassTypeIdentifier`, `TeamIdentifier`
// This pass already have `PassTypeIdentifier`, `TeamIdentifier`
// and all other values you configured in options.
.Standard
.SerialNumber("PassKitHelper")
Expand Down Expand Up @@ -171,7 +183,7 @@ WebServiceURL is hostname of your server and path that equal to one in `UsePassK

#### 3.4. Send push updates

When users install your pass packge to their iOS and Mac devices - Apple server call your `RegisterDeviceAsync`. Save `pushToken` value in database, and when you need to update pass on user device - call `IPassKitHelper.SendPushNotificationAsync(pushToken)`.
When users install your pass package to their iOS and Mac devices - Apple server call your `RegisterDeviceAsync`. Save `pushToken` value in database, and when you need to update pass on user device - call `IPassKitHelper.SendPushNotificationAsync(pushToken)`.

## Installation

Expand Down
18 changes: 0 additions & 18 deletions how_to_create_pfx.md

This file was deleted.

0 comments on commit 9aea0b8

Please sign in to comment.