All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.signal.session.SessionChain Maven / Gradle / Ivy

package it.auties.whatsapp.model.signal.session;


import it.auties.protobuf.annotation.ProtobufMessage;
import it.auties.protobuf.annotation.ProtobufProperty;
import it.auties.protobuf.model.ProtobufType;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

@ProtobufMessage
public record SessionChain(
        @ProtobufProperty(index = 1, type = ProtobufType.INT32)
        AtomicInteger counter,
        @ProtobufProperty(index = 2, type = ProtobufType.BYTES)
        AtomicReference key,
        @ProtobufProperty(index = 3, type = ProtobufType.MAP, mapKeyType = ProtobufType.INT32, mapValueType = ProtobufType.BYTES)
        ConcurrentHashMap messageKeys
) {
    public SessionChain(int counter, byte[] key) {
        this(new AtomicInteger(counter), new AtomicReference<>(key), new ConcurrentHashMap<>());
    }

    public boolean hasMessageKey(int counter) {
        return messageKeys.containsKey(counter);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy