diff --git a/examples/taco/nodejs/src/index.ts b/examples/taco/nodejs/src/index.ts index ef4550ab..4309cb0b 100644 --- a/examples/taco/nodejs/src/index.ts +++ b/examples/taco/nodejs/src/index.ts @@ -13,10 +13,11 @@ import { } from '@nucypher/taco'; import { EIP4361AuthProvider, + SelfDelegateProvider, USER_ADDRESS_PARAM_DEFAULT, } from '@nucypher/taco-auth'; import * as dotenv from 'dotenv'; -import { ethers } from 'ethers'; +import { Wallet, ethers } from 'ethers'; dotenv.config(); @@ -73,13 +74,17 @@ const encryptToBytes = async (messageString: string) => { 'Condition requires authentication', ); + const selfDelegateProvider = new SelfDelegateProvider(encryptorSigner); + const ephemeralPrivateKey = Wallet.createRandom().privateKey; + const [appSideSigner, authSignature] = await selfDelegateProvider.createSelfDelegatedAppSideSigner(ephemeralPrivateKey); + const messageKit = await encrypt( provider, domain, message, hasPositiveBalance, ritualId, - encryptorSigner, + appSideSigner, ); return messageKit.toBytes();