PHP Classes

File: docs/Internals/Traits/JsonSugar.md

Recommend this page to a friend!
  Classes of Scott Arciszewski   sapient   docs/Internals/Traits/JsonSugar.md   Download  
File: docs/Internals/Traits/JsonSugar.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: sapient
Add a security layer to server to server requests
Author: By
Last change:
Date: 6 years ago
Size: 1,540 bytes
 

Contents

Class file image Download

The JSON Sugar Trait

The methods here are similar to the string methods, except:

  1. They assume that the message body is a valid JSON string
  2. They dcode the message body into an array

decodeSymmetricAuthenticatedJsonRequest() / decodeSymmetricAuthenticatedJsonResponse()

Function prototypes:

function decodeSymmetricAuthenticatedJsonRequest(
    RequestInterface $request,
    SharedAuthenticationKey $key
): array;

function decodeSymmetricAuthenticatedJsonResponse(
    ResponseInterface $response,
    SharedAuthenticationKey $key
): array;

decodeSignedJsonRequest() / decodeSignedJsonResponse()

Function prototypes:

function decodeSignedJsonRequest(
    RequestInterface $request,
    SigningPublicKey $publicKey
): array;

function decodeSignedJsonResponse(
    ResponseInterface $response,
    SigningPublicKey $publicKey
): array;

decryptJsonRequestWithSharedKey() / decryptJsonResponseWithSharedKey()

Function prototypes:

function decryptJsonRequestWithSharedKey(
    RequestInterface $request,
    SharedEncryptionKey $key
): array;

function decryptJsonResponseWithSharedKey(
    ResponseInterface $response,
    SharedEncryptionKey $key
): array;

unsealJsonRequest() / unsealJsonResponse()

Function prototypes:

function unsealJsonRequest(
    RequestInterface $request,
    SealingSecretKey $secretKey
): array;

function unsealJsonResponse(
    ResponseInterface $response,
    SealingSecretKey $secretKey
): array;