You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+49-60Lines changed: 49 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -2,57 +2,60 @@
2
2
3
3
First release of Guardian for iOS
4
4
5
-
### Requirements
6
-
7
-
iOS 9.3+ and Swift 3 is required in order to use Guardian.
8
-
9
-
### Install
5
+
##Install
10
6
11
7
#### CocoaPods
12
8
13
9
Guardian.swift is available through [CocoaPods](http://cocoapods.org).
14
10
To install it, simply add the following line to your Podfile:
15
11
16
12
```ruby
17
-
pod "Guardian", '~> 0.1.0'
13
+
pod "Guardian"
18
14
```
19
15
20
16
#### Carthage
21
17
22
18
In your Cartfile add this line
23
19
24
20
```
25
-
github "auth0/Guardian.swift" ~> 0.1.0
21
+
github "auth0/Guardian.swift"
26
22
```
27
23
28
-
###Usage
24
+
## Usage
29
25
30
-
To get things going you'll have to import the library:
26
+
`Guardian` is the core of the SDK. To get things going you'll have to import the library:
31
27
32
28
```swift
33
29
importGuardian
34
30
```
35
31
36
-
Then you'll need the domain for your specific tenant/url:
32
+
Then you'll need the Auth0 Guarduan domain for your account:
37
33
38
34
```swift
39
-
let domain ="<TENANT>.guardian.auth0.com"
35
+
let domain ="{YOUR_ACCOUNT_NAME}.guardian.auth0.com"
40
36
```
41
37
42
-
To create an enroll, create a pair of RSA keys, obtain the Guardian enrollment data from a Guardian QR code and use it like this:
38
+
### Enroll
43
39
44
-
```swift
45
-
let rsaKeyPair = RSAKeyPair.new(usingPublicTag: "com.auth0.guardian.enroll.public",
46
-
privateTag: "com.auth0.guardian.enroll.private")
40
+
An enrollment is a link between the second factor and an Auth0 account. When an account is enrolled
41
+
you'll need it to provide the second factor required to verify the identity.
42
+
43
+
For an enrollment you need the following things, besides your Guardian Domain:
44
+
45
+
- 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.
46
+
- APNS Token: Apple APNS token for the device and **MUST** be a `String`containing the 64 bytes (expressed in hexadecimal format)
47
+
- Key Pair: A RSA (Private/Public) key pair used to assert your identity with Auth0 Guardian
47
48
48
-
let enrollmentUriFromQr: String=...// the URI obtained from a Guardian QR code
49
-
let apnsToken: String=...// the APNS token of this device, where notifications will be sent
49
+
> 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).
50
50
51
+
after your have all of them, you can enroll your device
52
+
53
+
```swift
51
54
Guardian
52
-
.enroll(forDomain: domain,
53
-
usingUri: enrollmentUriFromQr,
54
-
notificationToken: apnsToken,
55
-
keyPair: rsaKeyPair)
55
+
.enroll(forDomain: "{YOUR_GUARDIAN_DOMAIN}",
56
+
usingUri: "{ENROLLMENT_URI}",
57
+
notificationToken: "{APNS_TOKEN}",
58
+
keyPair: keyPair)
56
59
.start { result in
57
60
switch result {
58
61
case .success(let enrollment):
@@ -63,62 +66,48 @@ Guardian
63
66
}
64
67
```
65
68
66
-
To unenroll just call:
69
+
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.
70
+
71
+
#### RSA key pair
72
+
73
+
Guardian.swift provides a convenience class to generate an RSA key pair and store it in iOS Keychain.
0 commit comments