An open API service indexing awesome lists of open source software.

https://github.com/rohenaz/go-web-push-package

Generates a push package for use with Apple's Push Notification Service
https://github.com/rohenaz/go-web-push-package

Last synced: 2 months ago
JSON representation

Generates a push package for use with Apple's Push Notification Service

Awesome Lists containing this project

README

        

# go-web-push-package
[WIP] Generates a push package for use with Apple's Push Notification Service

## Prerequisites
Uses openssl to sign the manifest

## Installation

$ go get github.com/rohenaz/go-web-push-package

## Usage

```
Define your package config as follows:

PushPackageConfig {
website {
"websiteName": "Test",
"websitePushID": "web.example.test",
"allowedDomains": ["https://example.com"],
"urlFormatString": "https://example.com/%@",
"authenticationToken": "19f8d7a6e9fb8a7f6d9330dabe",
"webServiceURL": "https://example.com",
}
iconPath: 'path/to/iconFolder'
certificates {
signer: 'certificates/cert.pem',
key: 'certificates/key.pem',
}
}
```
Generage the package and return the archive

`buffer, err := PushPackageConfig.GeneratePackage()`

Write your response

```
w.Header().Set("Content-type", "application/zip")
w.Write(buffer.Bytes())
```

the above would generate a package looking like this

- icon.iconset/icon_128x128.png
- icon.iconset/[email protected]
- icon.iconset/icon_16x16.png
- icon.iconset/[email protected]
- icon.iconset/icon_32x32.png
- icon.iconset/[email protected]
- manifest.json
- signature
- website.json