diff --git a/apps/authz/src/app/app.controller.ts b/apps/authz/src/app/app.controller.ts index 7ac04cfa3..bf22c55bb 100644 --- a/apps/authz/src/app/app.controller.ts +++ b/apps/authz/src/app/app.controller.ts @@ -1,6 +1,6 @@ import { EvaluationRequestDto } from '@app/authz/app/evaluation-request.dto' import { generateInboundRequest } from '@app/authz/app/persistence/repository/mock_data' -import { AuthorizationRequest } from '@narval/authz-shared' +import { EvaluationRequest } from '@narval/authz-shared' import { Body, Controller, Get, Logger, Post } from '@nestjs/common' import { AppService } from './app.service' @@ -32,7 +32,7 @@ export class AppController { }) // Map the DTO into the TS type because it's nicer to deal with. - const payload: AuthorizationRequest = body + const payload: EvaluationRequest = body const result = await this.appService.runEvaluation(payload) this.logger.log({ diff --git a/apps/authz/src/app/app.service.ts b/apps/authz/src/app/app.service.ts index ee37ed953..3cdeb105b 100644 --- a/apps/authz/src/app/app.service.ts +++ b/apps/authz/src/app/app.service.ts @@ -3,9 +3,9 @@ import { AuthCredential, OpaResult, RegoInput } from '@app/authz/shared/types/do import { Action, Alg, - AuthorizationRequest, - AuthorizationResponse, Decision, + EvaluationRequest, + EvaluationResponse, HistoricalTransfer, Request, Signature, @@ -143,7 +143,7 @@ export class AppService { authentication, approvals, transfers - }: AuthorizationRequest): Promise { + }: EvaluationRequest): Promise { // Pre-Process // verify the signatures of the Principal and any Approvals const decoder = new Decoder() @@ -184,7 +184,7 @@ export class AppService { // Post-processing to evaluate multisigs const finalDecision = finalizeDecision(resultSet) - const authzResponse: AuthorizationResponse = { + const authzResponse: EvaluationResponse = { decision: finalDecision.decision, request, transactionRequestIntent: intent, diff --git a/apps/authz/src/app/persistence/repository/mock_data.ts b/apps/authz/src/app/persistence/repository/mock_data.ts index f0b09d95f..b4b449e72 100644 --- a/apps/authz/src/app/persistence/repository/mock_data.ts +++ b/apps/authz/src/app/persistence/repository/mock_data.ts @@ -12,7 +12,7 @@ import { Action, Alg, AssetId, - AuthorizationRequest, + EvaluationRequest, Request, TransactionRequest, hashRequest @@ -258,7 +258,7 @@ export const mockEntityData: RegoData = { // stub out the actual tx request & signature // This is what would be the initial input from the external service -export const generateInboundRequest = async (): Promise => { +export const generateInboundRequest = async (): Promise => { const txRequest = NATIVE_TRANSFER_TX_REQUEST const request: Request = { action: Action.SIGN_TRANSACTION, diff --git a/apps/orchestration/src/policy-engine/core/service/__test__/unit/authorization-request.service.spec.ts b/apps/orchestration/src/policy-engine/core/service/__test__/unit/authorization-request.service.spec.ts index 0e5ccb65d..930461773 100644 --- a/apps/orchestration/src/policy-engine/core/service/__test__/unit/authorization-request.service.spec.ts +++ b/apps/orchestration/src/policy-engine/core/service/__test__/unit/authorization-request.service.spec.ts @@ -14,17 +14,14 @@ import { AuthorizationRequestStatus, SignTransaction } from '@app/orchestration/policy-engine/core/type/domain.type' -import { - AuthzApplicationClient, - EvaluationResponse -} from '@app/orchestration/policy-engine/http/client/authz-application.client' +import { AuthzApplicationClient } from '@app/orchestration/policy-engine/http/client/authz-application.client' import { AuthorizationRequestRepository } from '@app/orchestration/policy-engine/persistence/repository/authorization-request.repository' import { AuthorizationRequestProcessingProducer } from '@app/orchestration/policy-engine/queue/producer/authorization-request-processing.producer' import { PriceService } from '@app/orchestration/price/core/service/price.service' import { ChainId } from '@app/orchestration/shared/core/lib/chains.lib' import { Transfer } from '@app/orchestration/shared/core/type/transfer-feed.type' import { TransferFeedService } from '@app/orchestration/transfer-feed/core/service/transfer-feed.service' -import { Action, Decision, getAccountId, getAssetId } from '@narval/authz-shared' +import { Action, Decision, EvaluationResponse, getAccountId, getAssetId } from '@narval/authz-shared' import { Intents, TransferNative } from '@narval/transaction-request-intent' import { Test, TestingModule } from '@nestjs/testing' import { MockProxy, mock } from 'jest-mock-extended' diff --git a/apps/orchestration/src/policy-engine/http/client/authz-application.client.ts b/apps/orchestration/src/policy-engine/http/client/authz-application.client.ts index b2833038d..196dfc52b 100644 --- a/apps/orchestration/src/policy-engine/http/client/authz-application.client.ts +++ b/apps/orchestration/src/policy-engine/http/client/authz-application.client.ts @@ -1,12 +1,9 @@ import { ApplicationException } from '@app/orchestration/shared/exception/application.exception' -import { AuthorizationRequest, AuthorizationResponse } from '@narval/authz-shared' +import { EvaluationRequest, EvaluationResponse } from '@narval/authz-shared' import { HttpService } from '@nestjs/axios' import { HttpStatus, Injectable, Logger } from '@nestjs/common' import { catchError, lastValueFrom, map, tap } from 'rxjs' -export type EvaluationRequest = AuthorizationRequest -export type EvaluationResponse = AuthorizationResponse - @Injectable() export class AuthzApplicationClient { private logger = new Logger(AuthzApplicationClient.name) diff --git a/packages/authz-shared/src/lib/type/domain.type.ts b/packages/authz-shared/src/lib/type/domain.type.ts index e0e067d9e..88dc3eb4f 100644 --- a/packages/authz-shared/src/lib/type/domain.type.ts +++ b/packages/authz-shared/src/lib/type/domain.type.ts @@ -147,7 +147,7 @@ export type Prices = Record> * This must include all the data being authorized, and nothing except the data * being authorized. This is the data that will be hashed and signed. */ -export type AuthorizationRequest = { +export type EvaluationRequest = { /** * The initiator signature of the request using `hashRequest` method to ensure * SHA256 format. @@ -188,7 +188,7 @@ export type ApprovalRequirement = { countPrincipal: boolean } -export type AuthorizationResponse = { +export type EvaluationResponse = { decision: Decision request?: Request approvals?: {