Skip to content

Commit

Permalink
Link to the API docs from the README (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket authored Jun 24, 2022
1 parent 9ee67da commit e105a13
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Easily decode a [JWT](https://jwt.io/) and access the claims it contains.
+ [Cocoapods](#cocoapods)
+ [Carthage](#carthage)
- [**Usage**](#usage)
+ [JWT Parts](#jwt-parts)
+ [Registered Claims](#registered-claims)
+ [Custom Claims](#custom-claims)
+ [Error Handling](#error-handling)
+ [JWT parts](#jwt-parts)
+ [Registered claims](#registered-claims)
+ [Custom claims](#custom-claims)
+ [Error handling](#error-handling)
- [**Support Policy**](#support-policy)
- [**Issue Reporting**](#issue-reporting)
- [**What is Auth0?**](#what-is-auth0)
Expand Down Expand Up @@ -84,6 +84,8 @@ Then, run `carthage bootstrap --use-xcframeworks`.
## Usage

**See all the available features in the [API documentation ↗](https://auth0.github.io/JWTDecode.swift/documentation/jwtdecode/)**

1. Import the framework:

```swift
Expand All @@ -96,15 +98,15 @@ import JWTDecode
let jwt = try decode(jwt: token)
```

### JWT Parts
### JWT parts

| Part | Property |
|:-------------------|:----------------|
| Header dictionary | `jwt.header` |
| Claims in JWT body | `jwt.body` |
| JWT signature | `jwt.signature` |

### Registered Claims
### Registered claims

| Claim | Property |
|:--------------------------|:-----------------|
Expand All @@ -116,7 +118,7 @@ let jwt = try decode(jwt: token)
| **iat** (Issued At) | `jwt.issuedAt` |
| **exp** (Expiration Time) | `jwt.expiresAt` |

### Custom Claims
### Custom claims

You can retrieve a custom claim through a subscript and then attempt to convert the value to a specific type.

Expand Down Expand Up @@ -147,7 +149,7 @@ extension JWT {
}
```

### Error Handling
### Error handling

If the JWT is malformed the `decode(jwt:)` function will throw a `JWTDecodeError`.

Expand Down

0 comments on commit e105a13

Please sign in to comment.