-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add revocation scenario (#211)
Signed-off-by: Allain Magyar <[email protected]>
- Loading branch information
1 parent
7297d73
commit 09baf18
Showing
20 changed files
with
754 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 7 additions & 8 deletions
15
integration-tests/e2e-tests/features/receive_anoncred_credential.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
@anoncred | ||
@credential | ||
@anoncred @credential | ||
Feature: Receive Anoncred Credential | ||
The Edge Agent should be able to receive an anonymous credential from Cloud Agent | ||
|
||
Scenario: Receive one anonymous credential | ||
Given Cloud Agent is connected to Edge Agent | ||
When Cloud Agent offers an anonymous credential | ||
Then Edge Agent should receive the credential | ||
When Edge Agent accepts the credential | ||
And Cloud Agent should see the credential was accepted | ||
Then Edge Agent wait to receive 1 issued credentials | ||
And Edge Agent process 1 issued credentials | ||
When Cloud Agent offers '1' anonymous credential | ||
Then Edge Agent should receive the credentials offer from Cloud Agent | ||
When Edge Agent accepts the credentials offer from Cloud Agent | ||
And Cloud Agent should see all credentials were accepted | ||
Then Edge Agent wait to receive issued credentials from Cloud Agent | ||
And Edge Agent process issued credentials from Cloud Agent |
27 changes: 13 additions & 14 deletions
27
integration-tests/e2e-tests/features/receive_jwt_credential.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
@jwt | ||
@credential | ||
@jwt @credential | ||
Feature: Receive JWT Credential | ||
The Edge Agent should be able to receive a verifiable credential from Cloud Agent | ||
|
||
Scenario: Receive one verifiable credential | ||
Given Cloud Agent is connected to Edge Agent | ||
When Cloud Agent offers a credential | ||
Then Edge Agent should receive the credential | ||
When Edge Agent accepts the credential | ||
And Cloud Agent should see the credential was accepted | ||
Then Edge Agent wait to receive 1 issued credentials | ||
And Edge Agent process 1 issued credentials | ||
When Cloud Agent offers '1' jwt credentials | ||
Then Edge Agent should receive the credentials offer from Cloud Agent | ||
When Edge Agent accepts the credentials offer from Cloud Agent | ||
And Cloud Agent should see all credentials were accepted | ||
Then Edge Agent wait to receive issued credentials from Cloud Agent | ||
And Edge Agent process issued credentials from Cloud Agent | ||
|
||
Scenario: Receive multiple verifiable credentials sequentially | ||
Given Cloud Agent is connected to Edge Agent | ||
When Edge Agent accepts 3 credential offer sequentially from Cloud Agent | ||
When Edge Agent accepts 3 jwt credential offer sequentially from Cloud Agent | ||
Then Cloud Agent should see all credentials were accepted | ||
And Edge Agent wait to receive 3 issued credentials | ||
And Edge Agent process 3 issued credentials | ||
And Edge Agent wait to receive issued credentials from Cloud Agent | ||
And Edge Agent process issued credentials from Cloud Agent | ||
|
||
Scenario: Receive multiple verifiable credentials at once | ||
Given Cloud Agent is connected to Edge Agent | ||
When Edge Agent accepts 3 credentials offer at once from Cloud Agent | ||
When Edge Agent accepts 3 jwt credentials offer at once from Cloud Agent | ||
Then Cloud Agent should see all credentials were accepted | ||
And Edge Agent wait to receive 3 issued credentials | ||
And Edge Agent process 3 issued credentials | ||
And Edge Agent wait to receive issued credentials from Cloud Agent | ||
And Edge Agent process issued credentials from Cloud Agent |
11 changes: 11 additions & 0 deletions
11
integration-tests/e2e-tests/features/revoke_jwt_credential.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@jwt @revocation | ||
Feature: Revoke JWT Credential | ||
Edge Agent should be notified when Cloud Agent revokes a credential | ||
|
||
Scenario: Revoke one verifiable credential | ||
Given Cloud Agent is connected to Edge Agent | ||
And Edge Agent has '1' jwt credentials issued by Cloud Agent | ||
When Cloud Agent revokes '1' credentials | ||
Then Edge Agent waits to receive the revocation notifications from Cloud Agent | ||
And Edge Agent should see the credentials were revoked by Cloud Agent | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
integration-tests/e2e-tests/src/configuration/InMemoryStore.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
integration-tests/e2e-tests/src/configuration/inmemory/factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { randomUUID } from "crypto"; | ||
import SDK from "@atala/prism-wallet-sdk"; | ||
import InMemoryStore from "./index"; | ||
|
||
|
||
export const mockPluto = (args?: { apollo: SDK.Apollo; }) => { | ||
const apollo = args?.apollo ?? new SDK.Apollo(); | ||
|
||
const store = new SDK.Store({ | ||
name: 'test' + randomUUID(), | ||
storage: InMemoryStore, | ||
password: Buffer.from("demoapp").toString("hex") | ||
}); | ||
|
||
return new SDK.Pluto(store, apollo); | ||
}; |
44 changes: 44 additions & 0 deletions
44
integration-tests/e2e-tests/src/configuration/inmemory/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { type RxStorage, RxStorageDefaultStatics, type RxStorageInstance, type RxStorageInstanceCreationParams, newRxError } from 'rxdb' | ||
import { type InMemorySettings, type InMemoryStorageInternals, type RxStorageInMemoryType } from './types' | ||
import { RxStorageIntanceInMemory } from './instance' | ||
import { InMemoryInternal } from './internal' | ||
|
||
const internalInstance = new Map<string, InMemoryInternal<any>>() | ||
|
||
function getRxStorageMemory<RxDocType>(settings: InMemorySettings = {}): RxStorageInMemoryType<RxDocType> { | ||
const inMemoryInstance: RxStorageInMemoryType<any> = { | ||
name: 'in-memory', | ||
statics: RxStorageDefaultStatics, | ||
async createStorageInstance<RxDocType>(params: RxStorageInstanceCreationParams<RxDocType, InMemorySettings>): Promise<RxStorageInstance<RxDocType, InMemoryStorageInternals<RxDocType>, InMemorySettings, any>> { | ||
if (params.schema.keyCompression) { | ||
throw newRxError('UT5', { args: { databaseName: params.databaseName, collectionName: params.collectionName } }) | ||
} | ||
const existingInstance = internalInstance.get(params.databaseName) | ||
if (!existingInstance) { | ||
internalInstance.set(params.databaseName, new InMemoryInternal<RxDocType>(0)) | ||
} else { | ||
existingInstance.refCount++ | ||
internalInstance.set(params.databaseName, existingInstance) | ||
} | ||
return new RxStorageIntanceInMemory( | ||
this, | ||
params.databaseName, | ||
params.collectionName, | ||
params.schema, | ||
internalInstance.get(params.databaseName)!, | ||
settings | ||
) | ||
} | ||
} | ||
return inMemoryInstance | ||
} | ||
|
||
/** | ||
* InMemory storage | ||
* @description Use this as storage in our RXDB database. For now there is no initialisation settings, so you can use it out of the box. | ||
*/ | ||
const storage: RxStorage<any, any> = getRxStorageMemory() | ||
|
||
export default storage | ||
|
||
|
Oops, something went wrong.