Commit Graph

26 Commits

Author SHA1 Message Date
Max Radermacher
59593c3c97
Add ServiceId & E164 types
* Use the new E164 type in a few places
* Use the new ServiceId type in a few places
2023-02-21 23:13:46 -08:00
Sasha Weiss
bcfd291f9c
Add support for username hashing 2023-02-08 16:02:02 -08:00
Harry
9a511cdda0
Add deprecated prefix to all existing onboarding/registration types
* Add deprecated prefix to all existing onboarding/registration types. (Will be forked to new versions later, potentially untouched)

* Mark old requests deprecated
2023-02-03 15:02:04 -08:00
Evan Hahn
cc92abdc90
Clean up "delete subscriber ID" request
This is similar to 227f05e932.

This change should have no user impact.

This changes the "delete subscriber ID" request in the following ways:

- Adds tests
- Converts it to Swift
- Renames `deleteSubscriptionIDRequest` to `deleteSubscriberID`
- Serializes the data inside the method, rather than requiring callers
  to do so
2023-01-27 15:11:48 -08:00
Evan Hahn
227f05e932 Clean up "set subscriber ID" request
This change should have no user impact.

This changes the "set subscriber ID" request in the following ways:

- Adds tests
- Converts it to Swift
- Renames `setSubscriptionIDRequest` to `setSubscriberID`
- Serializes the data inside the method, rather than requiring callers
  to do so

Tested this with automated tests and manually starting a subscription in
staging.
2023-01-26 13:45:25 -06:00
Sasha Weiss
1126c98f19
"Select a username" UX 2023-01-26 11:38:21 -08:00
Evan Hahn
abd130a4c2
Clean up preauth challenge request
This change should have no user impact. It makes a few cleanups to
`OWSRequestFactory.requestPreauthChallengeRequest`:

- Adds tests
- Converts it to Swift
- Renames it to `requestPreauthChallenge`
- URL-encodes the parameters. This required some additional scaffolding;
  see `URLPathComponents`.
2023-01-25 14:22:22 -06:00
Evan Hahn
8d707a9c74
Add spam reporting tokens 2023-01-25 14:14:57 -06:00
Evan Hahn
35c314bde5
Clean up donation configuration request
This change should have no user impact.

This changes a few things about
`OWSRequestFactory.donationConfigurationRequest()`:

- Adds tests
- Converts it to Swift
- Renames it to `donationConfiguration()`
- Makes it an unauthenticated request

I'm most concerned about that last thing, because it's a behavior
change. However, I think this is safe because:

1. I tested it in a simulator and it works

2. [Android appears to do the same thing][0]

3. A normal `curl` works just fine:

   ```
   curl --insecure 'https://chat.signal.org/v1/subscription/configuration'
   ```

[0]: 657c5d2bce/libsignal/service/src/main/java/org/whispersystems/signalservice/internal/push/PushServiceSocket.java (L1074)
2023-01-25 13:10:22 -06:00
Evan Hahn
9563ea810c
Clean up device provisioning request
This change should have no user impact. It makes a few changes to
`OWSRequestFactory.deviceProvisioningRequestWithMessageBody`:

- Adds tests
- Converts it to Swift
- Renames it to `provisionDevice`
- URL-encodes one of the parameters

(I was thankful for `OWSDeviceProvisionerTest` when I made this change,
as it increased my confidence that this was safe.)
2023-01-24 09:42:52 -08:00
Evan Hahn
62215b97c3
Clean up "report spam" request code
This change should have no user impact.

This makes the following changes to `OWSRequestFactory.reportSpam`:

- Converts it to Swift
- Adds tests
- Handles a server GUID that couldn't be URL-encoded. For example, if it
  contained spaces, we'd crash constructing the URL. No longer!
- Handles an empty server GUID
2023-01-20 14:15:33 -06:00
Evan Hahn
76fb4a8b02 Swiftify OWSRequestFactory.enable2FARequest
This change should have no user impact.
2023-01-20 11:47:51 -06:00
Max Radermacher
fd3457b9a5 Update sending flow to use UUIDs 2023-01-09 12:00:51 -08:00
Sasha Weiss
ee4799b506 One-time donations via PayPal 2022-12-01 14:39:03 -08:00
Sasha Weiss
40e765fa4f Integrate the /v1/subscription/configuration API 2022-12-01 14:39:03 -08:00
Evan Hahn
4675434c6c Add FiatMoney type
This change should have no user impact.

