Skip to content

Commit 4e5e2d1

Browse files
committed
Merge pull request #19 from auth0/feature-jwt-string
Return JWT string representation
2 parents 0bc86cd + 066d34e commit 4e5e2d1

File tree

21 files changed

+281
-88
lines changed

21 files changed

+281
-88
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ DerivedData
2424
.bundle
2525

2626
Pods/
27-
Carthage/
28-
!Carthage/Checkouts
27+
Carthage/

.gitmodules

-6
This file was deleted.

.travis.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
reference: http://www.objc.io/issue-6/travis-ci.html
22
language: objective-c
3-
osx_image: xcode7
3+
osx_image: xcode7.1
44
before_install: true
55
install: true
6-
git:
7-
submodules: false
8-
script:
9-
- script/cibuild
6+
script:
7+
- script/cibuild
108
branches:
119
only:
1210
- master
1311
notifications:
1412
slack:
1513
secure: UIG9+o5gRYZGpRRBIB/9nFBoXvSOI3Ll63KuUMd/u/CvFpByLY0MSX5LY18v6hYqA3UNjEhOO9x1j91H7JOjbI0NYtq/7+qehUDWORaQc+NSUozKLmkIGm1M6RYayUw61J9fYpyt8AjpbGIb78i7T8ckz7dYkyhEJcGz7L+30pw=
14+
env:
15+
matrix:
16+
- SCHEME="JWTDecode-iOS" IOS_DESTINATION_VERSION="9.1" CARTHAGE_BUILD_PLATFORM="iOS"
17+
- SCHEME="JWTDecode-iOS" IOS_DESTINATION_VERSION="9.0" CARTHAGE_BUILD_PLATFORM="iOS"
18+
- SCHEME="JWTDecode-iOS" IOS_DESTINATION_VERSION="8.4" CARTHAGE_BUILD_PLATFORM="iOS"
19+
- SCHEME="JWTDecode-OSX" CARTHAGE_BUILD_PLATFORM="Mac"
20+
global:
21+
- secure: hHc0uhSg57mTBfFUX7ZwZe85IlLMS+mMgOx192fnVyeD81S2AFxaO4nWRpXHktkR68HwDsYJ4emVeoaLxZb8tkkej+nf1L3NIY3FFEJpIEAmrYMv9AoFb0ZtT1IwGOt92bll0DqzZotOVOrPVZeS8MspwZAFqXHAgBszfJut/2w=
22+
- secure: dYWR8CvhN1g1ta3+ARWO5wYUIhhA5BjTKE29Df+URdNVuJMvvtNwuE8YpI9yKKz/rp9PbKo+6jAMozbiokj2Baf8xOawQvyiRWA7c5YRslM2oNuVX33yl949JMzpJmKRJiFi59lbu8gAmI090cHiG9HVw7etpNMy3JGCx9GIJhc=

Carthage/Checkouts/Nimble

-1
This file was deleted.

Carthage/Checkouts/Quick

-1
This file was deleted.

JWTDecode.xcodeproj/project.pbxproj

+87-24
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@
1616
5F00693D1B3C7B630048928E /* JWTDecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5F0068E71B3B46240048928E /* JWTDecode.h */; settings = {ATTRIBUTES = (Public, ); }; };
1717
5F00693E1B3C7B930048928E /* JWTDecode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F0069021B3B511F0048928E /* JWTDecode.swift */; };
1818
5F0069411B3C828F0048928E /* A0JWTDecodeSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F0069401B3C828F0048928E /* A0JWTDecodeSpec.m */; };
19-
5F05AF7F1B62E9C200C4A9E6 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F05AF7D1B62E9C200C4A9E6 /* Nimble.framework */; };
20-
5F05AF801B62E9C200C4A9E6 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F05AF7D1B62E9C200C4A9E6 /* Nimble.framework */; };
21-
5F05AF811B62E9C200C4A9E6 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F05AF7E1B62E9C200C4A9E6 /* Quick.framework */; };
22-
5F05AF821B62E9C200C4A9E6 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F05AF7E1B62E9C200C4A9E6 /* Quick.framework */; };
23-
5F8B43691B9F99B400A0D5AE /* A0JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B43681B9F99B400A0D5AE /* A0JWT.swift */; settings = {ASSET_TAGS = (); }; };
24-
5F8B436A1B9F99B400A0D5AE /* A0JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B43681B9F99B400A0D5AE /* A0JWT.swift */; settings = {ASSET_TAGS = (); }; };
25-
5F8B436C1B9F9EDB00A0D5AE /* JWTHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B436B1B9F9EDB00A0D5AE /* JWTHelper.swift */; settings = {ASSET_TAGS = (); }; };
26-
5F8B436D1B9F9EDB00A0D5AE /* JWTHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B436B1B9F9EDB00A0D5AE /* JWTHelper.swift */; settings = {ASSET_TAGS = (); }; };
27-
5FE49DCD1BA0D5F700DE57D3 /* JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCC1BA0D5F700DE57D3 /* JWT.swift */; settings = {ASSET_TAGS = (); }; };
28-
5FE49DCE1BA0D5F700DE57D3 /* JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCC1BA0D5F700DE57D3 /* JWT.swift */; settings = {ASSET_TAGS = (); }; };
29-
5FE49DD01BA0D66F00DE57D3 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCF1BA0D66F00DE57D3 /* Errors.swift */; settings = {ASSET_TAGS = (); }; };
30-
5FE49DD11BA0D66F00DE57D3 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCF1BA0D66F00DE57D3 /* Errors.swift */; settings = {ASSET_TAGS = (); }; };
19+
5F2614D81C05FE850068DE71 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F2614CD1C05FDDE0068DE71 /* Quick.framework */; };
20+
5F2614D91C05FE850068DE71 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F2614CE1C05FDDE0068DE71 /* Nimble.framework */; };
21+
5F2614DA1C05FE880068DE71 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F2614D41C05FE720068DE71 /* Quick.framework */; };
22+
5F2614DB1C05FE880068DE71 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F2614D51C05FE720068DE71 /* Nimble.framework */; };
23+
5F2614DD1C05FEB90068DE71 /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5F2614CD1C05FDDE0068DE71 /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
24+
5F2614DE1C05FEB90068DE71 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5F2614CE1C05FDDE0068DE71 /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
25+
5F2614E01C05FEE20068DE71 /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5F2614D41C05FE720068DE71 /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
26+
5F2614E11C05FEE20068DE71 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5F2614D51C05FE720068DE71 /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
27+
5F8B43691B9F99B400A0D5AE /* A0JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B43681B9F99B400A0D5AE /* A0JWT.swift */; };
28+
5F8B436A1B9F99B400A0D5AE /* A0JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B43681B9F99B400A0D5AE /* A0JWT.swift */; };
29+
5F8B436C1B9F9EDB00A0D5AE /* JWTHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B436B1B9F9EDB00A0D5AE /* JWTHelper.swift */; };
30+
5F8B436D1B9F9EDB00A0D5AE /* JWTHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F8B436B1B9F9EDB00A0D5AE /* JWTHelper.swift */; };
31+
5FE49DCD1BA0D5F700DE57D3 /* JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCC1BA0D5F700DE57D3 /* JWT.swift */; };
32+
5FE49DCE1BA0D5F700DE57D3 /* JWT.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCC1BA0D5F700DE57D3 /* JWT.swift */; };
33+
5FE49DD01BA0D66F00DE57D3 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCF1BA0D66F00DE57D3 /* Errors.swift */; };
34+
5FE49DD11BA0D66F00DE57D3 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FE49DCF1BA0D66F00DE57D3 /* Errors.swift */; };
3135
/* End PBXBuildFile section */
3236

3337
/* Begin PBXContainerItemProxy section */
@@ -47,6 +51,31 @@
4751
};
4852
/* End PBXContainerItemProxy section */
4953

