/*
* Copyright 2013 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.controllers;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.mockito.ArgumentMatchers.refEq;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableSet;
import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider;
import io.dropwizard.testing.junit5.DropwizardExtensionsSupport;
import io.dropwizard.testing.junit5.ResourceExtension;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.HexFormat;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.stream.Stream;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.assertj.core.api.Condition;
import org.glassfish.jersey.server.ServerProperties;
import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.ServiceId;
import org.signal.libsignal.protocol.ecc.Curve;
import org.signal.libsignal.zkgroup.InvalidInputException;
import org.signal.libsignal.zkgroup.ServerPublicParams;
import org.signal.libsignal.zkgroup.ServerSecretParams;
import org.signal.libsignal.zkgroup.VerificationFailedException;
import org.signal.libsignal.zkgroup.profiles.ClientZkProfileOperations;
import org.signal.libsignal.zkgroup.profiles.ExpiringProfileKeyCredentialResponse;
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
import org.signal.libsignal.zkgroup.profiles.ProfileKeyCommitment;
import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredentialRequest;
import org.signal.libsignal.zkgroup.profiles.ProfileKeyCredentialRequestContext;
import org.signal.libsignal.zkgroup.profiles.ServerZkProfileOperations;
import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount;
import org.whispersystems.textsecuregcm.auth.DisabledPermittedAuthenticatedAccount;
import org.whispersystems.textsecuregcm.auth.OptionalAccess;
import org.whispersystems.textsecuregcm.configuration.BadgeConfiguration;
import org.whispersystems.textsecuregcm.configuration.BadgesConfiguration;
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicPaymentsConfiguration;
import org.whispersystems.textsecuregcm.entities.Badge;
import org.whispersystems.textsecuregcm.entities.BadgeSvg;
import org.whispersystems.textsecuregcm.entities.BaseProfileResponse;
import org.whispersystems.textsecuregcm.entities.BatchIdentityCheckRequest;
import org.whispersystems.textsecuregcm.entities.BatchIdentityCheckResponse;
import org.whispersystems.textsecuregcm.entities.CreateProfileRequest;
import org.whispersystems.textsecuregcm.entities.ExpiringProfileKeyCredentialProfileResponse;
import org.whispersystems.textsecuregcm.entities.ProfileAvatarUploadAttributes;
import org.whispersystems.textsecuregcm.entities.VersionedProfileResponse;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.IdentityType;
import org.whispersystems.textsecuregcm.identity.PniServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
import org.whispersystems.textsecuregcm.limits.RateLimiter;
import org.whispersystems.textsecuregcm.limits.RateLimiters;
import org.whispersystems.textsecuregcm.mappers.RateLimitExceededExceptionMapper;
import org.whispersystems.textsecuregcm.s3.PolicySigner;
import org.whispersystems.textsecuregcm.s3.PostPolicyGenerator;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountBadge;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager;
import org.whispersystems.textsecuregcm.storage.ProfilesManager;
import org.whispersystems.textsecuregcm.storage.VersionedProfile;
import org.whispersystems.textsecuregcm.tests.util.AccountsHelper;
import org.whispersystems.textsecuregcm.tests.util.AuthHelper;
import org.whispersystems.textsecuregcm.tests.util.ProfileHelper;
import org.whispersystems.textsecuregcm.util.SystemMapper;
import org.whispersystems.textsecuregcm.util.TestClock;
import org.whispersystems.textsecuregcm.util.Util;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest;
@ExtendWith(DropwizardExtensionsSupport.class)
class ProfileControllerTest {
private static final Clock clock = TestClock.pinned(Instant.ofEpochSecond(42));
private static final AccountsManager accountsManager = mock(AccountsManager.class);
private static final ProfilesManager profilesManager = mock(ProfilesManager.class);
private static final RateLimiters rateLimiters = mock(RateLimiters.class);
private static final RateLimiter rateLimiter = mock(RateLimiter.class);
private static final RateLimiter usernameRateLimiter = mock(RateLimiter.class);
private static final S3Client s3client = mock(S3Client.class);
private static final PostPolicyGenerator postPolicyGenerator = new PostPolicyGenerator("us-west-1", "profile-bucket",
"accessKey");
private static final PolicySigner policySigner = new PolicySigner("accessSecret", "us-west-1");
private static final ServerZkProfileOperations zkProfileOperations = mock(ServerZkProfileOperations.class);
private static final byte[] UNIDENTIFIED_ACCESS_KEY = "test-uak".getBytes(StandardCharsets.UTF_8);
private static final IdentityKey ACCOUNT_IDENTITY_KEY = new IdentityKey(Curve.generateKeyPair().getPublicKey());
private static final IdentityKey ACCOUNT_PHONE_NUMBER_IDENTITY_KEY = new IdentityKey(Curve.generateKeyPair().getPublicKey());
private static final IdentityKey ACCOUNT_TWO_IDENTITY_KEY = new IdentityKey(Curve.generateKeyPair().getPublicKey());
private static final IdentityKey ACCOUNT_TWO_PHONE_NUMBER_IDENTITY_KEY = new IdentityKey(Curve.generateKeyPair().getPublicKey());
private static final String BASE_64_URL_USERNAME_HASH = "9p6Tip7BFefFOJzv4kv4GyXEYsBVfk_WbjNejdlOvQE";
private static final byte[] USERNAME_HASH = Base64.getUrlDecoder().decode(BASE_64_URL_USERNAME_HASH);
@SuppressWarnings("unchecked")
private static final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager = mock(
DynamicConfigurationManager.class);
private DynamicPaymentsConfiguration dynamicPaymentsConfiguration;
private Account profileAccount;
没有合适的资源?快使用搜索试试~ 我知道了~
Signal-Server.zip
共871个文件
java:773个
json:24个
lua:14个
需积分: 5 0 下载量 103 浏览量
2023-08-18
17:04:27
上传
评论
收藏 1.27MB ZIP 举报
温馨提示
消息传递环境中的加密集成了许多想法,这些想法通常需要在不同的应用程序中单独组合。我们努力将想法分解为独立的规范,以便它们可以适当地集成到不同的项目中。
资源推荐
资源详情
资源评论
收起资源包目录
Signal-Server.zip (871个子文件)
io.dropwizard.logging.AppenderFactory 74B
mvnw.cmd 7KB
.editorconfig 70KB
io.dropwizard.logging.filter.FilterFactory 77B
.gitignore 779B
.gitignore 36B
.gitmodules 306B
TokenizePayPalOneTimePayment.graphql 263B
CreatePayPalOneTimePayment.graphql 251B
ChargePayPalOneTimePayment.graphql 246B
CreatePayPalBillingAgreement.graphql 181B
TokenizePayPalBillingAgreement.graphql 179B
VaultPaymentMethod.graphql 143B
maven-wrapper.jar 57KB
ProfileControllerTest.java 69KB
MessageControllerTest.java 66KB
VerificationControllerTest.java 64KB
AccountsManagerTest.java 61KB
SubscriptionController.java 58KB
WhisperServerService.java 56KB
AccountsTest.java 51KB
AccountsManager.java 46KB
Accounts.java 46KB
KeysControllerTest.java 45KB
AccountControllerTest.java 44KB
SubscriptionControllerTest.java 41KB
RegistrationControllerTest.java 39KB
DeviceControllerTest.java 37KB
AccountControllerV2Test.java 36KB
WebSocketConnectionTest.java 35KB
WebSocketResourceProviderTest.java 35KB
MessageController.java 33KB
VerificationController.java 32KB
MessagesCacheTest.java 31KB
KeysGrpcServiceTest.java 30KB
StripeManager.java 24KB
ProfileController.java 24KB
AccountController.java 23KB
BraintreeManager.java 22KB
MessagesCache.java 22KB
ChangeNumberManagerTest.java 19KB
RemoteConfigControllerTest.java 19KB
WebSocketConnection.java 18KB
DeviceController.java 18KB
AccountTest.java 18KB
AuthEnablementRefreshRequirementProviderTest.java 18KB
ApnPushNotificationScheduler.java 17KB
ProfilesTest.java 17KB
CertificateControllerTest.java 17KB
SubscriptionManager.java 17KB
BaseAccountAuthenticatorTest.java 16KB
KeysManagerTest.java 16KB
DynamicConfigurationTest.java 16KB
WebSocketConnectionIntegrationTest.java 15KB
BraintreeGraphqlClient.java 15KB
ProfileGrpcServiceTest.java 15KB
DynamoDbExtensionSchema.java 14KB
AuthHelper.java 14KB
Account.java 14KB
KeysController.java 14KB
AssignUsernameCommand.java 14KB
ClientPresenceManager.java 14KB
ClientPresenceManagerTest.java 14KB
WhisperServerConfiguration.java 13KB
AccountsManagerUsernameIntegrationTest.java 13KB
SingleUsePreKeyStore.java 13KB
MessagesDynamoDb.java 13KB
Operations.java 13KB
AccountsManagerChangeNumberIntegrationTest.java 13KB
MessagesDynamoDbTest.java 13KB
KeysGrpcService.java 13KB
RegistrationServiceClient.java 13KB
PushNotificationManagerTest.java 12KB
CommandDependencies.java 12KB
AccountControllerV2.java 12KB
AuthenticatedConnectListener.java 12KB
MetricsRequestEventListenerTest.java 12KB
SubscriptionManagerTest.java 12KB
AttachmentControllerTest.java 11KB
CurrencyConversionManagerTest.java 11KB
ExternalServiceCredentialsGenerator.java 11KB
MessagePersisterTest.java 11KB
RegistrationController.java 11KB
ApnPushNotificationSchedulerTest.java 11KB
WebSocketResourceProvider.java 11KB
APNSenderTest.java 10KB
KeysAnonymousGrpcServiceTest.java 10KB
ProfilesManagerTest.java 10KB
SecureValueRecoveryControllerBaseTest.java 10KB
Profiles.java 10KB
LoggingUnhandledExceptionMapperTest.java 10KB
DestinationDeviceValidatorTest.java 10KB
ClusterLuaScriptTest.java 10KB
ConfiguredProfileBadgeConverterTest.java 9KB
AccountsManagerConcurrentModificationIntegrationTest.java 9KB
RepeatedUseSignedPreKeyStore.java 9KB
RegistrationRequest.java 9KB
RegistrationLockVerificationManagerTest.java 9KB
ChallengeControllerTest.java 9KB
RegistrationLockVerificationManager.java 9KB
共 871 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
hello_中年人
- 粉丝: 7
- 资源: 324
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功