We commonly pair a currency, like USD, and an amount, like 1.23. This
adds the `FiatMoney` struct. It's a simple struct with two fields.

After adding it, I tried to use it everywhere. (It's possible I missed a
spot.)

I think this is a useful change on its own, but it'll be nice for an
upcoming change, too.

See also: [Android's equivalent class][0].

[0]: cb65347bb3/core-util/src/main/java/org/signal/core/util/money/FiatMoney.java (L1)
2022-10-26 17:04:51 -05:00
Evan Hahn
370ff654e7
Change license to AGPL
Change license to AGPL

This commit:

- Updates the `LICENSE` file

- Start every file with something like:

      // Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
      // SPDX-License-Identifier: AGPL-3.0-only

---

First, I removed existing license headers with this Ruby 3.1.2 script:

    require 'set'

    EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']

    same = 0
    different = 0

    all_files = `git ls-files`.lines.map { |line| line.strip }
    all_files.each do |relative_path|
      if relative_path == 'Pods'
        next
      end

      unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
        next
      end

      path = File.expand_path(relative_path)

      contents = File.read(path)
      new_contents = contents.sub(/\/\/\n\/\/  Copyright .*\n\/\/\n\n/, '')

      if contents == new_contents
        same += 1
      else
        different += 1
      end

      File.write(path, new_contents)
    end

    puts "updated #{different} file(s), left #{same} untouched"

I'm sure this script could be improved, but it worked well enough.

Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.

Then I fixed some stragglers and updated the precommit script.

See [a similar change in the Desktop app][0].

[0]: 8bfaf598af
2022-10-13 08:25:37 -05:00
Nora Trapp
9eb1c52dca Fix test 2022-10-05 12:29:39 -07:00
Nora Trapp
1e613fe438 Use unrestricted sealed sender for story sends 2022-10-05 12:24:13 -07:00
Evan Hahn
5a0f836f0d Use "timestamp" instead of "timeStamp"
This change should have no user impact.

We use "timestamp", all lowercase, in most of the codebase. This makes
it consistent.
2022-08-26 14:17:12 -05:00
Evan Hahn
da322d3bf9 Add "urgent" boolean to outgoing messages
To improve message reliability, we're adding an urgency flag to outgoing
messages. For example, outgoing calls are urgent, but delivery receipts
are not. [Android][] and [Desktop][] have already done this work.

At a high level, I added an `isUrgent` property to `TSOutgoingMessage`s.
It defaults to `true`. Some subclasses, like
`OWSReceiptsForSenderMessage`, override it to return `false`.

Builds off of a few other commits (not necessary to understand this
commit, but might be useful for posterity):

- e858a0d916
- 8c6d2ebe8c
- 402b117221
- 2ba0cd764d
- 266a4663e9
- 8e5009bbf7

[Android]: dc04c8ed98
[Desktop]: 06190b1434
2022-08-18 07:35:41 -05:00
Evan Hahn
8c6d2ebe8c Test OWSRequestFactory.submitMessageRequest 2022-08-16 14:12:35 -05:00
Evan Hahn
402b117221 Test OWSRequestFactory.submitMultiRecipientMessageRequest 2022-08-16 14:12:35 -05:00
Evan Hahn
f4714b1a83 Basic support for sending gift badges
If you've got the `giftBadgeSending` flag enabled, you can now send gift
badges to anyone who has the capability.

This commit doesn't complete the feature, though. It is missing:

- Proper durability and error handling (to be addressed separately)
- Saving of receipts
- A few other cleanups
2022-06-22 15:50:51 +00:00
Evan Hahn
a1eb9e3042 Clean up boostCreatePaymentIntent()
This makes a few small changes to `OWSRequestFactory.boostCreatePaymentIntent()`:

- Adds tests
- Rewrites the function in Swift

I made sure I could do a boost (in staging) in the simulator.
2022-06-21 17:33:28 +00:00
Evan Hahn
baddc85564 Add first gift badge screen
This adds the first screen for badge gifting. It lets you see the gift
badge, pick the currency, and advance to the next screen.

It also adds a skeleton for the next screen, so there's somewhere to
advance to, but that screen is unfinished.

All of this is behind disabled flags, so this should have no user
impact.
2022-05-19 14:07:23 +00:00