Skip to content

Commit

Permalink
Comments couple field in JWT to match with PR in nucypher repo
Browse files Browse the repository at this point in the history
  • Loading branch information
vzotova committed Jan 3, 2025
1 parent 5c72c19 commit 91c4e3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions packages/taco/src/conditions/schemas/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ export const jwtConditionSchema = baseConditionSchema.extend({
conditionType: z.literal(JWTConditionType).default(JWTConditionType),
publicKey: z.string().optional(),
expectedIssuer: z.string().optional(),
subject: contextParamSchema.optional(),
expirationWindow: z.number().int().nonnegative().optional(),
issuedWindow: z.number().int().nonnegative().optional(),
// TODO see https://github.com/nucypher/taco-web/pull/604#discussion_r1901746814
// subject: contextParamSchema.optional(),
// expirationWindow: z.number().int().nonnegative().optional(),
// issuedWindow: z.number().int().nonnegative().optional(),
jwtToken: contextParamSchema.default(JWT_PARAM_DEFAULT),
});

Expand Down
4 changes: 2 additions & 2 deletions packages/taco/test/conditions/base/jwt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ describe('JWTCondition', () => {
it('rejects an invalid schema', () => {
const badJWTObj = {
...testJWTConditionObj,
subject: TEST_CONTRACT_ADDR,
jwtToken: TEST_CONTRACT_ADDR,
};

const result = JWTCondition.validate(jwtConditionSchema, badJWTObj);

expect(result.error).toBeDefined();
expect(result.data).toBeUndefined();
expect(result.error?.format()).toMatchObject({
subject: {
jwtToken: {
_errors: ['Invalid'],
},
});
Expand Down
6 changes: 3 additions & 3 deletions packages/taco/test/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ export const testJWTConditionObj: JWTConditionProps = {
conditionType: JWTConditionType,
publicKey: TEST_ECDSA_PUBLIC_KEY,
expectedIssuer: '0xacbd',
subject: ':userAddress',
expirationWindow: 1800,
issuedWindow: 86400,
// subject: ':userAddress',
// expirationWindow: 1800,
// issuedWindow: 86400,
jwtToken: JWT_PARAM_DEFAULT,
};

Expand Down

0 comments on commit 91c4e3a

Please sign in to comment.