Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump @nx/devkit from 19.5.1 to 20.4.0 #615

Open
wants to merge 127 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
e2d81d9
Provider integration database migration (#6)
wcalderipe Dec 4, 2024
2dcc4db
Move Vault constants to shared (#7)
wcalderipe Dec 4, 2024
b8adf9b
Refactor privateKeyToJwk and getPublicKey to return the right type gi…
wcalderipe Dec 4, 2024
0432536
Create connection draft
wcalderipe Dec 4, 2024
65e887e
basic seed
Ptroger Dec 4, 2024
3f0b159
Encode and decode Anchorage credentials
wcalderipe Dec 4, 2024
db902a2
Remove provider type draft
wcalderipe Dec 4, 2024
ae1f0a9
clarified seed object
Ptroger Dec 4, 2024
6e57658
Initiate, activate and create flow with encryption
wcalderipe Dec 5, 2024
034fbd8
Add tests for the encryption key
wcalderipe Dec 5, 2024
cfb6ad0
Rename encryption module to transit encryption
wcalderipe Dec 6, 2024
56e5e73
Add tests to the decrypt
wcalderipe Dec 6, 2024
ef0eae5
Rename table to transit_encryption_key
wcalderipe Dec 6, 2024
c4e309a
Work in progress with repository static map method
wcalderipe Dec 6, 2024
fd49132
Add connection findAll
wcalderipe Dec 6, 2024
6fb1cc9
Refactor connection to have a clear boundary on statuses
wcalderipe Dec 6, 2024
d3fce5c
List connections endpoint
wcalderipe Dec 9, 2024
a63764b
Add endpoint to get connection by ID
wcalderipe Dec 9, 2024
cf6ba8f
Bump @nestjs/platform-express from 10.3.9 to 10.4.15
dependabot[bot] Dec 9, 2024
350eedb
Bump axios-retry from 4.4.2 to 4.5.0
dependabot[bot] Dec 9, 2024
94842fe
Bump @openapitools/openapi-generator-cli from 2.13.4 to 2.15.3
dependabot[bot] Dec 9, 2024
3341689
Bump dotenv from 16.4.5 to 16.4.7
dependabot[bot] Dec 9, 2024
280054b
Add update connection endpoint
wcalderipe Dec 10, 2024
ada1061
Improve invalid connection status error handling
wcalderipe Dec 10, 2024
678fc21
Bump RSA key length from 2048 to 4096
wcalderipe Dec 10, 2024
e8b9a29
Update patch endpoint docs
wcalderipe Dec 10, 2024
b2b30be
cleanup seed
Ptroger Dec 10, 2024
a51f12d
Merge pull request #10 from narval-xyz/wallet-seed
Ptroger Dec 10, 2024
5b6e1ec
Merge pull request #9 from narval-xyz/feat/create-provider-connection
wcalderipe Dec 11, 2024
f72fcec
Feature/nar 1987 get wallets accounts addresses (#11)
Ptroger Dec 11, 2024
44255a0
Add sync API (#19)
wcalderipe Dec 13, 2024
422288b
Merge pull request #15 from narval-xyz/dependabot/npm_and_yarn/axios-…
mattschoch Dec 13, 2024
a6bdc6d
Merge pull request #14 from narval-xyz/dependabot/npm_and_yarn/nestjs…
mattschoch Dec 13, 2024
576874b
Merge pull request #16 from narval-xyz/dependabot/npm_and_yarn/openap…
mattschoch Dec 13, 2024
d97b3b7
Merge pull request #17 from narval-xyz/dependabot/npm_and_yarn/dotenv…
mattschoch Dec 13, 2024
5eb7138
Add Anchorage sync (#20)
wcalderipe Dec 16, 2024
492d664
Declarative config file for App & Client configs, switching to relati…
mattschoch Dec 17, 2024
27e4995
Revert nestjs/platform-express version bump because it breaks the npm…
mattschoch Dec 17, 2024
d61f072
Fixing enncryption_master_key column spelling
mattschoch Dec 17, 2024
30a6d7e
Exposing new configuration options to POST /clients (#34)
mattschoch Dec 17, 2024
6830e83
Refactor sync (#25)
wcalderipe Dec 17, 2024
946534c
RSA jwk<>pem (#35)
mattschoch Dec 17, 2024
540edff
Update Vault SDK v0.11.0 (#36)
wcalderipe Dec 17, 2024
d4b3fa6
fix pem description
mattschoch Dec 17, 2024
4178f45
Simplified pagination (#33)
Ptroger Dec 17, 2024
bc7a109
Updating prettier config to use single quotes for yaml
mattschoch Dec 17, 2024
e3f703c
Adding eddsa signing for jwsd headers too
mattschoch Dec 18, 2024
f941063
Fix crash on sync (#39)
wcalderipe Dec 18, 2024
b879290
Fix anchorage sigend request (#41)
wcalderipe Dec 18, 2024
a3e7ba2
Wrap provider API responses into "data" (#42)
wcalderipe Dec 18, 2024
819fdb1
Fix Anchorage signed request for paginated responses (#45)
wcalderipe Dec 18, 2024
a8a3777
Refactor encryption key endpoint to use the same logic (#44)
wcalderipe Dec 18, 2024
7e7517c
Add CONNECTION_WRITE permission in the enc key (#46)
wcalderipe Dec 18, 2024
4b911a3
vault config.yaml and .env default file cleanup, dev config & setup s…
mattschoch Dec 19, 2024
4711e67
Adding config.example.yaml and gitignoring local.yaml
mattschoch Dec 19, 2024
515aef5
Moving db connection back to .env instead of config.yaml because Migr…
mattschoch Dec 19, 2024
e88a971
activate endpoint overrides private key when provided (#43)
Ptroger Dec 20, 2024
e7914d7
indexed createdAt and clientId on provider data (#47)
Ptroger Dec 20, 2024
369cdae
Feature/nar 2016 sync known addresses (#49)
Ptroger Dec 20, 2024
409140a
Prevent usage of plain credentials in production (#50)
wcalderipe Dec 23, 2024
e9dde87
Send transfer to Anchorage (#48)
wcalderipe Dec 23, 2024
c674b40
naming convention over mock response files
Ptroger Dec 23, 2024
f12ec3a
Revert "naming convention over mock response files"
Ptroger Dec 23, 2024
6273015
New connection finding an existing wallet creates join row (#51)
Ptroger Dec 23, 2024
cd49b8f
Updating OpenAPI annotations & codegen & cleaning up Vault sdk a bit …
mattschoch Dec 24, 2024
f63b6f3
Feature/nar 2017 assettype networkid mapping (#54)
Ptroger Dec 26, 2024
1b769ed
minor version bump with eddsa signing support (#56)
Ptroger Dec 26, 2024
51184fa
read endpoints for known-destinations (#55)
Ptroger Dec 26, 2024
8173cc0
removing exception and piping success and errors from anchorage (#57)
Ptroger Dec 30, 2024
ba20846
Introduce provider mandatory interfaces (#58)
wcalderipe Dec 30, 2024
9364b72
Infer type from Alg in generateJwk (#60)
wcalderipe Dec 30, 2024
df2a245
Add spans and logs on mission critical services (#59)
wcalderipe Dec 30, 2024
43457d6
Support base convert operations for RSA private key (#62)
wcalderipe Dec 31, 2024
cf926d7
correctly pass pagination through known-destinations (#67)
Ptroger Jan 2, 2025
5183e51
SDK v0.15.0 - vault provider sdk - add all new endpoints (#66)
mattschoch Jan 2, 2025
7b2a1d1
Fireblocks connection (#64)
wcalderipe Jan 3, 2025
d6b370e
Unified example with SDK (#40)
Ptroger Jan 3, 2025
83be2a6
Add FB connection E2E test (#68)
wcalderipe Jan 3, 2025
694084d
Feature/nar 1982 raw proxy fireblocks (#63)
Ptroger Jan 6, 2025
4cba5ba
SendTransfer requires a connectionId (#71)
Ptroger Jan 7, 2025
da2673a
Transfer status by ID (#72)
wcalderipe Jan 7, 2025
27a70d9
Add network mapping endpoint (#73)
wcalderipe Jan 7, 2025
27529d1
Map Anchorage network ID during the sync (#74)
wcalderipe Jan 7, 2025
75d1ebc
Adding transfer.asset field & resolving Destination address based on …
mattschoch Jan 7, 2025
698943a
Fixing asset network lookup
mattschoch Jan 7, 2025
e2d0814
Data migration to fix network ID in staging (#76)
wcalderipe Jan 7, 2025
d4fe06f
HOTFIX - actually using the Narval networkId in the known destination…
mattschoch Jan 8, 2025
4f6f98e
fixing test
mattschoch Jan 8, 2025
829bf72
Feat/fb client (#78)
Ptroger Jan 10, 2025
12b9401
Fixing network mapping
mattschoch Jan 13, 2025
cecd1dd
Updating mock data for anchorageId in network mapping
mattschoch Jan 13, 2025
4279685
Fix Anchorage trusted addresses transfer destination
wcalderipe Jan 13, 2025
33290c3
Remove the extra call destination
wcalderipe Jan 13, 2025
0e4f720
Feature/nar 1985 sync fireblocks (#79)
Ptroger Jan 14, 2025
fc10045
Unified network list (#77)
wcalderipe Jan 15, 2025
1691a74
Fixing anchorage sync pagination; removing credentials in logging
mattschoch Jan 15, 2025
e14cb7f
Updating transfer example; working to a destination address (#82)
mattschoch Jan 15, 2025
63551ff
Adding more space for clock skew in jws signatures
mattschoch Jan 15, 2025
a1f0c2e
Updates to the /examples/unified-api scripts
mattschoch Jan 16, 2025
0bf0114
Fireblocks transfer (#80)
wcalderipe Jan 17, 2025
b42048c
Fix Fireblocks transaction type (#85)
wcalderipe Jan 17, 2025
d827d52
Fix Fireblocks block hash type (#87)
wcalderipe Jan 17, 2025
68e4243
Hotfix - pagination query params were breaking request signing
mattschoch Jan 17, 2025
bf72bcc
Unified asset list (#89)
wcalderipe Jan 20, 2025
797ff5f
Add LINK asset on ZKsync Sepolia (#100)
wcalderipe Jan 22, 2025
8faa5ef
Scoped by connection (#93)
wcalderipe Jan 27, 2025
d1f17e5
Update Unified API Anchorage examples (#106)
wcalderipe Jan 27, 2025
798e568
Fix findAll network (#108)
wcalderipe Jan 27, 2025
c38b294
Improve Vault's test speed (#115)
wcalderipe Jan 28, 2025
67ef11f
Delete sync operations (#110)
Ptroger Jan 28, 2025
09f92c7
declare mock-server (#116)
Ptroger Jan 28, 2025
3fdaa09
Revert "declare mock-server (#116)"
Ptroger Jan 28, 2025
4b7f228
Revert "Delete sync operations (#110)"
Ptroger Jan 28, 2025
6a5e2e9
Delete sync operation rebased (#117)
Ptroger Jan 28, 2025
b4c55a1
misc hotfix on transfer example
mattschoch Jan 30, 2025
5b3f7d9
HOTFIX ensuring we upsert provider networks
mattschoch Jan 30, 2025
52809f9
Merge pull request #119 from narval-xyz/chore/transfer-example-hotfix
mattschoch Jan 31, 2025
8060b94
Bind access token to a given public key (#120)
wcalderipe Jan 31, 2025
37cc70f
BitGo Integration
mattschoch Feb 3, 2025
4874ea8
Revert "BitGo Integration"
mattschoch Feb 3, 2025
ec91a12
Feature/nar 2067 declarative config engine (#124)
mattschoch Feb 4, 2025
10cd689
Fix authorization guard access check (#129)
wcalderipe Feb 4, 2025
5d9dd45
Revert "Fix authorization guard access check (#129)" (#131)
wcalderipe Feb 4, 2025
7697642
HOTFIX - engine should not use nowSeconds, iat should be set by armory
mattschoch Feb 5, 2025
66cf58b
Fixing iat in test
mattschoch Feb 5, 2025
9b1c6ce
Add "Fix authorization guard access check" back (#133)
wcalderipe Feb 5, 2025
1a40068
Bump @nx/devkit from 19.5.1 to 20.4.0
dependabot[bot] Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ Thumbs.db
.env.production
.env.test

config/*
!config/*.example.yaml
!config/*.template.yaml

/rego-build
/apps/devtool/storage.json

Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dist/*
.nx/cache/*
deploy/charts/*
/.nx/workspace-data
.next/*

# Generated code
packages/armory-sdk/src/http/client
Expand Down
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
"useTabs": false,
"overrides": [
{
"files": ["*.yml", "*.yaml"],
"options": {
"quoteProps": "preserve"
}
}
]
}
6 changes: 4 additions & 2 deletions apps/armory/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ armory/build:
# === Code format ===

armory/format:
npx nx format:write --projects ${ARMORY_PROJECT_NAME}
npx nx format:write --projects ${ARMORY_PROJECT_NAME}
npx prisma format --schema ${ARMORY_DATABASE_SCHEMA}

armory/lint:
npx nx lint ${ARMORY_PROJECT_NAME} -- --fix

armory/format/check:
npx nx format:check --projects ${ARMORY_PROJECT_NAME}
npx nx format:check --projects ${ARMORY_PROJECT_NAME}
npx prisma format --schema ${ARMORY_DATABASE_SCHEMA}

armory/lint/check:
npx nx lint ${ARMORY_PROJECT_NAME}
Expand Down
21 changes: 0 additions & 21 deletions apps/armory/src/armory.constant.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import {
REQUEST_HEADER_CLIENT_ID,
REQUEST_HEADER_CLIENT_SECRET,
adminApiKeySecurity,
clientIdSecurity,
clientSecretSecurity
} from '@narval/nestjs-shared'
import { AssetId } from '@narval/policy-engine-shared'
import { ClassSerializerInterceptor, ValidationPipe } from '@nestjs/common'
import { APP_FILTER, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core'
Expand Down Expand Up @@ -51,20 +44,6 @@ export const DEFAULT_HTTP_MODULE_PROVIDERS = [
...HTTP_VALIDATION_PIPES
]

//
// Headers
//

export const REQUEST_HEADER_API_KEY = 'x-api-key'

//
// API Security
//

export const ADMIN_SECURITY = adminApiKeySecurity(REQUEST_HEADER_API_KEY)
export const CLIENT_ID_SECURITY = clientIdSecurity(REQUEST_HEADER_CLIENT_ID)
export const CLIENT_SECRET_SECURITY = clientSecretSecurity(REQUEST_HEADER_CLIENT_SECRET)

//
// Queues
//
Expand Down
45 changes: 29 additions & 16 deletions apps/armory/src/client/__test__/e2e/client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { ConfigModule, ConfigService } from '@narval/config-module'
import { LoggerModule, OpenTelemetryModule, secret } from '@narval/nestjs-shared'
import { DataStoreConfiguration, HttpSource, PublicClient, Source, SourceType } from '@narval/policy-engine-shared'
import { getPublicKey, privateKeyToJwk } from '@narval/signature'
import { LoggerModule, OpenTelemetryModule, REQUEST_HEADER_ADMIN_API_KEY, secret } from '@narval/nestjs-shared'
import { DataStoreConfiguration, HttpSource, Source, SourceType } from '@narval/policy-engine-shared'
import { SigningAlg, getPublicKey, privateKeyToJwk } from '@narval/signature'
import { HttpStatus, INestApplication } from '@nestjs/common'
import { Test, TestingModule } from '@nestjs/testing'
import nock from 'nock'
import request from 'supertest'
import { generatePrivateKey } from 'viem/accounts'
import { AppService } from '../../../app/core/service/app.service'
import { Config, load } from '../../../armory.config'
import { REQUEST_HEADER_API_KEY } from '../../../armory.constant'
import { TestPrismaService } from '../../../shared/module/persistence/service/test-prisma.service'
import { ClientModule } from '../../client.module'
import { ClientService } from '../../core/service/client.service'
import { PolicyEnginePublicClient } from '../../core/type/client.type'
import { CreateClientRequestDto } from '../../http/rest/dto/create-client.dto'

// TODO: (@wcalderipe, 16/05/24) Evaluate testcontainers
Expand All @@ -32,13 +32,26 @@ const mockPolicyEngineServer = (url: string, clientId: string) => {
keys: [getPublicKey(privateKeyToJwk(generatePrivateKey()))]
}

const createClientResponse: PublicClient = {
const createClientResponse: PolicyEnginePublicClient = {
clientId,
clientSecret: secret.generate(),
name: 'Acme',
configurationSource: 'dynamic',
baseUrl: null,
auth: {
disabled: false,
local: {
clientSecret: secret.generate()
}
},
createdAt: new Date(),
updatedAt: new Date(),
signer: {
publicKey: getPublicKey(privateKeyToJwk(generatePrivateKey()))
decisionAttestation: {
disabled: false,
signer: {
alg: SigningAlg.EIP191,
keyId: 'acme-key-ie',
publicKey: getPublicKey(privateKeyToJwk(generatePrivateKey()))
}
},
dataStore: {
entity: dataStoreConfig,
Expand Down Expand Up @@ -135,7 +148,7 @@ describe('Client', () => {

const { status, body } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send(createClientPayload)

const actualClient = await clientService.findById(body.id)
Expand Down Expand Up @@ -171,7 +184,7 @@ describe('Client', () => {

const { body } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send(createClientWithGivenPolicyEngine)

const actualClient = await clientService.findById(body.id)
Expand All @@ -187,7 +200,7 @@ describe('Client', () => {

const { body } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send({ ...createClientPayload, clientSecret })

const actualClient = await clientService.findById(body.id)
Expand All @@ -201,7 +214,7 @@ describe('Client', () => {

const { body } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send(createClientPayload)

const actualClient = await clientService.findById(body.id)
Expand All @@ -215,7 +228,7 @@ describe('Client', () => {

const { body } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send({ ...createClientPayload, useManagedDataStore: true })

const actualClient = await clientService.findById(body.id)
Expand All @@ -240,7 +253,7 @@ describe('Client', () => {

const { status, body } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send({
...createClientPayload,
useManagedDataStore: true,
Expand Down Expand Up @@ -277,7 +290,7 @@ describe('Client', () => {
it('responds with unprocessable entity when payload is invalid', async () => {
const { status } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, adminApiKey)
.set(REQUEST_HEADER_ADMIN_API_KEY, adminApiKey)
.send({})

expect(status).toEqual(HttpStatus.UNPROCESSABLE_ENTITY)
Expand All @@ -286,7 +299,7 @@ describe('Client', () => {
it('responds with forbidden when admin api key is invalid', async () => {
const { status } = await request(app.getHttpServer())
.post('/clients')
.set(REQUEST_HEADER_API_KEY, 'invalid-admin-api-key')
.set(REQUEST_HEADER_ADMIN_API_KEY, 'invalid-admin-api-key')
.send({})

expect(status).toEqual(HttpStatus.FORBIDDEN)
Expand Down
37 changes: 36 additions & 1 deletion apps/armory/src/client/core/type/client.type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataStoreConfiguration } from '@narval/policy-engine-shared'
import { jwkSchema, publicKeySchema } from '@narval/signature'
import { jwkSchema, publicKeySchema, SigningAlg } from '@narval/signature'
import { z } from 'zod'

export const PolicyEngineNode = z.object({
Expand Down Expand Up @@ -61,3 +61,38 @@ export const PublicClient = Client.extend({
})
})
export type PublicClient = z.infer<typeof PublicClient>

export const PolicyEnginePublicClient = z.object({
clientId: z.string(),
name: z.string(),
configurationSource: z.literal('declarative').or(z.literal('dynamic')), // Declarative = comes from config file, Dynamic = created at runtime
baseUrl: z.string().nullable(),

auth: z.object({
disabled: z.boolean(),
local: z
.object({
clientSecret: z.string().nullable()
})
.nullable()
}),

dataStore: z.object({
entity: DataStoreConfiguration,
policy: DataStoreConfiguration
}),

decisionAttestation: z.object({
disabled: z.boolean(),
signer: z
.object({
alg: z.nativeEnum(SigningAlg),
keyId: z.string().nullable().describe('Unique id of the signer key. Matches the kid in both jwks'),
publicKey: publicKeySchema.optional()
})
.nullable()
}),
createdAt: z.coerce.date(),
updatedAt: z.coerce.date()
})
export type PolicyEnginePublicClient = z.infer<typeof PolicyEnginePublicClient>
12 changes: 9 additions & 3 deletions apps/armory/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ import { instrumentTelemetry } from '@narval/open-telemetry'
instrumentTelemetry({ serviceName: 'armory' })

import { ConfigService } from '@narval/config-module'
import { LoggerService, withApiVersion, withCors, withLogger, withSwagger } from '@narval/nestjs-shared'
import {
LoggerService,
securityOptions,
withApiVersion,
withCors,
withLogger,
withSwagger
} from '@narval/nestjs-shared'
import { ClassSerializerInterceptor, INestApplication, ValidationPipe } from '@nestjs/common'
import { NestFactory, Reflector } from '@nestjs/core'
import compression from 'compression'
import { json } from 'express'
import { lastValueFrom, map, of, switchMap } from 'rxjs'
import { Config } from './armory.config'
import { ADMIN_SECURITY, CLIENT_ID_SECURITY, CLIENT_SECRET_SECURITY } from './armory.constant'
import { ArmoryModule } from './armory.module'
import { ApplicationExceptionFilter } from './shared/filter/application-exception.filter'
import { HttpExceptionFilter } from './shared/filter/http-exception.filter'
Expand Down Expand Up @@ -103,7 +109,7 @@ async function bootstrap(): Promise<void> {
title: 'Armory',
description: 'Authentication and authorization system for web3.0',
version: '1.0',
security: [ADMIN_SECURITY, CLIENT_ID_SECURITY, CLIENT_SECRET_SECURITY]
security: [securityOptions.clientId, securityOptions.clientSecret, securityOptions.adminApiKey]
})
),
switchMap((app) => app.listen(port))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ describe('Authorization Request', () => {
idempotencyKey: '8dcbb7ad-82a2-4eca-b2f0-b1415c1d4a17',
evaluations: [],
approvals: [],
errors: [],
createdAt: new Date(),
updatedAt: new Date()
}
Expand Down
2 changes: 2 additions & 0 deletions apps/armory/src/orchestration/http/rest/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ export const toCreateAuthorizationRequest = (
const authentication = dto.authentication
const approvals = dto.approvals || []
const audience = dto.metadata?.audience
const confirmation = dto.metadata?.confirmation
const metadata = {
...(audience && { audience }),
...(confirmation && { confirmation }),
expiresIn: dto.metadata?.expiresIn || TEN_MINUTES,
issuedAt: nowSeconds(),
issuer: `${clientId}.armory.narval.xyz`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {
Approvals,
AuthorizationRequest,
AuthorizationRequestError,
AuthorizationRequestMetadata,
Evaluation
} from '@narval/policy-engine-shared'
import {
ApprovalRequirement as ApprovalRequirementModel,
AuthorizationRequestError as AuthorizationRequestErrorModel,
Prisma
AuthorizationRequestError as AuthorizationRequestErrorModel
} from '@prisma/client/armory'
import { ZodIssueCode, ZodSchema, z } from 'zod'
import { ACTION_REQUEST } from '../../orchestration.constant'
Expand All @@ -33,10 +33,18 @@ const buildSharedAttributes = (model: AuthorizationRequestModel): Omit<Authoriza
authentication: model.authnSig,
approvals: z.array(z.string()).parse(model.approvals.filter(({ error }) => !error).map((approval) => approval.sig)),
evaluations: (model.evaluationLog || []).map(decodeEvaluationLog),
metadata: model.metadata as Prisma.InputJsonObject,
errors: (model.errors || []).map(buildError),
createdAt: model.createdAt,
updatedAt: model.updatedAt
updatedAt: model.updatedAt,
...(model.errors && model.errors.length
? {
errors: model.errors.map(buildError)
}
: {}),
...(model.metadata
? {
metadata: AuthorizationRequestMetadata.parse(model.metadata)
}
: {})
}
}

Expand Down
Loading
Loading