crypto = $crypto; $this->addType('appId', 'string'); $this->addType('userId', 'string'); $this->addType('httpMethod', 'string'); $this->addType('uri', 'string'); $this->addType('event', 'string'); $this->addType('eventFilter', 'json'); $this->addType('userIdFilter', 'string'); $this->addType('headers', 'json'); $this->addType('authMethod', 'string'); $this->addType('authData', 'string'); } public function getAuthMethodEnum(): AuthMethod { return AuthMethod::from($this->getAuthMethod()); } public function getAuthDataClear(): array { $authData = $this->getAuthData(); if ($authData === null) { return []; } return json_decode($this->crypto->decrypt($authData), associative:true, flags:JSON_THROW_ON_ERROR); } public function setAuthDataClear( #[\SensitiveParameter] ?array $data, ): void { if ($data === null) { if ($this->getAuthMethodEnum() === AuthMethod::Header) { throw new \UnexpectedValueException('Header auth method needs an associative array of headers as auth data'); } $this->setAuthData(null); return; } $this->setAuthData($this->crypto->encrypt(json_encode($data))); } public function jsonSerialize(): array { $fields = array_keys($this->getFieldTypes()); return array_combine( $fields, array_map( fn ($field) => $this->getter($field), $fields ) ); } public function getAppId(): ?string { return $this->appId; } }