Skip to content

Commit 59c4e44

Browse files
Merge pull request #5 from VirgilSecurity/develop
Fix .env variables
2 parents df5c72c + bafa441 commit 59c4e44

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
API_PRIVATE_KEY=
1+
APP_KEY=
22
APP_ID=
3-
API_KEY_ID=
3+
APP_KEY_ID=

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ To generate a JWT the following values are required:
6262
6363
| Variable Name | Description |
6464
|-----------------------------------|--------------------------------|
65-
| API_PRIVATE_KEY | Private key of your API key that is used to sign the JWTs. |
66-
| API_KEY_ID | ID of your API key. A unique string value that identifies your account in the Virgil Cloud. |
65+
| APP_KEY | Private key of your API key that is used to sign the JWTs. |
66+
| APP_KEY_ID | ID of your API key. A unique string value that identifies your account in the Virgil Cloud. |
6767
| APP_ID | ID of your Virgil Application. |
6868
6969
### Add Virgil Credentials to the .env
@@ -119,7 +119,7 @@ Response:
119119
To generate JWT, you need to use the `JwtGenerator` class from the SDK.
120120

121121
```php
122-
$privateKeyStr = $_ENV['API_PRIVATE_KEY'];
122+
$privateKeyStr = $_ENV['APP_KEY'];
123123
$apiKeyData = base64_decode($privateKeyStr);
124124

125125
$crypto = new VirgilCrypto();
@@ -128,7 +128,7 @@ $privateKey = $crypto->importPrivateKey($apiKeyData);
128128
$accessTokenSigner = new VirgilAccessTokenSigner();
129129

130130
$appId = $_ENV['APP_ID'];
131-
$apiKeyId = $_ENV['API_KEY_ID'];
131+
$apiKeyId = $_ENV['APP_KEY_ID'];
132132
$ttl = 3600;
133133

134134
$jwtGenerator = new JwtGenerator($privateKey, $apiKeyId, $accessTokenSigner, $appId, $ttl);

app/core/JWTGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class JWTGenerator
5555
public function generate(string $identity)
5656
{
5757
// API_KEY (You got this Key at Virgil Dashboard)
58-
$privateKeyStr = $_ENV['API_PRIVATE_KEY'];
58+
$privateKeyStr = $_ENV['APP_KEY'];
5959
$apiKeyData = base64_decode($privateKeyStr);
6060

6161
// Crypto library imports a private key into a necessary format
@@ -67,7 +67,7 @@ public function generate(string $identity)
6767

6868
// Use your App Credentials you got at Virgil Dashboard:
6969
$appId = $_ENV['APP_ID']; // APP_ID
70-
$apiKeyId = $_ENV['API_KEY_ID']; // API_KEY_ID
70+
$apiKeyId = $_ENV['APP_KEY_ID']; // API_KEY_ID
7171
$ttl = 3600; // JWT's lifetime
7272

7373
// Setup JWT generator with necessary parameters:

0 commit comments

Comments
 (0)