Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON-RPC: Group IDs different in CreateGroup result vs Receive payload #446

Open
2 tasks done
kxait opened this issue Nov 11, 2023 · 1 comment
Open
2 tasks done

Comments

@kxait
Copy link

kxait commented Nov 11, 2023

The problem

I created a group, and received in response a group ID cURwZ0ZOYmNRd...oSGVyS2JQQzgxST0=. When receiving messages from that group, the ID is different: qDpgFNbcQv0W...hHerKbPC81I=. I dug around a bit and found that the result for CreateGroup is passed through a function:

func convertInternalGroupIdToGroupId(internalId string) string {
	return groupPrefix + base64.StdEncoding.EncodeToString([]byte(internalId))
}

When I plugged that into the code for my application, it turns out that the first result is just the second encoded to base64...

It seems the fix for this would be to either return the group IDs as they come (potentially breaking functionality), or returning the encoded group ID in Api.handleSignalReceive

Are you using the latest released version?

  • Yes

Have you read the troubleshooting page?

  • Yes

What type of installation are you running?

signal-cli-rest-api Docker Container

In which mode are you using the docker container?

JSON-RPC Mode

What's the architecture of your host system?

arm64

Additional information

No response

@Joelius300
Copy link

Joelius300 commented Jan 23, 2024

Ran into this too. What is the reason for base64-encoding the already base64-encoded group-id? I understand the prefix but I do not see any advantages to double encoding. In the implementation the UTF-8 bytes of the base64-encoded group-id are again encoded in base-64 so the id also increases in length unnecessarily.
Maybe the intention was to decode it (from base64) and encode it (to base64) (?) but that would obviously do nothing.

Because of this conversion, the group-ids are no longer portable. In any Signal messaging setup, be it with signal-cli or signal-cli-rest-api, I would expect the group-ids to be the same but they are not. I can simply convert it beforehand but this might still be worth investigating.

Ps. My question/concern is not about JSON-RPC but about the concept of the group-id and internal group-id in general, I am using native mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants