Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions integration-tests/delegation-offer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ describe('Credential Distribution', () => {
expect(updatedOffer.type).toContain('DelegationOffer');
expect(updatedOffer.status).toBe('accepted');
expect(updatedOffer.holderDID).toBe(holderWallet.did);
expect(updatedOffer.revocationData.credentialId).toBeDefined();
expect(updatedOffer.revocationData.credentialStatus).toBeDefined();

// Step 4: Holder receive the delegatable credential from the issuer
const delegationIssuanceMessage =
Expand Down
7 changes: 7 additions & 0 deletions integration-tests/helpers/wallet-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ type FullWalletClient = {
messageProvider: IMessageProvider;
}

const SPONSOR_KEY = process.env.TRUVERA_API_SPONSOR_KEY;
const API_URL = process.env.DELEGATION_REVOCATION_API_URL;

export async function createFullWalletClient(): Promise<FullWalletClient> {
const dataStore = await createDataStore({
databasePath: ':memory:',
dbType: 'sqlite',
defaultNetwork: 'testnet',
truveraApi: {
authKey: SPONSOR_KEY,
apiUrl: API_URL,
}
});
const wallet = await createWallet({
dataStore,
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/delegation/delegation-offer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ export const DELEGATION_REQUEST_HANDLER = {
},
});

// Persist revocation data on the delegation offer so the issuer can update it when revoking.
delegationOffer.revocationData = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you add tests to validate this is being stored? If so, I'd expect them to fail after this refactor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have revocation tests which is calling the revocation helpers directly and has access to the full credential. I just updated the test to ensure we assert the revocation data is there.

credentialStatus: delegatedCredential.credentialStatus,
credentialId: delegatedCredential.id,
};

await wallet.updateDocument(delegationOffer);
Comment thread
mike-parkhill marked this conversation as resolved.

const delegationChain = await getDelegationChain(parentCredential, wallet);

await messageProvider.sendMessage({
Expand Down
1 change: 1 addition & 0 deletions packages/data-store/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function createDataStore({
const dataStore: DataStore = {
events: new EventEmitter(),
db: dataSource,
configs: configs,
networkId: options.defaultNetwork,
network: options.networks.find(item => item.id === options.defaultNetwork),
testNetworkId: options.testNetworkId,
Expand Down
1 change: 1 addition & 0 deletions packages/data-store/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type DataStore = {
setNetwork: (networkId: string) => Promise<void>;
documents: DocumentStore;
wallet: WalletStore;
configs: DataStoreConfigs;
};

export type ContextProps = {
Expand Down
Loading