54+
/* Begin PBXCopyFilesBuildPhase section */
55+
5F2614DC1C05FEAD0068DE71 /* CopyFiles */ = {
56+
isa = PBXCopyFilesBuildPhase;
57+
buildActionMask = 2147483647;
58+
dstPath = "";
59+
dstSubfolderSpec = 10;
60+
files = (
61+
5F2614DD1C05FEB90068DE71 /* Quick.framework in CopyFiles */,
62+
5F2614DE1C05FEB90068DE71 /* Nimble.framework in CopyFiles */,
63+
);
64+
runOnlyForDeploymentPostprocessing = 0;
65+
};
66+
5F2614DF1C05FEDA0068DE71 /* CopyFiles */ = {
67+
isa = PBXCopyFilesBuildPhase;
68+
buildActionMask = 2147483647;
69+
dstPath = "";
70+
dstSubfolderSpec = 10;
71+
files = (
72+
5F2614E01C05FEE20068DE71 /* Quick.framework in CopyFiles */,
73+
5F2614E11C05FEE20068DE71 /* Nimble.framework in CopyFiles */,
74+
);
75+
runOnlyForDeploymentPostprocessing = 0;
76+
};
77+
/* End PBXCopyFilesBuildPhase section */
78+
5079
/* Begin PBXFileReference section */
5180
5F0068E21B3B46240048928E /* JWTDecode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JWTDecode.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5281
5F0068E61B3B46240048928E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -59,9 +88,11 @@
5988
5F0069221B3C4A7F0048928E /* JWTDecodeSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JWTDecodeSpec.swift; sourceTree = "<group>"; };
6089
5F00693F1B3C828E0048928E /* JWTDecode-iOSTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JWTDecode-iOSTests-Bridging-Header.h"; sourceTree = "<group>"; };
6190
5F0069401B3C828F0048928E /* A0JWTDecodeSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A0JWTDecodeSpec.m; sourceTree = "<group>"; };
62-
5F05AF7D1B62E9C200C4A9E6 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; };
63-
5F05AF7E1B62E9C200C4A9E6 /* Quick.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6491
5F0A5E291B9A6D4A005289CF /* JWTDecode.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = JWTDecode.playground; sourceTree = SOURCE_ROOT; };
92+
5F2614CD1C05FDDE0068DE71 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/iOS/Quick.framework; sourceTree = SOURCE_ROOT; };
93+
5F2614CE1C05FDDE0068DE71 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = SOURCE_ROOT; };
94+
5F2614D41C05FE720068DE71 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quick.framework; path = Carthage/Build/Mac/Quick.framework; sourceTree = SOURCE_ROOT; };
95+
5F2614D51C05FE720068DE71 /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/Mac/Nimble.framework; sourceTree = SOURCE_ROOT; };
6596
5F8B43681B9F99B400A0D5AE /* A0JWT.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = A0JWT.swift; sourceTree = "<group>"; };
6697
5F8B436B1B9F9EDB00A0D5AE /* JWTHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JWTHelper.swift; sourceTree = "<group>"; };
6798
5FE49DCC1BA0D5F700DE57D3 /* JWT.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JWT.swift; sourceTree = "<group>"; };
@@ -80,9 +111,9 @@
80111
isa = PBXFrameworksBuildPhase;
81112
buildActionMask = 2147483647;
82113
files = (
114+
5F2614D91C05FE850068DE71 /* Nimble.framework in Frameworks */,
115+
5F2614D81C05FE850068DE71 /* Quick.framework in Frameworks */,
83116
5F0068EE1B3B46240048928E /* JWTDecode.framework in Frameworks */,
84-
5F05AF811B62E9C200C4A9E6 /* Quick.framework in Frameworks */,
85-
5F05AF7F1B62E9C200C4A9E6 /* Nimble.framework in Frameworks */,
86117
);
87118
runOnlyForDeploymentPostprocessing = 0;
88119
};
@@ -97,9 +128,9 @@
97128
isa = PBXFrameworksBuildPhase;
98129
buildActionMask = 2147483647;
99130
files = (
131+
5F2614DB1C05FE880068DE71 /* Nimble.framework in Frameworks */,
132+
5F2614DA1C05FE880068DE71 /* Quick.framework in Frameworks */,
100133
5F0069141B3B532E0048928E /* JWTDecode.framework in Frameworks */,
101-
5F05AF821B62E9C200C4A9E6 /* Quick.framework in Frameworks */,
102-
5F05AF801B62E9C200C4A9E6 /* Nimble.framework in Frameworks */,
103134
);
104135
runOnlyForDeploymentPostprocessing = 0;
105136
};
@@ -163,13 +194,39 @@
163194
5F0068F21B3B46240048928E /* Supporting Files */ = {
164195
isa = PBXGroup;
165196
children = (
166-
5F05AF7D1B62E9C200C4A9E6 /* Nimble.framework */,
167-
5F05AF7E1B62E9C200C4A9E6 /* Quick.framework */,
197+
5F2614D11C05FE0A0068DE71 /* Frameworks */,
168198
5F0068F31B3B46240048928E /* Info.plist */,
169199
);
170200
name = "Supporting Files";
171201
sourceTree = "<group>";
172202
};
203+
5F2614D11C05FE0A0068DE71 /* Frameworks */ = {
204+
isa = PBXGroup;
205+
children = (
206+
5F2614D31C05FE1B0068DE71 /* OSX */,
207+
5F2614D21C05FE160068DE71 /* iOS */,
208+
);
209+
name = Frameworks;
210+
sourceTree = "<group>";
211+
};
212+
5F2614D21C05FE160068DE71 /* iOS */ = {
213+
isa = PBXGroup;
214+
children = (
215+
5F2614CD1C05FDDE0068DE71 /* Quick.framework */,
216+
5F2614CE1C05FDDE0068DE71 /* Nimble.framework */,
217+
);
218+
name = iOS;
219+
sourceTree = "<group>";
220+
};
221+
5F2614D31C05FE1B0068DE71 /* OSX */ = {
222+
isa = PBXGroup;
223+
children = (
224+
5F2614D41C05FE720068DE71 /* Quick.framework */,
225+
5F2614D51C05FE720068DE71 /* Nimble.framework */,
226+
);
227+
name = OSX;
228+
sourceTree = "<group>";
229+
};
173230
/* End PBXGroup section */
174231

