@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.mjs CHANGED
@@ -2693,7 +2693,7 @@ async function signWarrant(input) {
2693
2693
  var CERT_DOMAIN = new TextEncoder().encode("calimero.device.cert.v1");
2694
2694
  var ACCOUNT_ID_DOMAIN = new TextEncoder().encode("calimero.account.genesis.v1");
2695
2695
  var DEVICE_ID_DOMAIN = new TextEncoder().encode("calimero.device.id.v1");
2696
- var ACCOUNT_GENESIS_VERSION = 1;
2696
+ var ACCOUNT_GENESIS_VERSION = 2;
2697
2697
  async function mintDeviceId(account, nonce) {
2698
2698
  if (nonce.length !== 16) {
2699
2699
  throw new Error(`nonce must be 16 bytes, got ${nonce.length}`);
@@ -2843,8 +2843,16 @@ function encodeSignedInvitation(signed) {
2843
2843
  async function signMemberJoinOp(input) {
2844
2844
  const parents = input.parentOpHashes ?? [];
2845
2845
  const credential = fromHex(input.credential, "credential", input.credential.length / 2);
2846
- const rootOp = concat(
2847
- new Uint8Array([input.at ? ROOT_OP.MemberJoinedAt : ROOT_OP.MemberJoined]),
2846
+ const expires = BigInt(input.invitation.invitation.expiration_timestamp ?? 0) !== 0n;
2847
+ const joinedAt = input.joinedAt ?? BigInt(Math.floor(Date.now() / 1e3));
2848
+ const rootOp = expires ? concat(
2849
+ new Uint8Array([ROOT_OP.MemberJoinedAt]),
2850
+ fromHex(input.member, "member", 32),
2851
+ encodeSignedInvitation(input.invitation),
2852
+ u64le(joinedAt),
2853
+ credential
2854
+ ) : concat(
2855
+ new Uint8Array([ROOT_OP.MemberJoined]),
2848
2856
  fromHex(input.member, "member", 32),
2849
2857
  encodeSignedInvitation(input.invitation),
2850
2858
  credential