Skip to content

Commit df8d5fe

Browse files
authored
Merge pull request #77 from auth0/release-1.0.0
Release 1.0.0
2 parents 211aa85 + 198e013 commit df8d5fe

File tree

5 files changed

+82
-22
lines changed

5 files changed

+82
-22
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Change Log
22

3+
## [1.0.0](https://github.com/auth0/Guardian.swift/tree/1.0.0) (2018-07-31)
4+
[Full Changelog](https://github.com/auth0/Guardian.swift/compare/0.5.0...1.0.0)
5+
6+
**Added**
7+
- Allow to send custom NumberFormatter for otp [\#76](https://github.com/auth0/Guardian.swift/pull/76) ([hzalaz](https://github.com/hzalaz))
8+
- Add OTP Generators [\#71](https://github.com/auth0/Guardian.swift/pull/71) ([hzalaz](https://github.com/hzalaz))
9+
10+
**Changed**
11+
- Rename Enrollment to EnrolledDevice [\#72](https://github.com/auth0/Guardian.swift/pull/72) ([hzalaz](https://github.com/hzalaz))
12+
13+
**Fixed**
14+
- Allow 204 reponse that has Data object empty [\#75](https://github.com/auth0/Guardian.swift/pull/75) ([hzalaz](https://github.com/hzalaz))
15+
16+
**Breaking changes**
17+
- Rework GuardianError [\#74](https://github.com/auth0/Guardian.swift/pull/74) ([hzalaz](https://github.com/hzalaz))
18+
- Rework Network Layer [\#73](https://github.com/auth0/Guardian.swift/pull/73) ([hzalaz](https://github.com/hzalaz))
19+
- Now the session should be configured per request. [\#70](https://github.com/auth0/Guardian.swift/pull/70) ([hzalaz](https://github.com/hzalaz))
20+
- Refactor Key handling for enroll and resolve [\#69](https://github.com/auth0/Guardian.swift/pull/69) ([hzalaz](https://github.com/hzalaz))
21+
- Refactor notification handling [\#68](https://github.com/auth0/Guardian.swift/pull/68) ([hzalaz](https://github.com/hzalaz))
22+
- Remove ObjectiveC bindings and support [\#67](https://github.com/auth0/Guardian.swift/pull/67) ([hzalaz](https://github.com/hzalaz))
23+
- Remove iOS 9 support [\#65](https://github.com/auth0/Guardian.swift/pull/65) ([hzalaz](https://github.com/hzalaz))
24+
325
## [0.5.0](https://github.com/auth0/Guardian.swift/tree/0.5.0) (2018-07-19)
426
[Full Changelog](https://github.com/auth0/Guardian.swift/compare/0.4.0...0.5.0)
527
**Closed issues**

Guardian/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.5.0</string>
18+
<string>1.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

GuardianApp/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.5.0</string>
18+
<string>1.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

GuardianTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.5.0</string>
18+
<string>1.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

README.md

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Guardian.swift (iOS)
22

3-
[![CI Status](http://img.shields.io/travis/auth0/Guardian.swift.svg?style=flat-square)](https://travis-ci.org/auth0/Guardian.swift)
3+
[![CircleCI](https://img.shields.io/circleci/project/github/auth0/Guardian.swift.svg?style=flat-square)](https://circleci.com/gh/auth0/Guardian.swift)
44
[![Coverage Status](https://img.shields.io/codecov/c/github/auth0/Guardian.swift/master.svg?style=flat-square)](https://codecov.io/github/auth0/Guardian.swift)
55
[![Version](https://img.shields.io/cocoapods/v/Guardian.svg?style=flat-square)](http://cocoadocs.org/docsets/Guardian)
66
[![License](https://img.shields.io/cocoapods/l/Guardian.svg?style=flat-square)](http://cocoadocs.org/docsets/Guardian)
77
[![Platform](https://img.shields.io/cocoapods/p/Guardian.svg?style=flat-square)](http://cocoadocs.org/docsets/Guardian)
88
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage)
9-
![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat-square)
9+
![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat-square)
1010

1111
[Guardian](https://auth0.com/docs/multifactor-authentication/guardian) is Auth0's multi-factor
1212
authentication (MFA) service that provides a simple, safe way for you to implement MFA.
@@ -20,7 +20,7 @@ multi-factor authentication from your app.
2020

2121
## Requirements
2222

23-
iOS 9.3+ and Swift 3 is required in order to use Guardian.
23+
iOS 10+ and Swift 4.1 is required in order to use Guardian.
2424

2525
## Before getting started
2626

@@ -36,15 +36,15 @@ Guardian.swift is available through [CocoaPods](http://cocoapods.org).
3636
To install it, simply add the following line to your Podfile:
3737

3838
```ruby
39-
pod 'Guardian', '~> 0.5.0'
39+
pod 'Guardian', '~> 1.0.0'
4040
```
4141

4242
#### Carthage
4343

4444
In your Cartfile add this line
4545

4646
```
47-
github "auth0/Guardian.swift" ~> 0.5.0
47+
github "auth0/Guardian.swift" ~> 1.0.0
4848
```
4949

5050
## Usage
@@ -70,7 +70,7 @@ For an enrollment you need the following things, besides your Guardian Domain:
7070

7171
- Enrollment Uri: The value encoded in the QR Code scanned from Guardian Web Widget or in your enrollment ticket sent to you, e.g. by email.
7272
- APNS Token: Apple APNS token for the device and **MUST** be a `String`containing the 64 bytes (expressed in hexadecimal format)
73-
- Key Pair: A RSA (Private/Public) key pair used to assert your identity with Auth0 Guardian
73+
- Signing & Verification Key: A RSA (Private/Public) key pair used to assert your identity with Auth0 Guardian
7474

7575
> In case your app is not yet using push notifications or you're not familiar with it, you should check their [docs](https://developer.apple.com/go/?id=push-notifications).
7676
@@ -81,11 +81,13 @@ Guardian
8181
.enroll(forDomain: "{YOUR_GUARDIAN_DOMAIN}",
8282
usingUri: "{ENROLLMENT_URI}",
8383
notificationToken: "{APNS_TOKEN}",
84-
keyPair: keyPair)
84+
signingKey: signingKey,
85+
verificationKey: verificationKey
86+
)
8587
.start { result in
8688
switch result {
87-
case .success(let enrollment):
88-
// success, we have the enrollment data available
89+
case .success(let enrolledDevice):
90+
// success, we have the enrollment device data available
8991
case .failure(let cause):
9092
// something failed, check cause to see what went wrong
9193
}
@@ -94,20 +96,44 @@ Guardian
9496

9597
On success you'll obtain the enrollment information, that should be secured stored in your application. This information includes the enrollment identifier, and the token for Guardian API associated to your device for updating or deleting your enrollment.
9698

97-
#### RSA key pair
99+
#### Signing & Verification Keys
98100

99-
Guardian.swift provides a convenience class to generate an RSA key pair and store it in iOS Keychain.
101+
Guardian.swift provides a convenience class to generate a signing key
100102

101103
```swift
102-
let rsaKeyPair = RSAKeyPair.new(
103-
usingPublicTag: "com.auth0.guardian.enroll.public",
104-
privateTag: "com.auth0.guardian.enroll.private"
105-
)
104+
let signingKey = try DataRSAPrivateKey.new()
105+
```
106+
107+
this key only exists in memory but you can obtain its `Data` representation and store securely e.g. in an encrypted SQLiteDB
108+
109+
```swift
110+
// Store data
111+
let data = signingKey.data
112+
// performthe storage
113+
114+
// Load from Storage
115+
let loadedKey = try DataRSAPrivateKey(data: data)
116+
```
117+
118+
But if you just want to store inside iOS Keychain
119+
120+
```swift
121+
let signingKey = try KeychainRSAPrivateKey.new(with: "com.myapp.mytag")
122+
```
123+
124+
It will create it and store it automatically under the supplied tag, if you want to retrieve it using the tag
125+
126+
```swift
127+
let signingKey = try KeychainRSAPrivateKey(tag: "com.myapp.mytag")
106128
```
107129

108130
> The tags should be unique since it's the identifier of each key inside iOS Keychain.
109131
110-
> Since the keys are already secured stored inside iOS Keychain, you olny need to store the identifiers
132+
and for the verification key, we can just obtain it from any `SigningKey` like this
133+
134+
```swift
135+
let verificationKey = try signingKey.verificationKey()
136+
```
111137

112138
### Allow a login request
113139

@@ -122,13 +148,25 @@ if let notification = Guardian.notification(from: userInfo) {
122148
```
123149

124150
Once you have the notification instance, you can easily allow the authentication request by using
125-
the `allow` method. You'll also need the enrollment that you obtained previously.
151+
the `allow` method. You'll also need some information from the enrolled device that you obtained previously.
126152
In case you have more than one enrollment, you'll have to find the one that has the same `id` as the
127153
notification (the `enrollmentId` property).
128154

155+
When you have the information, `device` parameter is anything that implements the protocol `AuthenticatedDevice`
156+
157+
```swift
158+
struct Authenticator: Guardian.AuthenticationDevice {
159+
let signingKey: SigningKey
160+
let localIdentifier: String
161+
}
162+
```
163+
> Local identifier is the local id of the device, by default on enroll `UIDevice.current.identifierForVendor`
164+
165+
Then just call
166+
129167
```swift
130168
Guardian
131-
.authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", andEnrollment: enrollment)
169+
.authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", device: device)
132170
.allow(notification: notification)
133171
.start { result in
134172
switch result {
@@ -147,7 +185,7 @@ you want. The reject reason will be available in the guardian logs.
147185

148186
```swift
149187
Guardian
150-
.authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", andEnrollment: enrollment)
188+
.authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", device: device)
151189
.reject(notification: notification)
152190
// or reject(notification: notification, withReason: "hacked")
153191
.start { result in

0 commit comments

Comments
 (0)