Skip to content

Commit

Permalink
versionning v1 lol
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptroger committed Nov 5, 2024
1 parent c48adef commit 3cbce5f
Show file tree
Hide file tree
Showing 41 changed files with 1,405 additions and 416 deletions.
14 changes: 7 additions & 7 deletions apps/policy-engine/src/engine/__test__/e2e/evaluation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DataStoreConfiguration,
Decision,
EvaluationResponse,
FIXTURE,
FIXTURE_V2,
HttpSource,
SerializedEvaluationRequest,
SourceType,
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('Evaluation', () => {
)

await clientService.savePolicyStore(client.clientId, await getPolicyStore([], privateKey))
await clientService.saveEntityStore(client.clientId, await getEntityStore(FIXTURE.ENTITIES, privateKey))
await clientService.saveEntityStore(client.clientId, await getEntityStore(FIXTURE_V2.ENTITIES, privateKey))

await app.init()
})
Expand Down Expand Up @@ -231,11 +231,11 @@ describe('Evaluation', () => {
message: {
from: {
name: 'Alice',
account: FIXTURE.VIEM_ACCOUNT.Alice.address
account: FIXTURE_V2.VIEM_ACCOUNT.Alice.address
},
to: {
name: 'Bob',
account: FIXTURE.VIEM_ACCOUNT.Bob.address
account: FIXTURE_V2.VIEM_ACCOUNT.Bob.address
},
contents: "Dear Bob, today we're going to the moon"
}
Expand All @@ -247,12 +247,12 @@ describe('Evaluation', () => {
transactionRequestIntent: {
type: 'userOperation',
entrypoint: `eip155:${sepolia.id}:${ENTRYPOINT_ADDRESS_V06.toLowerCase()}`,
from: `eip155:${sepolia.id}:${FIXTURE.VIEM_ACCOUNT.Alice.address.toLowerCase()}`,
from: `eip155:${sepolia.id}:${FIXTURE_V2.VIEM_ACCOUNT.Alice.address.toLowerCase()}`,
operationIntents: [
{
amount: '1',
from: `eip155:${sepolia.id}:${FIXTURE.VIEM_ACCOUNT.Alice.address.toLowerCase()}`,
to: `eip155:${sepolia.id}:${FIXTURE.VIEM_ACCOUNT.Bob.address.toLowerCase()}`,
from: `eip155:${sepolia.id}:${FIXTURE_V2.VIEM_ACCOUNT.Alice.address.toLowerCase()}`,
to: `eip155:${sepolia.id}:${FIXTURE_V2.VIEM_ACCOUNT.Bob.address.toLowerCase()}`,
token: `eip155:${sepolia.id}/slip44:60`,
type: 'transferNative'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
EntitySignature,
EntityStore,
EntityUtil,
FIXTURE,
FIXTURE_V2,
PolicyData,
PolicySignature,
PolicyStore,
Expand Down Expand Up @@ -50,8 +50,8 @@ describe(DataStoreService.name, () => {

publicKey = getPublicKey(privateKey)

entityStore = await getEntityStore(FIXTURE.ENTITIES, privateKey)
policyStore = await getPolicyStore(FIXTURE.POLICIES, privateKey)
entityStore = await getEntityStore(FIXTURE_V2.ENTITIES, privateKey)
policyStore = await getPolicyStore(FIXTURE_V2.POLICIES, privateKey)

entityData = {
entity: {
Expand Down Expand Up @@ -232,7 +232,7 @@ describe(DataStoreService.name, () => {
})

it('throws DataStoreException when entity signature is invalid', async () => {
const entityStoreOne = await getEntityStore(FIXTURE.ENTITIES, privateKey)
const entityStoreOne = await getEntityStore(FIXTURE_V2.ENTITIES, privateKey)
const entityStoreTwo = await getEntityStore(EntityUtil.emptyV2(), privateKey)

await testThrowDataStoreException({
Expand All @@ -251,7 +251,7 @@ describe(DataStoreService.name, () => {
})

it('throws DataStoreException when policy signature is invalid', async () => {
const policyStoreOne = await getPolicyStore(FIXTURE.POLICIES, privateKey)
const policyStoreOne = await getPolicyStore(FIXTURE_V2.POLICIES, privateKey)
const policyStoreTwo = await getPolicyStore([], privateKey)

await testThrowDataStoreException({
Expand Down Expand Up @@ -291,7 +291,7 @@ describe(DataStoreService.name, () => {
})

it('returns error when signature mismatch', async () => {
const entityStoreOne = await getEntityStore(FIXTURE.ENTITIES, privateKey)
const entityStoreOne = await getEntityStore(FIXTURE_V2.ENTITIES, privateKey)
const entityStoreTwo = await getEntityStore(EntityUtil.emptyV2(), privateKey)

const verification = await service.verifySignature({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EncryptionModule } from '@narval/encryption-module'
import { LoggerModule, secret } from '@narval/nestjs-shared'
import { DataStoreConfiguration, FIXTURE, HttpSource, SourceType } from '@narval/policy-engine-shared'
import { DataStoreConfiguration, FIXTURE_V2, HttpSource, SourceType } from '@narval/policy-engine-shared'
import { Alg, getPublicKey, privateKeyToJwk } from '@narval/signature'
import { Test } from '@nestjs/testing'
import { MockProxy, mock } from 'jest-mock-extended'
Expand Down Expand Up @@ -49,11 +49,11 @@ describe(ClientService.name, () => {

const stores = {
entity: {
data: FIXTURE.ENTITIES,
data: FIXTURE_V2.ENTITIES,
signature: 'test-signature'
},
policy: {
data: FIXTURE.POLICIES,
data: FIXTURE_V2.POLICIES,
signature: 'test-signature'
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
Decision,
EvaluationResponse,
FIXTURE,
FIXTURE_V2,
GrantPermissionAction,
Request,
SignTransactionAction
Expand All @@ -23,7 +23,7 @@ const cnf = {

const baseResponse: EvaluationResponse = {
decision: Decision.PERMIT,
principal: FIXTURE.CREDENTIAL.Alice,
principal: FIXTURE_V2.CREDENTIAL.Alice,
request: {} as Request
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EntityData, FIXTURE, FileSource, SourceType } from '@narval/policy-engine-shared'
import { EntityData, FIXTURE_V2, FileSource, SourceType } from '@narval/policy-engine-shared'
import { Test } from '@nestjs/testing'
import { withTempJsonFile } from '../../../../../shared/testing/with-temp-json-file.testing'
import { DataStoreException } from '../../../../core/exception/data-store.exception'
Expand All @@ -9,7 +9,7 @@ describe(FileSystemDataStoreRepository.name, () => {

const entityData: EntityData = {
entity: {
data: FIXTURE.ENTITIES
data: FIXTURE_V2.ENTITIES
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpModule, LoggerModule } from '@narval/nestjs-shared'
import { EntityData, FIXTURE, HttpSource, SourceType } from '@narval/policy-engine-shared'
import { EntityData, FIXTURE_V2, HttpSource, SourceType } from '@narval/policy-engine-shared'
import { HttpStatus } from '@nestjs/common'
import { Test } from '@nestjs/testing'
import nock from 'nock'
Expand All @@ -18,7 +18,7 @@ describe(HttpDataStoreRepository.name, () => {

const entityData: EntityData = {
entity: {
data: FIXTURE.ENTITIES
data: FIXTURE_V2.ENTITIES
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Criterion,
DataStoreConfiguration,
EntityStore,
FIXTURE,
FIXTURE_V2,
HttpSource,
PolicyStore,
SourceType,
Expand Down Expand Up @@ -97,7 +97,7 @@ describe(ClientRepository.name, () => {

describe('saveEntityStore', () => {
const store: EntityStore = {
data: FIXTURE.ENTITIES,
data: FIXTURE_V2.ENTITIES,
signature: 'test-fake-signature'
}

Expand Down
Loading

0 comments on commit 3cbce5f

Please sign in to comment.