From 66e9814373ff9c95fea3f361f46419f596f0aa3b Mon Sep 17 00:00:00 2001 From: David Jones Date: Tue, 24 Sep 2019 11:23:12 +0100 Subject: [PATCH 1/4] feat: Make base64url Data extensions public --- Sources/SwiftJWT/Data+Base64URLEncoded.swift | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Sources/SwiftJWT/Data+Base64URLEncoded.swift b/Sources/SwiftJWT/Data+Base64URLEncoded.swift index 04d86c9..f60532c 100644 --- a/Sources/SwiftJWT/Data+Base64URLEncoded.swift +++ b/Sources/SwiftJWT/Data+Base64URLEncoded.swift @@ -1,5 +1,5 @@ /** - * Copyright IBM Corporation 2017 + * Copyright IBM Corporation 2017-2019 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,25 @@ import Foundation - +/// Convenience extensions to `Data` for converting to and from base64url encoding. extension Data { - func base64urlEncodedString() -> String { + + /// Returns a `String` representation of this data, encoded in base64url format + /// as defined in RFC4648 (https://tools.ietf.org/html/rfc4648). + /// + /// This is the appropriate format for encoding the header and claims of a JWT. + public func base64urlEncodedString() -> String { let result = self.base64EncodedString() return result.replacingOccurrences(of: "+", with: "-") .replacingOccurrences(of: "/", with: "_") .replacingOccurrences(of: "=", with: "") } - init?(base64urlEncoded: String) { + /// Initializes a new `Data` from the base64url-encoded `String` provided. The + /// base64url encoding is defined in RFC4648 (https://tools.ietf.org/html/rfc4648). + /// + /// This is appropriate for reading the header or claims portion of a JWT string. + public init?(base64urlEncoded: String) { let paddingLength = 4 - base64urlEncoded.count % 4 let padding = (paddingLength < 4) ? String(repeating: "=", count: paddingLength) : "" let base64EncodedString = base64urlEncoded From 642842870ae62b75496fff1b39773b1313495b6e Mon Sep 17 00:00:00 2001 From: Auto-Jazzy Date: Tue, 24 Sep 2019 10:33:33 +0000 Subject: [PATCH 2/4] [jazzy-doc] Documentation update --- docs/Classes.html | 23 +- docs/Classes/ClaimsMicroProfile.html | 18 +- docs/Classes/ClaimsOpenID.html | 18 +- docs/Classes/ClaimsStandardJWT.html | 18 +- docs/Classes/JWTDecoder.html | 34 ++- docs/Classes/JWTEncoder.html | 34 ++- docs/Extensions.html | 172 +++++++++++++ docs/Extensions/Data.html | 210 ++++++++++++++++ docs/Protocols.html | 15 +- docs/Protocols/Claims.html | 20 +- docs/Structs.html | 23 +- docs/Structs/AddressClaim.html | 14 +- docs/Structs/Header.html | 20 +- docs/Structs/JWT.html | 36 +-- docs/Structs/JWTError.html | 61 ++++- docs/Structs/JWTSigner.html | 198 +++++++++++++-- docs/Structs/JWTVerifier.html | 210 +++++++++++++--- docs/Structs/ValidateClaimsResult.html | 32 ++- docs/css/jazzy.css | 10 +- .../Contents/Resources/Documents/Classes.html | 23 +- .../Documents/Classes/ClaimsMicroProfile.html | 18 +- .../Documents/Classes/ClaimsOpenID.html | 18 +- .../Documents/Classes/ClaimsStandardJWT.html | 18 +- .../Documents/Classes/JWTDecoder.html | 34 ++- .../Documents/Classes/JWTEncoder.html | 34 ++- .../Resources/Documents/Extensions.html | 172 +++++++++++++ .../Resources/Documents/Extensions/Data.html | 210 ++++++++++++++++ .../Resources/Documents/Protocols.html | 15 +- .../Resources/Documents/Protocols/Claims.html | 20 +- .../Contents/Resources/Documents/Structs.html | 23 +- .../Documents/Structs/AddressClaim.html | 14 +- .../Resources/Documents/Structs/Header.html | 20 +- .../Resources/Documents/Structs/JWT.html | 36 +-- .../Resources/Documents/Structs/JWTError.html | 61 ++++- .../Documents/Structs/JWTSigner.html | 198 +++++++++++++-- .../Documents/Structs/JWTVerifier.html | 210 +++++++++++++--- .../Structs/ValidateClaimsResult.html | 32 ++- .../Resources/Documents/css/jazzy.css | 10 +- .../Contents/Resources/Documents/index.html | 25 +- .../Contents/Resources/Documents/js/jazzy.js | 6 - .../Resources/Documents/js/jazzy.search.js | 26 +- .../Resources/Documents/js/jquery.min.js | 6 +- .../Resources/Documents/js/lunr.min.js | 7 +- .../Documents/js/typeahead.jquery.js | 228 ++++++++++++++---- .../Contents/Resources/Documents/search.json | 2 +- .../Contents/Resources/docSet.dsidx | Bin 45056 -> 45056 bytes docs/docsets/SwiftJWT.tgz | Bin 106518 -> 114146 bytes docs/index.html | 25 +- docs/js/jazzy.js | 6 - docs/js/jazzy.search.js | 26 +- docs/js/jquery.min.js | 6 +- docs/js/lunr.min.js | 7 +- docs/js/typeahead.jquery.js | 228 ++++++++++++++---- docs/search.json | 2 +- 54 files changed, 2436 insertions(+), 496 deletions(-) create mode 100644 docs/Extensions.html create mode 100644 docs/Extensions/Data.html create mode 100644 docs/docsets/SwiftJWT.docset/Contents/Resources/Documents/Extensions.html create mode 100644 docs/docsets/SwiftJWT.docset/Contents/Resources/Documents/Extensions/Data.html mode change 100755 => 100644 docs/docsets/SwiftJWT.docset/Contents/Resources/Documents/js/lunr.min.js mode change 100755 => 100644 docs/js/lunr.min.js diff --git a/docs/Classes.html b/docs/Classes.html index aae382c..043dd65 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -14,6 +14,7 @@ + @@ -69,6 +70,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +