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

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

The newest version!
package it.auties.whatsapp.model.signal.session;

import lombok.Builder;
import lombok.NonNull;
import lombok.extern.jackson.Jacksonized;

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

@Builder
@Jacksonized
public record SessionChain(AtomicInteger counter, AtomicReference key,
                           ConcurrentHashMap messageKeys) {
    public SessionChain(int counter, byte @NonNull [] 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