Skip to content

Commit 84e7ecc

Browse files
chore: remove registration requirement and update license (#97)
1 parent cfbdb4b commit 84e7ecc

6 files changed

Lines changed: 24 additions & 177 deletions

File tree

LICENSE.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# Ionic Portals License 1.0.0
1+
# Ionic Portals License 2.0.0
22

3-
Based on the text of the licenses in the Polyform Project with new account registration conditions.
3+
Based on the text of the licenses in the Polyform Project with new conditions requiring a separate commercial agreement.
44

55
## Acceptance
66

77
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
88

99
## Copyright License
1010

11-
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it, but only so long as you comply with the Account Registration Feature requirement below. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
11+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it, but only so long as you comply with the Separate Commercial Agreement requirement below. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
1212

13-
## Account Registration Feature
13+
## Separate Commercial Agreement
1414

15-
You must preserve, and you must not remove or modify, the Account Registration Feature in the software.
15+
You must have a valid and active Separate Commercial Agreement in place with Drifty Co., d/b/a Ionic, under which you have purchased or otherwise received rights to use Ionic Portals.
1616

1717
## Distribution License
1818

19-
The licensor grants you an additional copyright license to distribute copies of the software, but only so long as you comply with the Account Registration Feature requirement above and the Notice requirement below. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
19+
The licensor grants you an additional copyright license to distribute copies of the software, but only so long as you comply with the Separate Commercial Agreement requirement above and the Notice requirement below. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
2020

2121
## Notices
2222

@@ -26,7 +26,7 @@ You must ensure that anyone who gets a copy of any part of the software from you
2626
2727
## Changes and New Works License
2828

29-
The licensor grants you an additional copyright license to make changes and new works based on the software, but only so long as you comply with the Account Registration Feature requirement above.
29+
The licensor grants you an additional copyright license to make changes and new works based on the software, but only so long as you comply with the Separate Commercial Agreement requirement above.
3030

3131
## Patent License
3232

@@ -52,6 +52,10 @@ The first time you are notified in writing that you have violated any of these t
5252

5353
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
5454

55+
## Order of Precedence
56+
57+
To the extent there is a conflict between the scope of license rights defined in the Separate Commercial Agreement and in this license, the Separate Commercial Agreement shall take precedence.
58+
5559
## Definitions
5660

5761
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
@@ -63,5 +67,3 @@ The **licensor** is the individual or entity offering these terms, and the **sof
6367
**Your licenses** are all the licenses granted to you for the software under these terms.
6468

6569
**Use** means anything you do with the software requiring one of your licenses.
66-
67-
**Account Registration Feature** is the portion of the software marked by the licensor as the Account Registration Feature in the software. The Account Registration Feature may be a license key, token, or any other such mechanism designated by the licensor.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Ionic Portals is a supercharged native Web View component for iOS and Android th
2828

2929
See our docs to [get started with Portals](https://ionic.io/docs/portals/getting-started/guide).
3030

31-
## Registration
31+
## License
3232

33-
The Ionic Portals library for Android and iOS requires a license key to use. Once you have integrated Portals into your project, login to your ionic account to get a key. See our doc on [how to register and get your Portals license key](https://ionic.io/docs/portals/how-to/get-a-product-key) and refer to the [Android](https://ionic.io/docs/portals/getting-started/android) or [iOS](https://ionic.io/docs/portals/getting-started/iOS) getting started guides to see where to add your key.
33+
Use of Ionic Portals requires a valid and active commercial agreement with Ionic.
3434

3535
## FAQ
3636

Sources/IonicPortals/IonicPortals.docc/IonicPortals.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ Seamlessly integrate web experiences into your native application.
44

55
## Overview
66

7-
IonicPortals provides tools to configure, render, and communicate with embedded web experiences by leveraging the [Capacitor](https://capacitorjs.com) runtime. To get started with IonicPortals, you'll need to register for a [product key](https://ionic.io/register-portals). IonicPortals is free to use in non-production environments and requires a license to use in production if your business makes over $1M USD in annual revenue.
7+
IonicPortals provides tools to configure, render, and communicate with embedded web experiences by leveraging the [Capacitor](https://capacitorjs.com) runtime. Use of Ionic Portals requires a valid and active commercial agreement with Ionic.
88

99
## Topics
1010

11-
### Registration
12-
13-
- ``PortalsRegistrationManager``
14-
1511
### Creating a Portal
1612

1713
- ``Portal``

Sources/IonicPortals/PortalView/PortalUIView.swift

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import WebKit
33
import UIKit
44
import Capacitor
55
import IonicLiveUpdates
6-
import SwiftUI
76

87
/// A UIKit UIView to display ``Portal`` content
98
@objc(IONPortalUIView)
@@ -84,23 +83,11 @@ public class PortalUIView: UIView {
8483
}
8584

8685
private func initView () {
87-
if PortalsRegistrationManager.shared.isRegistered {
88-
if let liveUpdateConfig = portal.liveUpdateConfig {
89-
self.liveUpdatePath = portal.liveUpdateManager.latestAppDirectory(for: liveUpdateConfig.appId)
90-
}
91-
92-
addPinnedSubview(webView)
93-
} else {
94-
let showRegistrationError = PortalsRegistrationManager.shared.registrationState == .error
95-
let _view = Unregistered(shouldShowRegistrationError: showRegistrationError)
96-
.frame(maxWidth: .infinity, maxHeight: .infinity)
97-
.edgesIgnoringSafeArea(.all)
98-
.background(Color.portalBlue)
99-
100-
let view = UIHostingController(rootView: _view).view
101-
102-
addPinnedSubview(view!)
86+
if let liveUpdateConfig = portal.liveUpdateConfig {
87+
self.liveUpdatePath = portal.liveUpdateManager.latestAppDirectory(for: liveUpdateConfig.appId)
10388
}
89+
90+
addPinnedSubview(webView)
10491
}
10592

10693
private func registerPlugins() {
Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,21 @@
11
import Foundation
2-
import UIKit
32

4-
/// Manages the registration lifecycle
3+
/// Registration is no longer required for Ionic Portals.
4+
@available(*, deprecated, message: "Registration is no longer required.")
55
@objc(IONPortalsRegistrationManager)
66
public class PortalsRegistrationManager: NSObject {
7-
enum RegistrationState: Equatable {
8-
case unregistered(messageShown: Bool)
9-
case registered
10-
case error
11-
}
12-
137
private override init() {}
148

159
/// The default singleton
1610
@objc public static let shared = PortalsRegistrationManager()
1711

18-
internal private(set) var registrationState: RegistrationState = .unregistered(messageShown: false)
19-
20-
/// Whether Portals has been registered.
21-
/// Will be true when ``register(key:)`` has been called with a valid key.
12+
/// Always `true`. Registration is no longer required.
2213
@objc public var isRegistered: Bool {
23-
switch registrationState {
24-
case .unregistered, .error:
25-
return false
26-
case .registered:
27-
return true
28-
}
14+
true
2915
}
3016

31-
/// Validates that a valid registration key has been procured from [http://ionic.io/register-portals](http://ionic.io/register-portals)
32-
/// - Parameter key: The registration key
17+
/// No-op. Registration is no longer required.
18+
/// - Parameter key: Ignored.
3319
@objc public func register(key: String) {
34-
registrationState = validate(key)
35-
}
36-
37-
private func base64(from base64Url: String) -> String {
38-
var base64 = base64Url
39-
.replacingOccurrences(of: "-", with: "+")
40-
.replacingOccurrences(of: "_", with: "/")
41-
42-
let remainder = base64.count % 4
43-
guard remainder > 0 else { return base64 }
44-
45-
let padding = 4 - remainder
46-
base64 += String(repeating: "=", count: padding)
47-
return base64
48-
}
49-
50-
private func validate(_ token: String) -> RegistrationState {
51-
let publicKeyBase64 =
52-
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1+gMC3aJVGX4ha5asmEF" +
53-
"TfP0FTFQlCD8d/J+dhp5dpx3ErqSReru0QSUaCRCEGV/ZK3Vp5lnv1cREQDG5H/t" +
54-
"Xm9Ao06b0QJYtsYhcPgRUU9awDI7jRKueXyAq4zAx0RHZlmOsTf/cNwRnmRnkyJP" +
55-
"a21mLNClmdPlhWjS6AHjaYe79ieAsftFA+QodtzoCo+w9A9YCvc6ngGOFoLIIbzs" +
56-
"jv6h9ES27mi5BUqhoHsetS4u3/pCbsV2U3z255gtjANtdIX/c5inepLuAjyc1aPz" +
57-
"2eu4TbzabvJnmNStje82NW36Qij1mupc4e7dYaq0aMNQyHSWk1/CuIcqEYlnK1mb" +
58-
"kQIDAQAB"
59-
60-
let pubKeyData = Data(base64Encoded: publicKeyBase64)
61-
let attributes: [String: Any] = [
62-
kSecAttrKeyType as String: kSecAttrKeyTypeRSA,
63-
kSecAttrKeyClass as String: kSecAttrKeyClassPublic
64-
]
65-
let publicKey = SecKeyCreateWithData(pubKeyData! as NSData, attributes as NSDictionary, nil)!
66-
67-
let parts = token.split(separator: ".")
68-
if parts.count != 3 {
69-
printRegistrationErrorMessage()
70-
return .error
71-
}
72-
let headerAndPayload = "\(parts[0]).\(parts[1])"
73-
let signature = String(parts[2])
74-
75-
let headersAndPayloadData = headerAndPayload.data(using: .ascii)! as CFData
76-
let signatureData = Data(base64Encoded: base64(from: signature))! as CFData
77-
78-
var error: Unmanaged<CFError>?
79-
80-
let result = SecKeyVerifySignature(
81-
publicKey,
82-
.rsaSignatureMessagePKCS1v15SHA256,
83-
headersAndPayloadData,
84-
signatureData,
85-
&error
86-
)
87-
88-
let state: RegistrationState = result ? .registered : .error
89-
90-
if case .error = state {
91-
printRegistrationErrorMessage()
92-
}
93-
94-
return state
95-
}
96-
97-
private func printRegistrationErrorMessage() {
98-
print("Error validating your key for Ionic Portals. Check your key and try again.")
99-
}
100-
101-
private func unregisteredMessage() {
102-
if case .unregistered(messageShown: false) = registrationState {
103-
print("Don't forget to register your copy of portals! Register at: ionic.io/register-portals")
104-
registrationState = .unregistered(messageShown: true)
105-
}
10620
}
10721
}
108-

Sources/IonicPortals/UnregisteredView.swift

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)