├── .github
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── build.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── composer.json
├── phpcs.xml
├── phpstan.neon
├── phpunit.xml.dist
├── src
└── JWT
│ ├── Exception
│ └── InvalidJTIException.php
│ └── TokenGenerator.php
├── test
└── JWT
│ ├── TokenGeneratorTest.php
│ └── resources
│ └── private.key
└── vonage_logo.png
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Expected Behavior
4 |
5 |
6 |
7 | ## Current Behavior
8 |
9 |
10 |
11 | ## Possible Solution
12 |
13 |
14 |
15 | ## Steps to Reproduce (for bugs)
16 |
17 |
18 | 1.
19 | 2.
20 | 3.
21 | 4.
22 |
23 | ## Context
24 |
25 |
26 |
27 | ## Your Environment
28 |
29 | * Version used:
30 | * Environment name and version (e.g. PHP 7.2 on nginx 1.19.1):
31 | * Operating System and version:
32 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Description
4 |
5 |
6 | ## Motivation and Context
7 |
8 |
9 |
10 | ## How Has This Been Tested?
11 |
12 |
13 |
14 |
15 | ## Example Output or Screenshots (if appropriate):
16 |
17 | ## Types of changes
18 |
19 | - [ ] Bug fix (non-breaking change which fixes an issue)
20 | - [ ] New feature (non-breaking change which adds functionality)
21 | - [ ] Breaking change (fix or feature that would cause existing functionality to change)
22 |
23 | ## Checklist:
24 |
25 |
26 | - [ ] My code follows the code style of this project.
27 | - [ ] My change requires a change to the documentation.
28 | - [ ] I have updated the documentation accordingly.
29 | - [ ] I have read the **CONTRIBUTING** document.
30 | - [ ] I have added tests to cover my changes.
31 | - [ ] All new and existing tests passed.
32 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: build
3 |
4 | on: [ push, pull_request ]
5 |
6 | jobs:
7 | build:
8 | runs-on: ubuntu-latest
9 | strategy:
10 | matrix:
11 | php: [ '8.1', '8.2', '8.3' ]
12 | name: PHP ${{ matrix.php }} Test
13 |
14 | steps:
15 | - name: Checkout
16 | uses: actions/checkout@v2
17 |
18 | - name: Setup PHP
19 | uses: shivammathur/setup-php@v2
20 | with:
21 | php-version: ${{ matrix.php }}
22 | extensions: json, mbstring
23 | coverage: pcov
24 | env:
25 | COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 |
27 | - name: Setup problem matchers for PHPUnit
28 | run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
29 |
30 | - name: Get Composer cache directory
31 | id: composercache
32 | run: echo "::set-output name=dir::$(composer config cache-files-dir)"
33 |
34 | - name: Cache Composer dependencies
35 | uses: actions/cache@v2
36 | with:
37 | path: ${{ steps.composercache.outputs.dir }}
38 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
39 | restore-keys: ${{ runner.os }}-composer-
40 |
41 | - name: Install dependencies
42 | run: composer update --prefer-dist --no-interaction
43 |
44 | - name: Analyze & test
45 | run: composer test -- -v --coverage-clover=coverage.xml
46 |
47 | - name: Run PhpStan
48 | run: composer run phpstan
49 |
50 | - name: Run codecov
51 | uses: codecov/codecov-action@v1
52 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | .php-version
3 | composer.lock
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at devrel@nexmo.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Getting Involved
2 |
3 | Thanks for your interest in the project, we'd love to have you involved! Check out the sections below to find out more about what to do next...
4 |
5 | ## Opening an Issue
6 |
7 | We always welcome issues, if you've seen something that isn't quite right or you have a suggestion for a new feature, please go ahead and open an issue in this project. Include as much information as you have, it really helps.
8 |
9 | ## Making a Code Change
10 |
11 | We're always open to pull requests, but these should be small and clearly described so that we can understand what you're trying to do. Feel free to open an issue first and get some discussion going.
12 |
13 | When you're ready to start coding, fork this repository to your own GitHub account and make your changes in a new branch. Once you're happy, open a pull request and explain what the change is and why you think we should include it in our project.
14 |
15 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2021 Vonage
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | JWT Client Library for PHP
2 | ============================
3 | [](CODE_OF_CONDUCT.md)
4 | [](https://github.com/Vonage/vonage-php-jwt/actions?query=workflow%3Abuild)
5 | [](https://packagist.org/packages/vonage/jwt)
6 | [](https://opensource.org/licenses/Apache-2.0)
7 | [](https://codecov.io/gh/Vonage/vonage-php-jwt)
8 |
9 |
10 |
11 | *This library requires a minimum PHP version of 8.0*
12 |
13 | This is the PHP library for generating JWTs to use Vonage's API. To use this, you'll need a Vonage account.
14 | Sign up [for free at vonage.com/dashboard][signup].
15 |
16 | * [Installation](#installation)
17 | * [Usage](#usage)
18 | * [Examples](#examples)
19 | * [Contributing](#contributing)
20 |
21 | Installation
22 | ------------
23 |
24 | To use the client library you'll need to have [created a Vonage account][signup].
25 |
26 | To install the PHP client library to your project, we recommend using [Composer](https://getcomposer.org/).
27 |
28 | ```bash
29 | composer require vonage/jwt
30 | ```
31 |
32 | > You don't need to clone this repository to use this library in your own projects. Use Composer to install it from Packagist.
33 |
34 | If you're new to Composer, here are some resources that you may find useful:
35 |
36 | * [Composer's Getting Started page](https://getcomposer.org/doc/00-intro.md) from Composer project's documentation.
37 | * [A Beginner's Guide to Composer](https://scotch.io/tutorials/a-beginners-guide-to-composer) from the good people at ScotchBox.
38 |
39 | Usage
40 | -----
41 |
42 | If you're using Composer, make sure the autoloader is included in your project's bootstrap file:
43 |
44 | ```php
45 | require_once "vendor/autoload.php";
46 | ```
47 |
48 | Create a Token Generator with the Application ID and Private Key of the Vonage Application you want to access:
49 |
50 | ```php
51 | $generator = new Vonage\JWT\TokenGenerator('d70425f2-1599-4e4c-81c4-cffc66e49a12', file_get_contents('/path/to/private.key'));
52 | ```
53 |
54 | You can then retrieve a generated JWT token by calling the `generate()` method on the Token Generator:
55 |
56 | ```php
57 | $token = $generator->generate();
58 | ```
59 |
60 | This will return a string token that can be used for Bearer Authentication to Vonage APIs that require JWTs.
61 |
62 | Examples
63 | --------
64 |
65 | ### Generating a token with a specific Time To Live
66 |
67 | By default, Vonage JWT tokens are generated with an Time To Live, or TTL, of 15 minutes after generation. In cases where the token lifetime
68 | should be different, you can override this setting by calling the `setTTL()` method on the Token Generator and passing the length of seconds
69 | that the token should be valid for
70 |
71 | ```php
72 | $generator->setTTL(30 * 60); // Set expiration to 30 minutes after token creation
73 | ```
74 |
75 | ### Setting ACLs
76 |
77 | Vonage JWTs will default to full access to all of the paths for an application, but this may not be desirable for cases where clients
78 | may need restricted access. You can specify the paths that a JWT token is valid for by using the `setPaths()` or `addPath()` methods
79 | to set the path information in bulk, or add individual paths in a more fluent interface.
80 |
81 | ```php
82 | // Set paths in bulk
83 | $generator->setPaths([
84 | '/*/users/**',
85 | '/*/conversations/**'
86 | ]);
87 |
88 | // Set paths individually
89 | $generator->addPath('/*/users/**');
90 | $generator->addPath('/*/conversations/**');
91 | ```
92 |
93 | For more information on assigning ACL information, please see [How to generate JWTs
94 | on the Vonage Developer Platform](https://developer.nexmo.com/conversation/guides/jwt-acl)
95 |
96 | Contributing
97 | ------------
98 |
99 | This library is actively developed and we love to hear from you! Please feel free to [create an issue][issues] or [open a pull request][pulls] with your questions, comments, suggestions and feedback.
100 |
101 | [signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=php-client-library
102 | [license]: LICENSE.txt
103 | [issues]: https://github.com/Vonage/vonage-php-jwt/issues
104 | [pulls]: https://github.com/Vonage/vonage-php-jwt/pulls
105 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vonage/jwt",
3 | "description": "A standalone package for creating JWTs for Vonage APIs",
4 | "type": "library",
5 | "require": {
6 | "php": "~8.1 || ~8.2 || ~8.3",
7 | "lcobucci/jwt": "^4.3.0|^5.0",
8 | "ramsey/uuid": "^4.7.5"
9 | },
10 | "require-dev": {
11 | "phpunit/phpunit": "^8.5|^9.4",
12 | "phpstan/phpstan": "^1.10",
13 | "squizlabs/php_codesniffer": "^3.5"
14 | },
15 | "license": "Apache-2.0",
16 | "authors": [
17 | {
18 | "name": "James Seconde",
19 | "email": "jim.seconde@vonage.com",
20 | "role": "PHP Developer Advocate"
21 | },
22 | {
23 | "name": "Chris Tankersley",
24 | "email": "chris@ctankersley.com",
25 | "role": "Developer"
26 | }
27 | ],
28 | "autoload": {
29 | "psr-4": {
30 | "Vonage\\": "src/"
31 | }
32 | },
33 | "autoload-dev": {
34 | "psr-4": {
35 | "Vonage\\": "test/",
36 | "VonageTest\\": "test/"
37 | }
38 | },
39 | "scripts": {
40 | "phpstan": "phpstan",
41 | "cs-check": "phpcs",
42 | "cs-fix": "phpcbf",
43 | "test": "phpunit"
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/phpcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ./src
5 | ./test
6 |
7 |
--------------------------------------------------------------------------------
/phpstan.neon:
--------------------------------------------------------------------------------
1 | parameters:
2 | level: 6
3 | paths:
4 | - src
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ./test/
5 |
6 |
7 |
8 |
9 | ./src/
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/JWT/Exception/InvalidJTIException.php:
--------------------------------------------------------------------------------
1 |
30 | */
31 | protected array $claims = [];
32 |
33 | /**
34 | * Configuration of the token we are using
35 | */
36 | protected Configuration $config;
37 |
38 | /**
39 | * Number of seconds to expire in, defaults to 15 minutes
40 | */
41 | protected int $ttl = 900;
42 |
43 | /**
44 | * UUIDv4 ID for the JWT
45 | */
46 | protected string $jti;
47 |
48 | /**
49 | * Unix Timestamp at which this token becomes valid
50 | */
51 | protected \DateTimeImmutable $nbf;
52 |
53 | /**
54 | * ACL Path information
55 | * @var array
56 | */
57 | protected array $paths = [];
58 |
59 | /**
60 | * Private key text used for signing
61 | */
62 | protected InMemory $privateKey;
63 |
64 | /**
65 | * Subject to use in the JWT
66 | */
67 | protected string $subject;
68 |
69 | public function __construct(string $applicationId, string $privateKey)
70 | {
71 | $this->applicationId = $applicationId;
72 | $this->privateKey = InMemory::plainText($privateKey);
73 |
74 | $this->config = Configuration::forSymmetricSigner(new Sha256(), $this->privateKey);
75 | }
76 |
77 | /**
78 | * @param array> $options
79 | */
80 | public function addPath(string $path, array $options = []) : self
81 | {
82 | $this->paths[$path] = (object) $options;
83 | return $this;
84 | }
85 |
86 | /**
87 | * Factory to create a token in one call
88 | * $options format:
89 | * - ttl: string
90 | * - jti: string
91 | * - paths: array
92 | * - not_before: int|\DateTimeImmutable
93 | * - sub: string
94 | *
95 | * @param array $options
96 | */
97 | public static function factory(string $applicationId, string $privateKey, array $options = []) : string
98 | {
99 | $generator = new self($applicationId, $privateKey);
100 |
101 | if (array_key_exists('ttl', $options)) {
102 | $generator->setTTL($options['ttl']);
103 | unset($options['ttl']);
104 | }
105 |
106 | if (array_key_exists('jti', $options)) {
107 | $generator->setJTI($options['jti']);
108 | unset($options['jti']);
109 | }
110 |
111 | if (array_key_exists('paths', $options)) {
112 | $generator->setPaths($options['paths']);
113 | unset($options['paths']);
114 | }
115 |
116 | if (array_key_exists('not_before', $options)) {
117 | if (is_int($options['not_before'])) {
118 | $options['not_before'] = (new \DateTimeImmutable())->setTimestamp($options['not_before']);
119 | }
120 | $generator->setNotBefore($options['not_before']);
121 | unset($options['not_before']);
122 | }
123 |
124 | if (array_key_exists('sub', $options)) {
125 | $generator->setSubject($options['sub']);
126 | unset($options['sub']);
127 | }
128 |
129 | foreach ($options as $key => $value) {
130 | $generator->addClaim($key, $value);
131 | }
132 |
133 | return $generator->generate();
134 | }
135 |
136 | public function generate() : string
137 | {
138 | $iat = time();
139 | $exp = $iat + $this->ttl;
140 |
141 | $builder = $this->config->builder()
142 | ->issuedAt((new \DateTimeImmutable())->setTimestamp($iat))
143 | ->expiresAt((new \DateTimeImmutable())->setTimestamp($exp))
144 | ->identifiedBy($this->getJTI())
145 | ->withClaim('application_id', $this->applicationId);
146 |
147 | if (!empty($this->getPaths())) {
148 | $builder = $builder->withClaim('acl', ['paths' => $this->getPaths()]);
149 | }
150 |
151 | try {
152 | $builder = $builder->canOnlyBeUsedAfter($this->getNotBefore());
153 | } catch (RuntimeException $e) {
154 | // This is fine, NBF isn't required
155 | }
156 |
157 | try {
158 | $builder = $builder->relatedTo($this->getSubject());
159 | } catch (RuntimeException $e) {
160 | // This is fine, Subject isn't required
161 | }
162 |
163 | foreach ($this->claims as $key => $value) {
164 | $builder = $builder->withClaim($key, $value);
165 | }
166 |
167 | return $builder->getToken($this->config->signer(), $this->config->signingKey())->toString();
168 | }
169 |
170 | public function getJTI() : string
171 | {
172 | if (!isset($this->jti)) {
173 | $this->jti = Uuid::uuid4()->toString();
174 | }
175 |
176 | return $this->jti;
177 | }
178 |
179 | public function getNotBefore() : \DateTimeImmutable
180 | {
181 | if (!isset($this->nbf)) {
182 | throw new RuntimeException('Not Before time has not been set');
183 | }
184 |
185 | return $this->nbf;
186 | }
187 |
188 | public function getParser(): Parser
189 | {
190 | return $this->config->parser();
191 | }
192 |
193 | /**
194 | * @return array
195 | */
196 | public function getPaths() : array
197 | {
198 | return $this->paths;
199 | }
200 |
201 | public function getSubject() : string
202 | {
203 | if (!isset($this->subject)) {
204 | throw new RuntimeException('Subject has not been set');
205 | }
206 |
207 | return $this->subject;
208 | }
209 |
210 | public function addClaim(string $claim, mixed $value): self
211 | {
212 | $this->claims[$claim] = $value;
213 | return $this;
214 | }
215 |
216 | public function setTTL(int $seconds) : self
217 | {
218 | $this->ttl = $seconds;
219 | return $this;
220 | }
221 |
222 | public function setJTI(string $uuid) : self
223 | {
224 | if (!Uuid::isValid($uuid)) {
225 | throw new InvalidJTIException('JTI must be a UUIDv4 string');
226 | }
227 |
228 | $this->jti = $uuid;
229 | return $this;
230 | }
231 |
232 | public function setNotBefore(\DateTimeImmutable $timestamp) : self
233 | {
234 | $this->nbf = $timestamp;
235 | return $this;
236 | }
237 |
238 | /**
239 | * Sets the ACL path information for this token
240 | * WARNING: This will reset the paths to the new list, overriding any
241 | * existing paths.
242 | *
243 | * @param array|string> $pathData
244 | */
245 | public function setPaths(array $pathData) : self
246 | {
247 | $this->paths = [];
248 | foreach ($pathData as $key => $data) {
249 | if (is_string($key)) {
250 | $this->addPath($key, $data);
251 | } else {
252 | $this->addPath($data);
253 | }
254 | }
255 |
256 | return $this;
257 | }
258 |
259 | public function setSubject(string $subject) : self
260 | {
261 | $this->subject = $subject;
262 | return $this;
263 | }
264 |
265 | public function getTTL() : int
266 | {
267 | return $this->ttl;
268 | }
269 |
270 | public static function verifySignature(string $token, string $secret): bool
271 | {
272 | $parser = new TokenParser(new JoseEncoder());
273 | $validator = new Validator();
274 |
275 | $token = $parser->parse($token);
276 |
277 | return $validator->validate(
278 | $token, new SignedWith(
279 | new Sha256HMAC(),
280 | InMemory::plainText($secret)
281 | ));
282 | }
283 | }
284 |
--------------------------------------------------------------------------------
/test/JWT/TokenGeneratorTest.php:
--------------------------------------------------------------------------------
1 | generate();
36 |
37 | $parsedToken = $generator->getParser()->parse($token);
38 | $this->assertSame('RS256', $parsedToken->headers()->get('alg'));
39 | $this->assertSame('JWT', $parsedToken->headers()->get('typ'));
40 | $this->assertSame(1590087267, $parsedToken->claims()->get('iat')->getTimestamp());
41 | $this->assertSame(1590087267 + 900, $parsedToken->claims()->get('exp')->getTimestamp());
42 | $this->assertTrue(Uuid::isValid($parsedToken->claims()->get('jti')));
43 | $this->assertFalse($parsedToken->headers()->has('acl'));
44 | $this->assertFalse($parsedToken->headers()->has('nbf'));
45 | $this->assertFalse($parsedToken->claims()->has('sub'));
46 | }
47 |
48 | /**
49 | * User should be able to override the expiration time
50 | */
51 | public function testCanChangeTTL()
52 | {
53 | $generator = new TokenGenerator(
54 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
55 | file_get_contents(__DIR__ . '/resources/private.key')
56 | );
57 | $generator->setTTL(50);
58 | $token = $generator->generate();
59 |
60 | $parsedToken = $generator->getParser()->parse($token);
61 | $this->assertSame(1590087267 + 50, $parsedToken->claims()->get('exp')->getTimestamp());
62 | }
63 |
64 | /**
65 | * User should be able to supply their own JWT ID
66 | */
67 | public function testCanSetJWTID()
68 | {
69 | $uuid = Uuid::uuid4()->toString();
70 |
71 | $generator = new TokenGenerator(
72 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
73 | file_get_contents(__DIR__ . '/resources/private.key')
74 | );
75 | $generator->setJTI($uuid);
76 | $token = $generator->generate();
77 |
78 | $parsedToken = $generator->getParser()->parse($token);
79 | $this->assertTrue(Uuid::isValid($parsedToken->claims()->get('jti')));
80 | $this->assertSame($uuid, $parsedToken->claims()->get('jti'));
81 | }
82 |
83 | /**
84 | * JWT ID must reject anything that isn't a UUIDv4
85 | */
86 | public function testRejectsInvalidJTI()
87 | {
88 | $this->expectException(InvalidJTIException::class);
89 |
90 | $generator = new TokenGenerator(
91 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
92 | file_get_contents(__DIR__ . '/resources/private.key')
93 | );
94 | $generator->setJTI('abcd');
95 | }
96 |
97 | /**
98 | * User can see a "Not Before" time
99 | */
100 | public function testCanSetNBF()
101 | {
102 | $nbf = new \DateTimeImmutable('2025-01-01 00:00:00');
103 |
104 | $generator = new TokenGenerator(
105 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
106 | file_get_contents(__DIR__ . '/resources/private.key')
107 | );
108 | $generator->setNotBefore($nbf);
109 | $token = $generator->generate();
110 |
111 | $parsedToken = $generator->getParser()->parse($token);
112 | $this->assertEquals($nbf, $parsedToken->claims()->get('nbf'));
113 | }
114 |
115 | /**
116 | * User can set bulk path ACL information
117 | */
118 | public function testCanSetACLPaths()
119 | {
120 | $paths = [
121 | '/*/users/**',
122 | '/*/conversations/**'
123 | ];
124 |
125 | $generator = new TokenGenerator(
126 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
127 | file_get_contents(__DIR__ . '/resources/private.key')
128 | );
129 | $generator->setPaths($paths);
130 | $token = $generator->generate();
131 |
132 | $parsedToken = $generator->getParser()->parse($token);
133 | $this->assertTrue($parsedToken->claims()->has('acl'));
134 | $acl = $parsedToken->claims()->get('acl');
135 | if ($acl instanceof \stdClass) {
136 | $acl = json_decode(json_encode($acl), true);
137 | }
138 |
139 | $this->assertCount(2, $acl['paths']);
140 | $this->assertArrayHasKey($paths[0], $acl['paths']);
141 | $this->assertArrayHasKey($paths[1], $acl['paths']);
142 | }
143 |
144 | /**
145 | * User can set complex bulk path ACL information
146 | */
147 | public function testCanSetComplexACLInformation()
148 | {
149 | $paths = [
150 | '/*/users/**',
151 | '/*/conversations/**' => [
152 | 'methods' => ['GET']
153 | ]
154 | ];
155 |
156 | $generator = new TokenGenerator(
157 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
158 | file_get_contents(__DIR__ . '/resources/private.key')
159 | );
160 | $generator->setPaths($paths);
161 | $token = $generator->generate();
162 |
163 | $parsedToken = $generator->getParser()->parse($token);
164 | $this->assertTrue($parsedToken->claims()->has('acl'));
165 | $acl = $parsedToken->claims()->get('acl');
166 | if ($acl instanceof \stdClass) {
167 | $acl = json_decode(json_encode($acl), true);
168 | }
169 |
170 | $this->assertCount(2, (array) $acl['paths']);
171 |
172 | $convoPath = '/*/conversations/**';
173 | $this->assertTrue(is_array($acl['paths'][$convoPath]['methods']));
174 | }
175 |
176 | /**
177 | * User can add individual ACL paths
178 | */
179 | public function testCanAddACLPath()
180 | {
181 | $path = '/*/users/**';
182 |
183 | $generator = new TokenGenerator(
184 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
185 | file_get_contents(__DIR__ . '/resources/private.key')
186 | );
187 | $generator->addPath($path);
188 | $token = $generator->generate();
189 |
190 | $parsedToken = $generator->getParser()->parse($token);
191 | $this->assertTrue($parsedToken->claims()->has('acl'));
192 | $acl = $parsedToken->claims()->get('acl');
193 | if ($acl instanceof \stdClass) {
194 | $acl = json_decode(json_encode($acl), true);
195 | }
196 |
197 | $this->assertCount(1, (array) $acl['paths']);
198 | }
199 |
200 | /**
201 | * User can add individual ACL path information with additional constraints
202 | */
203 | public function testCanAddACLPathWithOptions()
204 | {
205 | $path = '/';
206 | $options = [
207 | 'methods' => ['GET']
208 | ];
209 |
210 | $generator = new TokenGenerator(
211 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
212 | file_get_contents(__DIR__ . '/resources/private.key')
213 | );
214 | $generator->addPath($path, $options);
215 | $token = $generator->generate();
216 |
217 | $parsedToken = $generator->getParser()->parse($token);
218 | $this->assertTrue($parsedToken->claims()->has('acl'));
219 | $acl = $parsedToken->claims()->get('acl');
220 | if ($acl instanceof \stdClass) {
221 | $acl = json_decode(json_encode($acl), true);
222 | }
223 |
224 | $this->assertCount(1, (array) $acl['paths']);
225 | $this->assertSame($options['methods'], $acl['paths'][$path]['methods']);
226 | }
227 |
228 | public function testFactoryGeneratesValidToken()
229 | {
230 | $generator = new TokenGenerator(
231 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
232 | file_get_contents(__DIR__ . '/resources/private.key')
233 | );
234 |
235 | $token = TokenGenerator::factory(
236 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
237 | file_get_contents(__DIR__ . '/resources/private.key')
238 | );
239 |
240 | $parsedToken = $generator->getParser()->parse($token);
241 | $this->assertSame('RS256', $parsedToken->headers()->get('alg'));
242 | $this->assertSame('JWT', $parsedToken->headers()->get('typ'));
243 | $this->assertSame(1590087267, $parsedToken->claims()->get('iat')->getTimestamp());
244 | $this->assertSame(1590087267 + 900, $parsedToken->claims()->get('exp')->getTimestamp());
245 | $this->assertTrue(Uuid::isValid($parsedToken->claims()->get('jti')));
246 | $this->assertFalse($parsedToken->headers()->has('acl'));
247 | $this->assertFalse($parsedToken->headers()->has('nbf'));
248 | }
249 |
250 | public function testFactoryUsesPassedOptions()
251 | {
252 | $uuid = Uuid::uuid4()->toString();
253 | $paths = [
254 | '/*/users/**',
255 | '/*/conversations/**' => [
256 | 'methods' => ['GET']
257 | ]
258 | ];
259 | $nbf = strtotime('2025-01-01 00:00:00');
260 |
261 | $token = TokenGenerator::factory(
262 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
263 | file_get_contents(__DIR__ . '/resources/private.key'),
264 | [
265 | 'ttl' => 50,
266 | 'jti' => $uuid,
267 | 'paths' => $paths,
268 | 'not_before' => $nbf,
269 | 'sub' => 'foo'
270 | ]
271 | );
272 | $generator = new TokenGenerator(
273 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
274 | file_get_contents(__DIR__ . '/resources/private.key')
275 | );
276 |
277 | $parsedToken = $generator->getParser()->parse($token);
278 | $this->assertSame('RS256', $parsedToken->headers()->get('alg'));
279 | $this->assertSame('JWT', $parsedToken->headers()->get('typ'));
280 |
281 | $this->assertSame(1590087267, $parsedToken->claims()->get('iat')->getTimestamp());
282 | $this->assertSame(1590087267 + 50, $parsedToken->claims()->get('exp')->getTimestamp());
283 |
284 | $this->assertTrue(Uuid::isValid($parsedToken->claims()->get('jti')));
285 | $this->assertSame($uuid, $parsedToken->claims()->get('jti'));
286 |
287 | $acl = $parsedToken->claims()->get('acl');
288 | if ($acl instanceof \stdClass) {
289 | $acl = json_decode(json_encode($acl), true);
290 | }
291 | $this->assertCount(2, $acl['paths']);
292 | $convoPath = '/*/conversations/**';
293 | $this->assertTrue(is_array($acl['paths'][$convoPath]['methods']));
294 |
295 | $this->assertSame($nbf, $parsedToken->claims()->get('nbf')->getTimestamp());
296 | }
297 |
298 | public function testCanSetTheSubject()
299 | {
300 | $generator = new TokenGenerator(
301 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
302 | file_get_contents(__DIR__ . '/resources/private.key')
303 | );
304 | $generator->setSubject('foo');
305 | $token = $generator->generate();
306 |
307 | $parsedToken = $generator->getParser()->parse($token);
308 |
309 | $this->assertTrue($parsedToken->claims()->has('sub'));
310 | $this->assertSame('foo', $parsedToken->claims()->get('sub'));
311 | }
312 |
313 | public function testCanAddGenericClaims()
314 | {
315 | $generator = new TokenGenerator(
316 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
317 | file_get_contents(__DIR__ . '/resources/private.key')
318 | );
319 | $generator->addClaim('foo', 'bar');
320 | $token = $generator->generate();
321 |
322 | $parsedToken = $generator->getParser()->parse($token);
323 | $this->assertTrue($parsedToken->claims()->has('foo'));
324 | $this->assertSame('bar', $parsedToken->claims()->get('foo'));
325 | }
326 |
327 | public function testCanAddGenericClaimsThroughFactory()
328 | {
329 | $generator = new TokenGenerator(
330 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
331 | file_get_contents(__DIR__ . '/resources/private.key')
332 | );
333 |
334 | $token = TokenGenerator::factory(
335 | 'd70425f2-1599-4e4c-81c4-cffc66e49a12',
336 | file_get_contents(__DIR__ . '/resources/private.key'),
337 | [
338 | 'foo' => 'bar'
339 | ]
340 | );
341 |
342 | $parsedToken = $generator->getParser()->parse($token);
343 | $this->assertTrue($parsedToken->claims()->has('foo'));
344 | $this->assertSame('bar', $parsedToken->claims()->get('foo'));
345 | }
346 |
347 | public function testCanValidateJWTWithSignatureSecret()
348 | {
349 | $token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODc0OTQ5NjIsImp0aSI6ImM1YmE4ZjI0LTFhMTQtNGMxMC1iZmRmLTNmYmU4Y2U1MTFiNSIsImlzcyI6IlZvbmFnZSIsInBheWxvYWRfaGFzaCI6ImQ2YzBlNzRiNTg1N2RmMjBlM2I3ZTUxYjMwYzBjMmE0MGVjNzNhNzc4NzliNmYwNzRkZGM3YTIzMTdkZDAzMWIiLCJhcGlfa2V5IjoiYTFiMmMzZCIsImFwcGxpY2F0aW9uX2lkIjoiYWFhYWFhYWEtYmJiYi1jY2NjLWRkZGQtMDEyMzQ1Njc4OWFiIn0.JQRKi1d0SQitmjPINfTWMpt3XZkGsLbD7EjCdXoNSbk';
350 | $secret = 'ZYtdTtGV3BCFN7tWmOWr1md66XsquMggr4W2cTtXtcPgfnI0Xw';
351 | $this->assertTrue(TokenGenerator::verifySignature($token, $secret));
352 | }
353 |
354 | public function testWillNotValidateJWTWithBadSecret()
355 | {
356 | $token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1ODc0OTQ5NjIsImp0aSI6ImM1YmE4ZjI0LTFhMTQtNGMxMC1iZmRmLTNmYmU4Y2U1MTFiNSIsImlzcyI6IlZvbmFnZSIsInBheWxvYWRfaGFzaCI6ImQ2YzBlNzRiNTg1N2RmMjBlM2I3ZTUxYjMwYzBjMmE0MGVjNzNhNzc4NzliNmYwNzRkZGM3YTIzMTdkZDAzMWIiLCJhcGlfa2V5IjoiYTFiMmMzZCIsImFwcGxpY2F0aW9uX2lkIjoiYWFhYWFhYWEtYmJiYi1jY2NjLWRkZGQtMDEyMzQ1Njc4OWFiIn0.JQRKi1d0SQitmjPINfTWMpt3XZkGsLbD7EjCdXoNSbk';
357 | $secret = 'ZYtdTtGV3BCFN7tWmOWr1md66XsquMggr4W2cTtXtcPgf55555';
358 | $this->assertFalse(TokenGenerator::verifySignature($token, $secret));
359 | }
360 | }
361 |
--------------------------------------------------------------------------------
/test/JWT/resources/private.key:
--------------------------------------------------------------------------------
1 | -----BEGIN PRIVATE KEY-----
2 | MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCPvPoIrW4gW0hv
3 | UOC0my5Jas6FCEejtngnGlFwaktOzgSjZgicpCWqNuRyLwe1h08sA3ahhUiCP118
4 | 39on8x94JAVWZ2y3p/OEhdEpKyygUT9kS/nZlMByDG6t4vDcKgwGd1sBb4ogxVd1
5 | /pGDe3N132rZf3cOoGC9HENoaQjGG3+eZiqCxapvlTN/QZ0AiQMN+KQYfrbq3S4s
6 | KeSbv+BZAezrP/TWSrNUQZoeJeN4TD5z8MKdBZ90QlBtiGUZwhcdbRn4dLKMPfmq
7 | YOAssgn5+++zoYCzEGPdvduxKcFEZnkziNZsbwnr9A2H7+i8zIHm3qbaqWxRqvlI
8 | 9gvKDhe3AgMBAAECggEABUlrnucWHl2NJ/7/DNWKWcvyZaU80VI0UCfhJ/PY6kCc
9 | ng/yMCS/d+fF9kcxjuU3rcRA2EcJODUxcJbhNMf199rHUXrDXmvwgobTfyKl5Q2n
10 | +b3rpiuY+njnl0C6IDbxs0kvkTlziKoJgf8HhiEDyamaif5suB6BAGOqPQxj9Llf
11 | FJ4tCDxiGTnbdZypZtzCTC6Lo63voZ3XsBmY5rDAWRpr8yodCldUtL0gVE+wRVEd
12 | tyRLtO75yDWOr9V0UsA/BLUNoHJ7iwUq/3IX3tCM+n0WTszc7K7WlOQPT9d3Q/Lz
13 | 4AWvC/CJYcrjtGiZhyERe1gjcE2lu2dA1ASw0loFSQKBgQDHZl8fv/FMYA4N/6T7
14 | grH0RCpW1N62oG0Doib6sZ033DFDa7Lwv3xo5VYqMkUwBXU6V+bn0Mhe65sahr7G
15 | BVXxgC8TC9XIbndggmByhO3l83gtF1yKBRv2/3q9hns4Yfsz3kTKjoxxMlrhKeDk
16 | K254NUqKZ11Z4OHo8Y3OeWwBzwKBgQC4ieHNYrnICedmIC0rmtDvJXmSUx9bg0JO
17 | wpY3QJFRC65oA/ph3sxElbODvBW9e+6kgBRif+np6AomFsahjcA69z2sR+PJnkIA
18 | zCCS8SkAY/crmmSI6jJQHcGHosRLdKLVSuekrakbbLt6E13F/ZO2EaAikCzKshnp
19 | fumOtt6NmQKBgGVKKGoNa7q7VIhh42Hryw/lDIjdS2ED7zyYQyq3zMBSdyfjbpuC
20 | +eSjEvkOXjz9mMYRXvdFBHPLRRfdeM1Iapbp4X/QVEGjc7qvn+Ssh9h2rAZjxptJ
21 | 6yG2N5hM1w0WILABaXpnnQnnZWjZiCb/tPcVQw85YJ9GcBuPkNRgs6/bAoGAO6zS
22 | 6UD4xPh27O6QzN4GnJ8ovinFJSnAIooIW5u0olm9r4NBz65lrfQfFgWXnivakzWb
23 | 4fJtaSeRSJnq58lYFXloZzLkNYnI3EsmaX40/RxWjLIjuqbJWGEW+U6oXaI9Ge5c
24 | FEPYQLcbtTFYDLOgtarjdunaoj2P5ZMV4gG+3FkCgYAXTQV8+jb/5xgsuG5KHhhZ
25 | 3YQ/UHLBI36CqunXL6u12f3LzMCK2+gAFVsPBn5JOXZCxreEekKxm4imq8mMlnde
26 | LGX3+B96ZQkr3rTLEsBD9rz58ig24R/cAuTZT6vPAZSQE32XU1KgOMewsV/QyyGM
27 | rMIxeQ87Gd13CfrKD4l3gw==
28 | -----END PRIVATE KEY-----
--------------------------------------------------------------------------------
/vonage_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Vonage/vonage-php-jwt/c84adbf1c8d90526dde85a025b011aeeb8bc4c96/vonage_logo.png
--------------------------------------------------------------------------------