@calimero-network/mero-js 15.3.2 → 15.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2770,7 +2770,7 @@ async function signWarrant(input) {
2770
2770
  var CERT_DOMAIN = new TextEncoder().encode("calimero.device.cert.v1");
2771
2771
  var ACCOUNT_ID_DOMAIN = new TextEncoder().encode("calimero.account.genesis.v1");
2772
2772
  var DEVICE_ID_DOMAIN = new TextEncoder().encode("calimero.device.id.v1");
2773
- var ACCOUNT_GENESIS_VERSION = 1;
2773
+ var ACCOUNT_GENESIS_VERSION = 2;
2774
2774
  async function mintDeviceId(account, nonce) {
2775
2775
  if (nonce.length !== 16) {
2776
2776
  throw new Error(`nonce must be 16 bytes, got ${nonce.length}`);
@@ -2920,8 +2920,16 @@ function encodeSignedInvitation(signed) {
2920
2920
  async function signMemberJoinOp(input) {
2921
2921
  const parents = input.parentOpHashes ?? [];
2922
2922
  const credential = fromHex(input.credential, "credential", input.credential.length / 2);
2923
- const rootOp = concat(
2924
- new Uint8Array([input.at ? ROOT_OP.MemberJoinedAt : ROOT_OP.MemberJoined]),
2923
+ const expires = BigInt(input.invitation.invitation.expiration_timestamp ?? 0) !== 0n;
2924
+ const joinedAt = input.joinedAt ?? BigInt(Math.floor(Date.now() / 1e3));
2925
+ const rootOp = expires ? concat(
2926
+ new Uint8Array([ROOT_OP.MemberJoinedAt]),
2927
+ fromHex(input.member, "member", 32),
2928
+ encodeSignedInvitation(input.invitation),
2929
+ u64le(joinedAt),
2930
+ credential
2931
+ ) : concat(
2932
+ new Uint8Array([ROOT_OP.MemberJoined]),
2925
2933
  fromHex(input.member, "member", 32),
2926
2934
  encodeSignedInvitation(input.invitation),
2927
2935
  credential