> ## Documentation Index
> Fetch the complete documentation index at: https://hevninc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Auth Privy

> Authenticate via Privy embedded wallet signature.

1. Recover signer from signature of "I am the owner of {email}"
2. Verify via Privy API that this address is the embedded wallet for the email
3. Get or create user, save privy_address, deploy smart wallet if needed
4. Return HEVN refresh token



## OpenAPI

````yaml /openapi.json post /api/v1/auth/privy
openapi: 3.1.0
info:
  title: HEVN API
  description: Backend API for HEVN mobile neobank
  version: 0.1.2
servers:
  - url: https://api.hevn.finance
    description: Production
security: []
paths:
  /api/v1/auth/privy:
    post:
      tags:
        - auth
        - auth
      summary: Auth Privy
      description: >-
        Authenticate via Privy embedded wallet signature.


        1. Recover signer from signature of "I am the owner of {email}"

        2. Verify via Privy API that this address is the embedded wallet for the
        email

        3. Get or create user, save privy_address, deploy smart wallet if needed

        4. Return HEVN refresh token
      operationId: auth_privy_api_v1_auth_privy_post
      parameters:
        - name: device-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Device-Id
        - name: device-name
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Device-Name
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrivyLoginRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrivyLoginResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    PrivyLoginRequest:
      properties:
        signature:
          type: string
          title: Signature
        email:
          type: string
          title: Email
        address:
          type: string
          title: Address
        nonce:
          type: integer
          title: Nonce
      type: object
      required:
        - signature
        - email
        - address
        - nonce
      title: PrivyLoginRequest
      description: Request to link a Privy wallet.
    PrivyLoginResponse:
      properties:
        refreshToken:
          type: string
          title: Refreshtoken
        userId:
          type: string
          title: Userid
        email:
          type: string
          title: Email
        isNewUser:
          type: boolean
          title: Isnewuser
          default: false
        privyAddress:
          type: string
          title: Privyaddress
        baseSmartWallet:
          anyOf:
            - type: string
            - type: 'null'
          title: Basesmartwallet
      type: object
      required:
        - refreshToken
        - userId
        - email
        - privyAddress
      title: PrivyLoginResponse
      description: Response after Privy wallet auth.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      x-default: Bearer <token>

````