175232
/* Begin PBXHeadersBuildPhase section */
@@ -217,6 +274,7 @@
217274
5F0068E91B3B46240048928E /* Sources */,
218275
5F0068EA1B3B46240048928E /* Frameworks */,
219276
5F0068EB1B3B46240048928E /* Resources */,
277+
5F2614DC1C05FEAD0068DE71 /* CopyFiles */,
220278
);
221279
buildRules = (
222280
);
@@ -253,6 +311,7 @@
253311
5F00690F1B3B532E0048928E /* Sources */,
254312
5F0069101B3B532E0048928E /* Frameworks */,
255313
5F0069111B3B532E0048928E /* Resources */,
314+
5F2614DF1C05FEDA0068DE71 /* CopyFiles */,
256315
);
257316
buildRules = (
258317
);
@@ -495,6 +554,7 @@
495554
DYLIB_COMPATIBILITY_VERSION = 1;
496555
DYLIB_CURRENT_VERSION = 1;
497556
DYLIB_INSTALL_NAME_BASE = "@rpath";
557+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
498558
INFOPLIST_FILE = JWTDecode/Info.plist;
499559
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
500560
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -515,6 +575,7 @@
515575
DYLIB_COMPATIBILITY_VERSION = 1;
516576
DYLIB_CURRENT_VERSION = 1;
517577
DYLIB_INSTALL_NAME_BASE = "@rpath";
578+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
518579
INFOPLIST_FILE = JWTDecode/Info.plist;
519580
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
520581
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -531,8 +592,8 @@
531592
buildSettings = {
532593
CLANG_ENABLE_MODULES = YES;
533594
FRAMEWORK_SEARCH_PATHS = (
534-
"$(SDKROOT)/Developer/Library/Frameworks",
535595
"$(inherited)",
596+
"$(PROJECT_DIR)/Carthage/Build/iOS",
536597
);
537598
GCC_PREPROCESSOR_DEFINITIONS = (
538599
"DEBUG=1",
@@ -552,8 +613,8 @@
552613
buildSettings = {
553614
CLANG_ENABLE_MODULES = YES;
554615
FRAMEWORK_SEARCH_PATHS = (
555-
"$(SDKROOT)/Developer/Library/Frameworks",
556616
"$(inherited)",
617+
"$(PROJECT_DIR)/Carthage/Build/iOS",
557618
);
558619
INFOPLIST_FILE = JWTDecodeTests/Info.plist;
559620
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@@ -572,6 +633,7 @@
572633
DYLIB_COMPATIBILITY_VERSION = 1;
573634
DYLIB_CURRENT_VERSION = 1;
574635
DYLIB_INSTALL_NAME_BASE = "@rpath";
636+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
575637
FRAMEWORK_VERSION = A;
576638
GCC_PREPROCESSOR_DEFINITIONS = (
577639
"DEBUG=1",
@@ -597,6 +659,7 @@
597659
DYLIB_COMPATIBILITY_VERSION = 1;
598660
DYLIB_CURRENT_VERSION = 1;
599661
DYLIB_INSTALL_NAME_BASE = "@rpath";
662+
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
600663
FRAMEWORK_VERSION = A;
601664
INFOPLIST_FILE = JWTDecode/Info.plist;
602665
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -616,8 +679,8 @@
616679
COMBINE_HIDPI_IMAGES = YES;
617680
DEBUG_INFORMATION_FORMAT = dwarf;
618681
FRAMEWORK_SEARCH_PATHS = (
619-
"$(DEVELOPER_FRAMEWORKS_DIR)",
620682
"$(inherited)",
683+
"$(PROJECT_DIR)/Carthage/Build/Mac",
621684
);
622685
GCC_PREPROCESSOR_DEFINITIONS = (
623686
"DEBUG=1",
@@ -637,8 +700,8 @@
637700
buildSettings = {
638701
COMBINE_HIDPI_IMAGES = YES;
639702
FRAMEWORK_SEARCH_PATHS = (
640-
"$(DEVELOPER_FRAMEWORKS_DIR)",
641703
"$(inherited)",
704+
"$(PROJECT_DIR)/Carthage/Build/Mac",
642705
);
643706
INFOPLIST_FILE = JWTDecodeTests/Info.plist;
644707
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";

JWTDecode.xcworkspace/contents.xcworkspacedata

-13
This file was deleted.

JWTDecode/JWT.swift

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public protocol JWT {
3232
var body: [String: AnyObject] { get }
3333
/// token signature part
3434
var signature: String? { get }
35+
/// jwt string value
36+
var stringValue: String { get }
37+
3538

3639
/// value of `exp` claim if available
3740
var expiresAt: NSDate? { get }

JWTDecode/JWTDecode.swift

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct DecodedJWT: JWT {
3939
let header: [String: AnyObject]
4040
let body: [String: AnyObject]
4141
let signature: String?
42+
let stringValue: String
4243

4344
init(jwt: String) throws {
4445
let parts = jwt.componentsSeparatedByString(".")
@@ -49,6 +50,7 @@ struct DecodedJWT: JWT {
4950
self.header = try decodeJWTPart(parts[0])
5051
self.body = try decodeJWTPart(parts[1])
5152
self.signature = parts[2]
53+
self.stringValue = jwt
5254
}
5355

5456
var expiresAt: NSDate? { return claim("exp") }

JWTDecodeTests/JWTDecodeSpec.swift

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ class JWTDecodeSpec: QuickSpec {
4747
expect(payload).to(equal(["sub": "myid", "name": "Shawarma Monk"]))
4848
}
4949

50+
it("should return original jwt string representation") {
51+
let jwtString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjb20uc29td2hlcmUuZmFyLmJleW9uZDphcGkiLCJpc3MiOiJhdXRoMCIsInVzZXJfcm9sZSI6ImFkbWluIn0.sS84motSLj9HNTgrCPcAjgZIQ99jXNN7_W9fEIIfxz0"
52+
let jwt = try! decode(jwtString)
53+
expect(jwt.stringValue).to(equal(jwtString))
54+
}
55+
5056
it("should return expire date") {
5157
expect(expiredJWT().expiresAt).toNot(beNil())
5258
}

script/.env

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11

2+
REQUIRED_CARTHAGE_VERSION=0.10
3+
CARTHAGE_BUILD_PLATFORM=${CARTHAGE_BUILD_PLATFORM:-"iOS"}
4+
CARTHAGE_NO_USE_BINARIES=${CARTHAGE_NO_USE_BINARIES:-"true"}
25
PROJECT_NAME=JWTDecode
3-
XCODE_WORKSPACE=JWTDecode.xcworkspace
4-
XCODE_PROJECT=
6+
XCODE_WORKSPACE=
7+
XCODE_PROJECT=JWTDecode.xcodeproj
8+
IOS_DESTINATION_VERSION=${IOS_DESTINATION_VERSION:-"latest"}
9+
IOS_DESTINATION_SIMULATOR_NAME=${IOS_DESTINATION_SIMULATOR_NAME:-"iPhone 6"}
10+
OSX_DESTINATION_ARCH=${OSX_DESTINATION_ARCH:-""}
11+
LINT_PODSPEC=${LINT_PODSPEC:-"no"}
12+
LINT_PODSPEC_PARAMETERS=${LINT_PODSPEC_PARAMETERS:-" --allow-warnings"}
13+
DISABLE_CARTHAGE_CACHE_CONFIG=yes

0 commit comments

Comments
 (0)