Skip to content

Commit

Permalink
Fix other taco examples to use ConditionContext instead of directly p…
Browse files Browse the repository at this point in the history
…roviding authProvider.
  • Loading branch information
derekpierre committed Jul 19, 2024
1 parent bcb527d commit fdc5c96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/taco/nextjs/src/hooks/useTaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getPorterUri,
initialize,
ThresholdMessageKit,
USER_ADDRESS_PARAM_DEFAULT,
} from '@nucypher/taco';
import { ethers } from 'ethers';
import { useCallback, useEffect, useState } from 'react';
Expand All @@ -33,11 +34,13 @@ export default function useTaco({
}
const messageKit = ThresholdMessageKit.fromBytes(encryptedBytes);
const authProvider = new EIP4361AuthProvider(provider, signer);
const conditionContext = conditions.context.ConditionContext.fromMessageKit(messageKit);
conditionContext.addAuthProvider(USER_ADDRESS_PARAM_DEFAULT, authProvider);
return decrypt(
provider,
domain,
messageKit,
authProvider,
conditionContext,
getPorterUri(domain),
);
},
Expand Down
5 changes: 4 additions & 1 deletion examples/taco/react/src/hooks/useTaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getPorterUri,
initialize,
ThresholdMessageKit,
USER_ADDRESS_PARAM_DEFAULT,
} from '@nucypher/taco';
import { ethers } from 'ethers';
import { useCallback, useEffect, useState } from 'react';
Expand All @@ -33,11 +34,13 @@ export default function useTaco({
}
const messageKit = ThresholdMessageKit.fromBytes(encryptedBytes);
const authProvider = new EIP4361AuthProvider(provider, signer);
const conditionContext = conditions.context.ConditionContext.fromMessageKit(messageKit);
conditionContext.addAuthProvider(USER_ADDRESS_PARAM_DEFAULT, authProvider);
return decrypt(
provider,
domain,
messageKit,
authProvider,
conditionContext,
getPorterUri(domain),
);
},
Expand Down

0 comments on commit fdc5c96

Please sign in to comment.