Change stickerId to hex everywhere

Remove packKey from output
This commit is contained in:
AsamK 2022-01-03 17:51:04 +01:00
parent e70463d7b8
commit beb3adcc72
12 changed files with 23 additions and 20 deletions

View file

@ -30,6 +30,7 @@ import org.asamk.signal.manager.api.SendGroupMessageResults;
import org.asamk.signal.manager.api.SendMessageResult;
import org.asamk.signal.manager.api.SendMessageResults;
import org.asamk.signal.manager.api.StickerPack;
import org.asamk.signal.manager.api.StickerPackId;
import org.asamk.signal.manager.api.TypingAction;
import org.asamk.signal.manager.api.UnregisteredRecipientException;
import org.asamk.signal.manager.api.UpdateGroup;
@ -49,7 +50,6 @@ import org.asamk.signal.manager.storage.recipients.Profile;
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.asamk.signal.manager.storage.recipients.RecipientId;
import org.asamk.signal.manager.storage.stickers.Sticker;
import org.asamk.signal.manager.storage.stickers.StickerPackId;
import org.asamk.signal.manager.util.AttachmentUtils;
import org.asamk.signal.manager.util.KeyUtils;
import org.asamk.signal.manager.util.StickerUtils;

View file

@ -2,7 +2,7 @@ package org.asamk.signal.manager;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.asamk.signal.manager.storage.stickers.StickerPackId;
import org.asamk.signal.manager.api.StickerPackId;
import org.asamk.signal.manager.util.IOUtils;
import org.asamk.signal.manager.util.Utils;
import org.whispersystems.signalservice.api.util.StreamDetails;

View file

@ -322,10 +322,12 @@ public record MessageEnvelope(
}
}
public record Sticker(byte[] packId, byte[] packKey, int stickerId) {
public record Sticker(StickerPackId packId, byte[] packKey, int stickerId) {
static Sticker from(SignalServiceDataMessage.Sticker sticker) {
return new Sticker(sticker.getPackId(), sticker.getPackKey(), sticker.getStickerId());
return new Sticker(StickerPackId.deserialize(sticker.getPackId()),
sticker.getPackKey(),
sticker.getStickerId());
}
}

View file

@ -1,7 +1,5 @@
package org.asamk.signal.manager.api;
import org.asamk.signal.manager.storage.stickers.StickerPackId;
import java.util.List;
import java.util.Optional;

View file

@ -1,4 +1,4 @@
package org.asamk.signal.manager.storage.stickers;
package org.asamk.signal.manager.api;
import java.util.Arrays;

View file

@ -20,6 +20,7 @@ import org.asamk.signal.manager.actions.SendSyncGroupsAction;
import org.asamk.signal.manager.actions.SendSyncKeysAction;
import org.asamk.signal.manager.api.MessageEnvelope;
import org.asamk.signal.manager.api.Pair;
import org.asamk.signal.manager.api.StickerPackId;
import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.groups.GroupNotFoundException;
import org.asamk.signal.manager.groups.GroupUtils;
@ -29,7 +30,6 @@ import org.asamk.signal.manager.storage.groups.GroupInfoV1;
import org.asamk.signal.manager.storage.recipients.Profile;
import org.asamk.signal.manager.storage.recipients.RecipientId;
import org.asamk.signal.manager.storage.stickers.Sticker;
import org.asamk.signal.manager.storage.stickers.StickerPackId;
import org.signal.libsignal.metadata.ProtocolInvalidKeyException;
import org.signal.libsignal.metadata.ProtocolInvalidKeyIdException;
import org.signal.libsignal.metadata.ProtocolInvalidMessageException;

View file

@ -1,8 +1,8 @@
package org.asamk.signal.manager.jobs;
import org.asamk.signal.manager.JsonStickerPack;
import org.asamk.signal.manager.api.StickerPackId;
import org.asamk.signal.manager.helper.Context;
import org.asamk.signal.manager.storage.stickers.StickerPackId;
import org.asamk.signal.manager.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View file

@ -1,5 +1,7 @@
package org.asamk.signal.manager.storage.stickers;
import org.asamk.signal.manager.api.StickerPackId;
public class Sticker {
private final StickerPackId packId;

View file

@ -1,5 +1,7 @@
package org.asamk.signal.manager.storage.stickers;
import org.asamk.signal.manager.api.StickerPackId;
import java.util.Base64;
import java.util.Collection;
import java.util.HashMap;