Skip to content

Commit

Permalink
Update nodejs example used for CI job to pass ConditionContext instea…
Browse files Browse the repository at this point in the history
…d of directly passing auth provider.

Expose USER_ADDRESS_PARAM* constants from taco for now.
  • Loading branch information
derekpierre committed Jul 19, 2024
1 parent a5ffe6a commit 99a6c9e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion examples/taco/nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
decrypt,
domains,
EIP4361AuthProvider,
USER_ADDRESS_PARAM_DEFAULT,
encrypt,
fromBytes,
getPorterUri,
Expand Down Expand Up @@ -94,11 +95,14 @@ const decryptFromBytes = async (encryptedBytes: Uint8Array) => {
consumerSigner,
siweParams,
);
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
2 changes: 1 addition & 1 deletion packages/taco-auth/test/auth-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
import { SiweMessage } from 'siwe';
import { describe, expect, it } from 'vitest';

import { EIP4361TypedDataSchema } from '../src/providers/eip4361/common';
import { EIP4361AuthProvider } from '../src/providers';
import { EIP4361TypedDataSchema } from '../src/providers/eip4361/common';

describe('auth provider', () => {
const provider = fakeProvider(bobSecretKeyBytes);
Expand Down
2 changes: 1 addition & 1 deletion packages/taco/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export * as conditions from './conditions';
export { decrypt, encrypt, encryptWithPublicKey, isAuthorized } from './taco';

// TODO: Remove this re-export once `@nucypher/taco-auth` is mature and published
export { EIP4361AuthProvider } from '@nucypher/taco-auth';
export { EIP4361AuthProvider, USER_ADDRESS_PARAM_DEFAULT, USER_ADDRESS_PARAM_EXTERNAL_EIP4361 } from '@nucypher/taco-auth';

0 comments on commit 99a6c9e

Please sign in to comment.