Skip to content
Snippets Groups Projects
README.md 2.39 KiB
Newer Older
## API Module

The API-module contains interfaces and domain model value classes that provide the basic functionality to build an
SDK client.

### Structure

- **api.domain** - contains all model classes and domain related POJOs
- **api.exceptions** - all use case specific exceptions thrown by services
- **api.services** - all services to authenticate, encrypt, validate and perform REST-requests

There are two service facade interfaces that provide a client centric wrapper around the underlying services,

- **Sender** - create a submission, announce attachments, encrypt and send the submission including metadata
- **Subscriber** - poll, receive and decrypt submissions and confirm their valid transmission

### Service Architecture

Apart from the ClientFactory the overall service architecture focuses on composition and has no inherited dependencies.

```mermaid
classDiagram

  class CryptoService{
    + decryptString
    + decryptBytes 
    + encryptString
    + encryptBytes 
   }


   class CertificateValidator{
        + validatePublicKey
  }

  class MetadataValidator{
    + validateMetadataSchema
    + validateMetadataHashValues
  }

  class MetadataService{
    + createMetadata
  }

  class OAuthService{
   + authenticate
  }

  class SenderFacade {
    + retrieveOAuthToken
    + validatePublicKey
    + encryptSubmissionData
    + encryptAttachment
    + createMetadata
    + createSubmission
    + sendSubmission
    + uploadAttachments
    + createAttachment
    + getEncryptionKeyForDestination
  }

   class SubscriberFacade {
    + retrieveOAuthToken
    + decryptStringContent
    + pollAvailableSubmissions
    + getSubmission
    + fetchAttachments
    + validateEventLog
    + validateMetadata
    + validateData
    + validateAttachments
    + confirmValidSubmission
  }
  
  class SubscriberClient{
       SubscriberFacade
  }
  
  class SenderClient{
        SenderFacade
  }
 
    class ClientFactory {
        AppplicationConfig
  }
  
 
ClientFactory  ..> SenderClient : Constructs
ClientFactory  ..> SubscriberClient : Constructs

SenderClient ..> SenderFacade : Uses
SubscriberClient ..> SubscriberFacade : Uses

SenderFacade ..> CertificateValidator : Uses

SenderFacade ..> MetadataService : Uses
SenderFacade ..> OAuthService : Uses
SenderFacade ..> CryptoService : Uses

SubscriberFacade ..> OAuthService : Uses
SubscriberFacade ..> CryptoService : Uses
SubscriberFacade ..> MetadataValidator : Uses

```