@@ -44,11 +44,32 @@ application.
4444Configure::load('mixerapi_jwtauth');
4545```
4646
47- - ` alg ` string is required and must be either HS256, HS512, RS256, or RS512.
48- - ` secret ` is required when using HMAC. The secret should not be committed to your VCS and be at least 32 characters.
49- - ` keys ` array is required when using RSA. The keys should not be committed to your VCS and be at least 2048 bits long.
47+ #### alg
5048
51- Read the [ example configuration file] ( assets/mixerapi_jwtauth.php ) for more detailed explanations.
49+ The ` alg ` string is required and must be either HS256, HS512, RS256, or RS512.
50+
51+ #### secret
52+
53+ The ` secret ` string is required when using HMAC. The secret should not be committed to your VCS and be at least 32
54+ characters long. You can generate a strong secret using a tool like openssl or gpg:
55+
56+ ``` console
57+ openssl rand -base64 32
58+ ```
59+
60+ ``` console
61+ gpg --gen-random 1 32 | base64
62+ ```
63+
64+ #### keys
65+
66+ The ` keys ` array is required when using RSA. The keys should not be committed to your VCS and be at least 2048 bits
67+ long. You can generate a public/private keypair using openssl:
68+
69+ ``` console
70+ openssl genrsa -out config/keys/1/private.pem 2048
71+ openssl rsa -in config/keys/1/private.pem -out config/keys/1/public.pem -pubout
72+ ```
5273
5374### Service Provider
5475
@@ -120,13 +141,6 @@ Signing your tokens with RSA uses a public/private key pair. You can skip this s
120141We'll store the keys in ` config/keys/1/ ` but you can store these anywhere. Keys should not be stored in version
121142control, example:
122143
123- ``` console
124- openssl genrsa -out config/keys/1/private.pem 2048
125- openssl rsa -in config/keys/1/private.pem -out config/keys/1/public.pem -pubout
126- ```
127-
128- Add the generated keys to your config:
129-
130144``` php
131145# in config/mixerapi_jwtauth.php
132146
@@ -288,18 +302,6 @@ the JWT can be altered. This library mitigates this by requiring a minimum secre
288302may want to consider using 64 characters if security is more important than speed and token size. Generating a strong
289303random secret and securing it is up to you.
290304
291- You can generate a strong secret using a tool like ` openssl ` :
292-
293- ``` console
294- openssl rand -base64 32
295- ```
296-
297- Or ` gpg ` :
298-
299- ``` console
300- gpg --gen-random 1 32 | base64
301- ```
302-
303305#### Weak RSA Keys
304306
305307Weak keys can be cracked as well. This library requires a minimum key length of 2048 bits. You may want to consider
0 commit comments