diff --git a/integration-tests/delegation-offer.test.ts b/integration-tests/delegation-offer.test.ts index a499fc99..7720f48e 100644 --- a/integration-tests/delegation-offer.test.ts +++ b/integration-tests/delegation-offer.test.ts @@ -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 = diff --git a/integration-tests/helpers/wallet-helpers.ts b/integration-tests/helpers/wallet-helpers.ts index f155b8d0..44c326ec 100644 --- a/integration-tests/helpers/wallet-helpers.ts +++ b/integration-tests/helpers/wallet-helpers.ts @@ -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 { const dataStore = await createDataStore({ databasePath: ':memory:', dbType: 'sqlite', defaultNetwork: 'testnet', + truveraApi: { + authKey: SPONSOR_KEY, + apiUrl: API_URL, + } }); const wallet = await createWallet({ dataStore, diff --git a/packages/core/src/delegation/delegation-offer.ts b/packages/core/src/delegation/delegation-offer.ts index 03d8c306..a42df6f0 100644 --- a/packages/core/src/delegation/delegation-offer.ts +++ b/packages/core/src/delegation/delegation-offer.ts @@ -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 = { + credentialStatus: delegatedCredential.credentialStatus, + credentialId: delegatedCredential.id, + }; + + await wallet.updateDocument(delegationOffer); + const delegationChain = await getDelegationChain(parentCredential, wallet); await messageProvider.sendMessage({ diff --git a/packages/data-store/src/index.ts b/packages/data-store/src/index.ts index dd9559be..93e1235b 100644 --- a/packages/data-store/src/index.ts +++ b/packages/data-store/src/index.ts @@ -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, diff --git a/packages/data-store/src/types.ts b/packages/data-store/src/types.ts index 6efb522f..97fb34ee 100644 --- a/packages/data-store/src/types.ts +++ b/packages/data-store/src/types.ts @@ -57,6 +57,7 @@ export type DataStore = { setNetwork: (networkId: string) => Promise; documents: DocumentStore; wallet: WalletStore; + configs: DataStoreConfigs; }; export type ContextProps = {