Duration
A duration in seconds used to express when VAPID tokens will expire.
struct Duration
A duration in seconds used to express when VAPID tokens will expire.
struct Duration
import WebPush
struct Configuration
A configuration object specifying the contact information along with the keys that your application server identifies itself with.
enum VAPID
A set of types for Voluntary Application Server Identification, also known as VAPID.
init(from decoder: any Decoder) throws
init(key: Key, deprecatedKeys: Set<Key>? = nil, contactInformation: ContactInformation, expirationDuration: Duration = .hours(22), validityDuration: Duration = .hours(20))
Initialize a configuration with a single primary key.
init(primaryKey: Key?, keys: Set<Key>, deprecatedKeys: Set<Key>? = nil, contactInformation: ContactInformation, expirationDuration: Duration = .hours(22), validityDuration: Duration = .hours(20)) throws(ConfigurationError)
Initialize a configuration with a multiple VAPID keys.
var contactInformation: ContactInformation
The contact information an administrator of a push service may use to contact you in the case of an issue.
var deprecatedKeys: Set<Key>? { get }
The set of deprecated keys to continue to support when signing push messages, but shouldn’t be used for new registrations.
var expirationDuration: Duration
The number of seconds before a cached authentication header signed by this configuration fully expires.
var keys: Set<Key> { get }
The set of valid keys to choose from when identifying the applications erver to new registrations.
var primaryKey: Key? { get }
The VAPID key that identifies the push service to subscribers.
var validityDuration: Duration
The number of seconds before a cached authentication header signed by this configuration is renewed.
func encode(to encoder: any Encoder) throws
mutating func updateKeys(primaryKey: Key?, keys: Set<Key>, deprecatedKeys: Set<Key>? = nil) throws(ConfigurationError)
Update the keys that this configuration represents.
enum CodingKeys
The coding keys used to encode a VAPID configuration.
enum ContactInformation
The contact information for the push service.
enum KeyStatus
The satus of a key as it relates to a configuration.
protocol AdditiveArithmetic : Equatable
A type with values that support addition and subtraction.
protocol Comparable : Equatable
A type that can be compared using the relational operators <
, <=
, >=
, and >
.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
init(from decoder: Decoder) throws
init(integerLiteral value: Int)
init(seconds: Int)
Initialize a duration with a number of seconds.
static func days(_ days: Int) -> VAPID.Configuration.Duration
Make a duration with a number of days.
static func hours(_ hours: Int) -> VAPID.Configuration.Duration
Make a duration with a number of hours.
static func minutes(_ minutes: Int) -> VAPID.Configuration.Duration
Make a duration with a number of minutes.
static func seconds(_ seconds: Int) -> VAPID.Configuration.Duration
Make a duration with a number of seconds.
let seconds: Int
The number of seconds represented by this duration.
static func + (lhs: Self, rhs: Self) -> VAPID.Configuration.Duration
static func - (lhs: Self, rhs: Self) -> VAPID.Configuration.Duration
static func < (lhs: Self, rhs: Self) -> Bool
func encode(to encoder: any Encoder) throws
static var zero: Self { get }
The zero value.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func + (x: Self) -> Self
Returns the given number unchanged.
static func += (lhs: inout Self, rhs: Self)
static func -= (lhs: inout Self, rhs: Self)
static func ... (minimum: Self) -> PartialRangeFrom<Self>
Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self) -> PartialRangeThrough<Self>
Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self>
Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self) -> PartialRangeUpTo<Self>
Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self) -> Range<Self>
Returns a half-open range that contains its lower bound but not its upper bound.
static func <= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func > (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
func isApproximatelyEqual<Magnitude>(to other: Self, absoluteTolerance: Magnitude, relativeTolerance: Magnitude = 0, norm: (Self) -> Magnitude) -> Bool where Magnitude : FloatingPoint
Test if self
and other
are approximately equal with specified tolerances and norm.