Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/tests-evault-core-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Tests [evault-core + web3-adapter Integration]

on:
push:
branches: [main]
pull_request:
branches: [main]
paths:
- 'infrastructure/evault-core/**'
- 'infrastructure/web3-adapter/**'

jobs:
test-web3-adapter-integration:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Clean and rebuild native modules
run: |
# Remove any pre-built binaries that might be incompatible
find node_modules -name "sshcrypto.node" -delete 2>/dev/null || true
find node_modules -path "*/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node" -delete 2>/dev/null || true
# Rebuild ssh2 specifically for this platform
pnpm rebuild ssh2
# Rebuild all other native modules
pnpm rebuild

- name: Build web3-adapter
run: pnpm -F=web3-adapter build

- name: Run evault-core + web3-adapter integration tests
env:
CI: true
GITHUB_ACTIONS: true
DOCKER_HOST: unix:///var/run/docker.sock
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock
TESTCONTAINERS_RYUK_DISABLED: false
TESTCONTAINERS_HOST_OVERRIDE: localhost
run: pnpm -F=evault-core test:e2e:web3-adapter

2 changes: 0 additions & 2 deletions .github/workflows/tests-evault-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Tests [evault-core]
on:
push:
branches: [main]
paths:
- 'infrastructure/evault-core/**'
pull_request:
branches: [main]
paths:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/tests-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Tests [registry]
on:
push:
branches: [main]
paths:
- 'platforms/registry/**'
pull_request:
branches: [main]
paths:
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/evault-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
"build": "tsc",
"test": "vitest",
"test:e2e": "vitest src/e2e/evault-core.e2e.spec.ts --run",
"test:e2e:web3-adapter": "vitest src/e2e/evault-core.e2e.spec.ts --run",
"typeorm": "typeorm-ts-node-commonjs",
"migration:generate": "npm run typeorm migration:generate -- -d src/config/database.ts",
"migration:run": "npm run typeorm migration:run -- -d src/config/database.ts",
Expand Down
11 changes: 10 additions & 1 deletion infrastructure/evault-core/src/core/protocol/graphql-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ export class GraphQLServer {
context.eName
);

// Add parsed field to metaEnvelope for GraphQL response
const metaEnvelopeWithParsed = {
...result.metaEnvelope,
parsed: input.payload,
};

// Deliver webhooks for create operation
const requestingPlatform =
context.tokenPayload?.platform || null;
Expand Down Expand Up @@ -224,7 +230,10 @@ export class GraphQLServer {
);
}, 3_000);

return result;
return {
...result,
metaEnvelope: metaEnvelopeWithParsed,
};
}
),
updateMetaEnvelopeById: this.accessGuard.middleware(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,14 @@ export class VaultAccessGuard {
if (!args.id && !args.envelopeId) {
const result = await resolver(parent, args, context);

// If the result is an array of meta envelopes, filter based on access
// If the result is an array
if (Array.isArray(result)) {
// Check if it's an array of Envelopes (no ACL) or MetaEnvelopes (has ACL)
if (result.length > 0 && result[0] && !('acl' in result[0])) {
// It's an array of Envelopes - already filtered by eName, just return as-is
return result;
}
// It's an array of MetaEnvelopes - filter based on access
return this.filterEnvelopesByAccess(result, context);
}

Expand Down
Loading
Loading