Passport/pkg/internal/services/external_apns.go
2024-06-16 23:17:32 +08:00

26 lines
534 B
Go

package services
import (
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/token"
"github.com/spf13/viper"
)
// ExtAPNS is Apple Notification Services client
var ExtAPNS *apns2.Client
func SetupAPNS() error {
authKey, err := token.AuthKeyFromFile(viper.GetString("apns_credentials"))
if err != nil {
return err
}
ExtAPNS = apns2.NewTokenClient(&token.Token{
AuthKey: authKey,
KeyID: viper.GetString("apns_credentials_key"),
TeamID: viper.GetString("apns_credentials_team"),
}).Production()
return nil
}