emolero's picture
Upload folder using huggingface_hub
ab74ec2 verified
|
Raw
History Blame Contribute Delete
10.7 kB

blockchain-public-address-validation

openapi: 3.0.3
info:
  title: Blockchain Public Address Validation
  description: |-
    This API allows the API consumer to generate a one-time nonce for Enhanced Binding validation for Blockchain Public Address associated with a mobile phone number.

    # Relevant Definitions and concepts
    - **Blockchain Public Address**: Unique string of code used by individuals that can be used to send, receive, and store digital assets (e.g. payments in cryptocurrencies, smart contracts, NFT (Non-Fungible Tokens), etc.) on a blockchain network
    to receive or request payments in cryptocurrency.

    # API Functionality
    This API allows to generate a one-time nonce to allow for enhanced validation procedure for Blockchain Public Address binding associated with a mobile phone number, as per defined in `bindBlockchainPublicAddress` operation of CAMARA Blockchain Public Address API.

    # Resources and Operations overview
    This API provides one endpoint:
     - **Endpoint to generate a one-time nonce associated to a specific Blockchain Public Address**. It does not matter if the mobile phone number is already bound to a Blockchain Public Address, as this operation adds a new Blockchain Public Address. This operation MUST be used with a 3-legged Access Token

    # Authorization and authentication

    The "Camara Security and Interoperability Profile" provides details of how an API consumer requests an access token. Please refer to Identity and Consent Management (https://github.com/camaraproject/IdentityAndConsentManagement/) for the released version of the profile.

    The specific authorization flows to be used will be agreed upon during the onboarding process, happening between the API consumer and the API provider, taking into account the declared purpose for accessing the API, whilst also being subject to the prevailing legal framework dictated by local legislation.

    In cases where personal data is processed by the API and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of three-legged access tokens is mandatory. This ensures that the API remains in compliance with privacy regulations, upholding the principles of transparency and user-centric privacy-by-design.

    # Additional CAMARA error responses

    The list of error codes in this API specification is not exhaustive. Therefore the API specification may not document some non-mandatory error statuses as indicated in `CAMARA API Design Guide`.

    Please refer to the `CAMARA_common.yaml` of the Commonalities Release associated to this API version for a complete list of error responses. The applicable Commonalities Release can be identified in the `API Readiness Checklist` document associated to this API version.

    As a specific rule, error `501 - NOT_IMPLEMENTED` can be only a possible error response if it is explicitly documented in the API.

    # Further Info and Support

    (FAQs will be added in a later version of the documentation)
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: wip
  x-camara-commonalities: wip
externalDocs:
  description: Product documentation at Camara
  url: https://github.com/camaraproject/BlockchainPublicAddress
servers:
  - url: "{apiRoot}/blockchain-public-address-validation/vwip"
    variables:
      apiRoot:
        default: http://localhost:9091
        description: API root, defined by the service provider
tags:
  - name: Blockchain Public Address Validation Nonce
    description: API operations to manage Blockchain Public Address Validation Nonce
paths:
  /nonce:
    post:
      tags:
        - Blockchain Public Address Validation Nonce
      summary: Generates a one-time nonce associated to a specific Blockchain Public Address
      description: Generates a one-time nonce (i.e. challenge) associated to a specific Blockchain Public Address to allow for enhanced validation as per defined in `bindBlockchainPublicAddress` operation of CAMARA Blockchain Public Address API.
      operationId: createBlockchainPublicAddressValidationNonce
      security:
        - openId:
            - blockchain-public-address-validation:create
      parameters:
        - $ref: "#/components/parameters/x-correlator"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateBlockchainPublicAddressValidationNonce"
        required: true
      responses:
        "201":
          description: Created
          headers:
            x-correlator:
              $ref: "#/components/headers/x-correlator"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateBlockchainPublicAddressValidationNonceResponse"
              examples:
                CreateBlockchainPublicAddressValidationNonceResponse201Example:
                  value:
                    nonce: "abc626ce-5284-4a84-b85e-46e0ee3d0434"
        "400":
          $ref: "#/components/responses/Generic400"
        "401":
          $ref: "#/components/responses/Generic401"
        "403":
          $ref: "#/components/responses/Generic403"
        "429":
          $ref: "#/components/responses/Generic429"
components:
  securitySchemes:
    openId:
      type: openIdConnect
      openIdConnectUrl: https://example.com/.well-known/openid-configuration
  headers:
    x-correlator:
      description: Correlation id for the different services
      schema:
        $ref: "#/components/schemas/XCorrelator"
  parameters:
    x-correlator:
      name: x-correlator
      in: header
      description: Correlation id for the different services
      schema:
        $ref: "#/components/schemas/XCorrelator"
  schemas:
    XCorrelator:
      type: string
      pattern: ^[a-zA-Z0-9-_:;.\/<>{}]{0,256}$
      example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46"
    CreateBlockchainPublicAddressValidationNonce:
      type: object
      description: Payload to request the nonce generation associated to a given Blockchain Public Address
      required:
        - blockchainPublicAddress
      properties:
        blockchainPublicAddress:
          type: string
          description: User's Blockchain Public Address use for the latter binding to a specific `phoneNumber`.
      example:
        blockchainPublicAddress: "0x71C7656EC7ab88b098dafB451B2314C5f6d8932A"
    CreateBlockchainPublicAddressValidationNonceResponse:
      type: object
      description: Nonce generation associated to a given Blockchain Public Address response
      required:
        - nonce
      properties:
        nonce:
          type: string
          description: |-
            One-time challenge generated associated to indicated `blockchainPublicAddress`.
    ErrorInfo:
      type: object
      required:
        - status
        - code
        - message
      properties:
        message:
          type: string
          description: A human-readable description of what the event represents
        status:
          type: integer
          description: HTTP response status code
        code:
          type: string
          description: A human-readable code to describe the error
  responses:
    Generic400:
      description: Problem with the client request
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 400
                  code:
                    enum:
                      - INVALID_ARGUMENT
          examples:
            GENERIC_400_INVALID_ARGUMENT:
              description: Invalid Argument. Generic Syntax Exception
              value:
                status: 400
                code: INVALID_ARGUMENT
                message: Client specified an invalid argument, request body or query param.
    Generic401:
      description: Unauthorized
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 401
                  code:
                    enum:
                      - UNAUTHENTICATED
          examples:
            GENERIC_401_UNAUTHENTICATED:
              description: Request cannot be authenticated and a new authentication is required
              value:
                status: 401
                code: UNAUTHENTICATED
                message: Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required.
    Generic403:
      description: Forbidden
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 403
                  code:
                    enum:
                      - PERMISSION_DENIED
          examples:
            GENERIC_403_PERMISSION_DENIED:
              description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security
              value:
                status: 403
                code: PERMISSION_DENIED
                message: Client does not have sufficient permissions to perform this action.
    Generic429:
      description: Too Many Requests
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 429
                  code:
                    enum:
                      - TOO_MANY_REQUESTS
          examples:
            GENERIC_429_TOO_MANY_REQUESTS:
              description: Access to the API has been temporarily blocked due to rate or spike arrest limits being reached
              value:
                status: 429
                code: TOO_MANY_REQUESTS
                message: Rate limit reached.