identity_core 1.5.1

The core traits and types for the identity-rs library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use identity_core::common::Timestamp;
use identity_core::register_custom_now_utc;

const STATIC_TIME: i64 = 1724402964; // 2024-08-23T11:33:30+00:00
pub fn static_now_utc() -> Timestamp {
  Timestamp::from_unix(STATIC_TIME).unwrap()
}

register_custom_now_utc!(static_now_utc);

#[test]
fn should_use_registered_static_time() {
  let timestamp = Timestamp::now_utc();
  assert_eq!(timestamp.to_unix(), STATIC_TIME)
}