diff --git a/backend/canisters/local_user_index/CHANGELOG.md b/backend/canisters/local_user_index/CHANGELOG.md index 8b331350ca..d86f0c9a57 100644 --- a/backend/canisters/local_user_index/CHANGELOG.md +++ b/backend/canisters/local_user_index/CHANGELOG.md @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Change bot cmd number param values from u16 to f64 ([#7095](https://github.com/open-chat-labs/open-chat/pull/7095)) - Rename access token `parameters` to `command_args` ([#7104](https://github.com/open-chat-labs/open-chat/pull/7104)) +### Fixes + +- Fix unit of claims expiry ([#7106](https://github.com/open-chat-labs/open-chat/pull/7106)) + ## [[2.0.1530](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1530-local_user_index)] - 2024-12-19 ### Added diff --git a/backend/canisters/local_user_index/impl/src/updates/execute_bot_command.rs b/backend/canisters/local_user_index/impl/src/updates/execute_bot_command.rs index 739601b984..871f5fb063 100644 --- a/backend/canisters/local_user_index/impl/src/updates/execute_bot_command.rs +++ b/backend/canisters/local_user_index/impl/src/updates/execute_bot_command.rs @@ -9,7 +9,7 @@ use types::User; use crate::read_state; use crate::RuntimeState; -#[update(candid = true, msgpack = true)] +#[update(candid = true)] async fn execute_bot_command(args: Args) -> Response { let c2c_args = match read_state(|state| validate(args, state)) { Ok(c2c_args) => c2c_args, diff --git a/backend/integration_tests/src/client/local_user_index.rs b/backend/integration_tests/src/client/local_user_index.rs index 2a1c5e1f2d..f92d47872c 100644 --- a/backend/integration_tests/src/client/local_user_index.rs +++ b/backend/integration_tests/src/client/local_user_index.rs @@ -1,4 +1,4 @@ -use crate::{generate_msgpack_query_call, generate_msgpack_update_call}; +use crate::{generate_msgpack_query_call, generate_msgpack_update_call, generate_update_call}; use local_user_index_canister::*; // Queries @@ -7,7 +7,7 @@ generate_msgpack_query_call!(chat_events); generate_msgpack_query_call!(group_and_community_summary_updates); // Updates -generate_msgpack_update_call!(execute_bot_command); +generate_update_call!(execute_bot_command); generate_msgpack_update_call!(invite_users_to_channel); generate_msgpack_update_call!(invite_users_to_community); generate_msgpack_update_call!(invite_users_to_group); diff --git a/backend/integration_tests/src/diamond_membership_tests.rs b/backend/integration_tests/src/diamond_membership_tests.rs index 0dff32406d..dd9c633803 100644 --- a/backend/integration_tests/src/diamond_membership_tests.rs +++ b/backend/integration_tests/src/diamond_membership_tests.rs @@ -60,7 +60,7 @@ fn can_upgrade_to_diamond(pay_in_chat: bool, lifetime: bool) { let public_key = client::user_index::happy_path::public_key(env, canister_ids.user_index); let claims: Claims = verify_jwt(&diamond_response.proof_jwt, &public_key).unwrap(); - let claims_expiry = claims.exp() * 1000; + let claims_expiry = claims.exp(); assert!(now < claims_expiry && claims_expiry < now + DAY_IN_MS); assert_eq!(claims.claim_type(), "diamond_membership"); assert_eq!(claims.custom().expires_at, diamond_response.expires_at); diff --git a/backend/libraries/jwt/src/lib.rs b/backend/libraries/jwt/src/lib.rs index b565d45f6d..90665597b3 100644 --- a/backend/libraries/jwt/src/lib.rs +++ b/backend/libraries/jwt/src/lib.rs @@ -26,8 +26,8 @@ impl Claims { } } - pub fn exp(&self) -> u64 { - self.exp + pub fn exp(&self) -> TimestampMillis { + self.exp * 1000 } pub fn claim_type(&self) -> &str {