| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 56 | 7 | public function build(string $payload): P256EncryptedMessageContract |
|
| 57 | { |
||
| 58 | 7 | $subscriber_public_key = Base64Url::decode($this->public_key); |
|
| 59 | 7 | $subscriber_auth_token = Base64Url::decode($this->auth_token); |
|
| 60 | |||
| 61 | 7 | $subscriber_p256 = $this->ec->keyFromPublic(bin2hex($subscriber_public_key), 'hex'); |
|
| 62 | 7 | $server_p256 = $this->ec->genKeyPair(); |
|
| 63 | |||
| 64 | 7 | $salt = random_bytes(Constants::SALT_BYTE_LENGTH); |
|
| 65 | |||
| 66 | 7 | return $this->container->make(P256EncryptedMessageContract::class, [ |
|
| 67 | 7 | 'private' => $server_p256, |
|
| 68 | 7 | 'subscriber' => $subscriber_p256, |
|
| 69 | 7 | 'auth_token' => $subscriber_auth_token, |
|
| 70 | 7 | 'salt' => $salt, |
|
| 71 | 7 | 'payload' => $payload, |
|
| 72 | ]); |
||
| 75 |