diff --git a/bundle/jwk/keys.md b/bundle/jwk/keys.md index e29c5e0..72055b0 100644 --- a/bundle/jwk/keys.md +++ b/bundle/jwk/keys.md @@ -24,6 +24,23 @@ Each key service will be an instance of the `Jose\Component\Core\JWK` class. As any other configuration values, you can use environment variables. +## From A JWK From A Shared Secret + +> This feature was introduced in version 1.1. + +This method will directly get a shared secret. + +```yaml +jose: + keys: + key_name: + secret: # Method + secret: 'This is my shared secret' + additional_values: + use: 'sig' + alg: 'RS512' +``` + ## From A JWK Object This method will directly get a JWK object. diff --git a/component/jwk/jwk.md b/component/jwk/jwk.md index d1cf40d..c56c1dd 100644 --- a/component/jwk/jwk.md +++ b/component/jwk/jwk.md @@ -75,6 +75,24 @@ $key = JWKFactory::createOctKey( ); ``` +> The following feature was introduced in version 1.1. + +If you already have a shared secret, you can use it to create an `oct` key: + +```php + 'HS256', + 'use' => 'sig' + ] +); +``` + ## RSA Key Pair The following example will show you how to create a `RSA` key. diff --git a/console/index.md b/console/index.md index 46c16b6..9f06ea6 100644 --- a/console/index.md +++ b/console/index.md @@ -118,6 +118,22 @@ This key type is only used by the `none` algorithm. Key parameters `alg` and `us {"kty":"none","use":"sig","alg":"none"} ``` +#### From An Existing Secret + +> This feature was introduced in version 1.1. + +If you already have a secret, you can use it to create an octet key (`oct`). + +```sh +./jose.phar key:generate:from_secret "This is my secret" +``` + +In case your secret is binary string, you will have to encode it first (Base64) and indicate it is encoded. + +```sh +./jose.phar key:generate:from_secret "VGhpcyBpcyBteSBzZWNyZXQ=" --is_b64 +``` + ### Key Loaders The key loader commands will loader keys from various sources.