Skip to content
Snippets Groups Projects
Commit f2a3b8db authored by Jon Chambers's avatar Jon Chambers Committed by Jon Chambers
Browse files

Treat APNs team/key IDs as secrets so they can change atomically with the key itself

parent 207ae612
Branches
Tags
No related merge requests found
...@@ -46,6 +46,8 @@ gcpAttachments.rsaSigningKey: | ...@@ -46,6 +46,8 @@ gcpAttachments.rsaSigningKey: |
AAAAAAAA AAAAAAAA
-----END PRIVATE KEY----- -----END PRIVATE KEY-----
apn.teamId: team-id
apn.keyId: key-id
apn.signingKey: | apn.signingKey: |
-----BEGIN PRIVATE KEY----- -----BEGIN PRIVATE KEY-----
ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyz
......
...@@ -208,8 +208,8 @@ accountDatabaseCrawler: ...@@ -208,8 +208,8 @@ accountDatabaseCrawler:
apn: # Apple Push Notifications configuration apn: # Apple Push Notifications configuration
sandbox: true sandbox: true
bundleId: com.example.textsecuregcm bundleId: com.example.textsecuregcm
keyId: unset keyId: secret://apn.keyId
teamId: unset teamId: secret://apn.teamId
signingKey: secret://apn.signingKey signingKey: secret://apn.signingKey
fcm: # FCM configuration fcm: # FCM configuration
......
...@@ -9,8 +9,8 @@ import javax.validation.constraints.NotNull; ...@@ -9,8 +9,8 @@ import javax.validation.constraints.NotNull;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretString; import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
public record ApnConfiguration(@NotBlank String teamId, public record ApnConfiguration(@NotNull SecretString teamId,
@NotBlank String keyId, @NotNull SecretString keyId,
@NotNull SecretString signingKey, @NotNull SecretString signingKey,
@NotBlank String bundleId, @NotBlank String bundleId,
boolean sandbox) { boolean sandbox) {
......
...@@ -64,7 +64,7 @@ public class APNSender implements Managed, PushNotificationSender { ...@@ -64,7 +64,7 @@ public class APNSender implements Managed, PushNotificationSender {
this.bundleId = configuration.bundleId(); this.bundleId = configuration.bundleId();
this.apnsClient = new ApnsClientBuilder().setSigningKey( this.apnsClient = new ApnsClientBuilder().setSigningKey(
ApnsSigningKey.loadFromInputStream(new ByteArrayInputStream(configuration.signingKey().value().getBytes()), ApnsSigningKey.loadFromInputStream(new ByteArrayInputStream(configuration.signingKey().value().getBytes()),
configuration.teamId(), configuration.keyId())) configuration.teamId().value(), configuration.keyId().value()))
.setTrustedServerCertificateChain(getClass().getResourceAsStream(APNS_CA_FILENAME)) .setTrustedServerCertificateChain(getClass().getResourceAsStream(APNS_CA_FILENAME))
.setApnsServer(configuration.sandbox() ? ApnsClientBuilder.DEVELOPMENT_APNS_HOST : ApnsClientBuilder.PRODUCTION_APNS_HOST) .setApnsServer(configuration.sandbox() ? ApnsClientBuilder.DEVELOPMENT_APNS_HOST : ApnsClientBuilder.PRODUCTION_APNS_HOST)
.build(); .build();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment