File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,20 @@ JWT.encode(.HS256("secret")) { builder in
39
39
When decoding a JWT, you must supply one or more algorithms and keys.
40
40
41
41
```swift
42
- JWT.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.2_8pWJfyPup0YwOXK7g9Dn0cF1E3pdn299t4hSeJy5w", .HS256("secret"))
42
+ let result = JWT.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.2_8pWJfyPup0YwOXK7g9Dn0cF1E3pdn299t4hSeJy5w", .HS256("secret"))
43
+
44
+ switch result {
45
+ case .Success(let payload):
46
+ print(payload)
47
+ case .Failure(let failure):
48
+ print("decoding failed \(failure)")
49
+ }
43
50
```
44
51
45
52
When the JWT may be signed with one out of many algorithms or keys:
46
53
47
54
```swift
48
- JWT.decode("eyJh...5w", [.HS256("secret"), .HS256("secret2"), .HS512("secure")])
55
+ let result = JWT.decode("eyJh...5w", [.HS256("secret"), .HS256("secret2"), .HS512("secure")])
49
56
```
50
57
51
58
#### Supported claims
You can’t perform that action at this time.
0 commit comments