Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---
name: swift
scm: github.com/pubnub/swift
version: "9.3.1"
version: "9.3.2"
schema: 1
changelog:
- date: 2025-08-06
version: 9.3.2
changes:
- type: bug
text: "Implement missing token parsing logic in KMP layer (internal use)."
- date: 2025-07-31
version: 9.3.1
changes:
Expand Down Expand Up @@ -713,7 +718,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: PubNub
location: https://github.com/pubnub/swift/archive/refs/tags/9.3.1.zip
location: https://github.com/pubnub/swift/archive/refs/tags/9.3.2.zip
supported-platforms:
supported-operating-systems:
macOS:
Expand Down
20 changes: 12 additions & 8 deletions PubNub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@
3D758DD52AB48A6A005D2B36 /* CryptorHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D758DD32AB48A6A005D2B36 /* CryptorHeader.swift */; };
3D758DD62AB48A6A005D2B36 /* CryptorHeaderWithinStreamFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D758DD42AB48A6A005D2B36 /* CryptorHeaderWithinStreamFinder.swift */; };
3D8102AA2C009AA5005E3607 /* KMPAppContextEventResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8102A92C009AA5005E3607 /* KMPAppContextEventResult.swift */; };
3D867D1D2E422E6E00B03EEE /* KMPPAMToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D867D1C2E422E6E00B03EEE /* KMPPAMToken.swift */; };
3D8BAC102B8C96D70059A5C3 /* DependencyContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8BAC0F2B8C96D70059A5C3 /* DependencyContainer.swift */; };
3D9134972A1216F7000A5124 /* PubNubPushTargetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9134962A1216F7000A5124 /* PubNubPushTargetTests.swift */; };
3DA0C7C92BFDF538000FFE6C /* KMPPubNub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DA0C7C82BFDF538000FFE6C /* KMPPubNub.swift */; };
Expand Down Expand Up @@ -1064,6 +1065,7 @@
3D758DD32AB48A6A005D2B36 /* CryptorHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CryptorHeader.swift; sourceTree = "<group>"; };
3D758DD42AB48A6A005D2B36 /* CryptorHeaderWithinStreamFinder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CryptorHeaderWithinStreamFinder.swift; sourceTree = "<group>"; };
3D8102A92C009AA5005E3607 /* KMPAppContextEventResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPAppContextEventResult.swift; sourceTree = "<group>"; };
3D867D1C2E422E6E00B03EEE /* KMPPAMToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPPAMToken.swift; sourceTree = "<group>"; };
3D8BAC0F2B8C96D70059A5C3 /* DependencyContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyContainer.swift; sourceTree = "<group>"; };
3D9134962A1216F7000A5124 /* PubNubPushTargetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PubNubPushTargetTests.swift; sourceTree = "<group>"; };
3DA0C7C82BFDF538000FFE6C /* KMPPubNub.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMPPubNub.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2092,6 +2094,7 @@
3DBFF2C22C2300F500142985 /* KMPSubscription.swift */,
3D3C38822C47D62700E782E7 /* KMPError.swift */,
3D7062C32D26AA20000729E1 /* KMPAppContextIncludeFields.swift */,
3D867D1C2E422E6E00B03EEE /* KMPPAMToken.swift */,
);
path = Wrappers;
sourceTree = "<group>";
Expand Down Expand Up @@ -3623,6 +3626,7 @@
3D758DCE2AB0A835005D2B36 /* LegacyCryptor.swift in Sources */,
3DB925812B7AA75F001B7E90 /* SubscribeMessagePayload+PubNubEvent.swift in Sources */,
35A66A7E22F861BA00AC67A9 /* SubscriptionSession.swift in Sources */,
3D867D1D2E422E6E00B03EEE /* KMPPAMToken.swift in Sources */,
3DB925872B7AA75F001B7E90 /* SessionStream.swift in Sources */,
3D7411A32C171F2B002267B8 /* Int+NSNumber.swift in Sources */,
3D339C7C2BFF828B00197342 /* KMPMessage.swift in Sources */,
Expand Down Expand Up @@ -4031,7 +4035,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4082,7 +4086,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4190,7 +4194,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4243,7 +4247,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4364,7 +4368,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4416,7 +4420,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -4896,7 +4900,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
Expand Down Expand Up @@ -4939,7 +4943,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 9.3.1;
MARKETING_VERSION = 9.3.2;
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
Expand Down
2 changes: 1 addition & 1 deletion PubNubSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PubNubSwift'
s.version = '9.3.1'
s.version = '9.3.2'
s.homepage = 'https://github.com/pubnub/swift'
s.documentation_url = 'https://www.pubnub.com/docs/swift-native/pubnub-swift-sdk'
s.authors = { 'PubNub, Inc.' => 'support@pubnub.com' }
Expand Down
2 changes: 1 addition & 1 deletion Sources/PubNub/Helpers/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum Constant {

static let pubnubSwiftSDKName: String = "PubNubSwift"

static let pubnubSwiftSDKVersion: String = "9.3.1"
static let pubnubSwiftSDKVersion: String = "9.3.2"

static let appBundleId: String = {
if let info = Bundle.main.infoDictionary,
Expand Down
8 changes: 8 additions & 0 deletions Sources/PubNub/KMP/KMPPubNub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public extension KMPPubNub {
pubnub.set(token: token)
}

func parse(token: String) -> KMPPAMToken? {
if let token = pubnub.parse(token: token) {
return KMPPAMToken(from: token)
} else {
return nil
}
}

func getToken() -> String? {
pubnub.configuration.authToken
}
Expand Down
70 changes: 70 additions & 0 deletions Sources/PubNub/KMP/Wrappers/KMPPAMToken.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// KMPPAMToken.swift
//
// Copyright (c) PubNub Inc.
// All rights reserved.
//
// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.
//
// IMPORTANT NOTE FOR DEVELOPERS USING THIS SDK
//
// All public symbols in this file are intended to allow interoperation with Kotlin Multiplatform for other PubNub frameworks.
// While these symbols are public, they are intended strictly for internal usage.
//
// External developers should refrain from directly using these symbols in their code, as their implementation details
// may change in future versions of the framework, potentially leading to breaking changes.

import Foundation

@objc public class KMPPAMToken: NSObject {
@objc public let version: NSNumber
@objc public let timestamp: NSNumber
@objc public let ttl: NSNumber
@objc public let authorizedUUID: String
@objc public let resources: KMPPAMTokenResource
@objc public let patterns: KMPPAMTokenResource
@objc public let meta: KMPAnyJSON

init(from token: PAMToken) {
version = NSNumber(value: token.version)
timestamp = NSNumber(value: token.timestamp)
ttl = NSNumber(value: token.ttl)
authorizedUUID = token.authorizedUUID ?? ""
resources = KMPPAMTokenResource(from: token.resources)
patterns = KMPPAMTokenResource(from: token.patterns)
meta = KMPAnyJSON(token.meta)
}
}

@objc public class KMPPAMTokenResource: NSObject {
@objc public let channels: [String: KMPPAMPermission]
@objc public let channelGroups: [String: KMPPAMPermission]
@objc public let uuids: [String: KMPPAMPermission]

init(from resource: PAMTokenResource) {
channels = resource.channels.compactMapValues { KMPPAMPermission(from: $0) }
channelGroups = resource.groups.compactMapValues { KMPPAMPermission(from: $0) }
uuids = resource.uuids.compactMapValues { KMPPAMPermission(from: $0) }
}
}

@objc public class KMPPAMPermission: NSObject {
@objc public let read: Bool
@objc public let write: Bool
@objc public let manage: Bool
@objc public let delete: Bool
@objc public let get: Bool
@objc public let update: Bool
@objc public let join: Bool

init(from permission: PAMPermission) {
read = permission.contains(.read)
write = permission.contains(.write)
manage = permission.contains(.manage)
delete = permission.contains(.delete)
get = permission.contains(.get)
update = permission.contains(.update)
join = permission.contains(.join)
}
}
Loading