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

Unresolved identifier Session #8

Open
RyPoints opened this issue May 27, 2018 · 10 comments
Open

Unresolved identifier Session #8

RyPoints opened this issue May 27, 2018 · 10 comments

Comments

@RyPoints
Copy link

RyPoints commented May 27, 2018

In your sample code you have:

let session = Session(for: aliceAddress)

However, when I use that code, Xcode gives an error:

Use of unresolved identifier 'Session.' What should it be?

@RyPoints
Copy link
Author

This is for the 1.0.1 build. I was completing the implementation of that before I upgraded.

@RyPoints
Copy link
Author

RyPoints commented May 28, 2018

Since Session didn't seem to exist, I also attempted to hack around the issue with:

        let aliceAddress = SignalAddress(identifier: email, deviceId: deviceId!)
        let bobStore = MyKeyStore()
        let session = SessionCipher(store: bobStore, remoteAddress: aliceAddress)
        let encryptedData = Data(base64Encoded: encryptedMessage)
        do {
            let cipherTextMessage = try CipherTextMessage(from: encryptedData!)
            let decryptedMessage = try session.decrypt(cipherTextMessage)
            print("decryptedMessage: ", decryptedMessage)
        } catch {print("error:", error)}

Note that I'm sending a message to myself in this scenario. Email is my email and deviceId is my deviceId.

I'm seeing throw SignalError(.untrustedIdentity, "Untrusted identity for (remoteAddress)")

@RyPoints
Copy link
Author

Reviewed and updated the above code, since I was double-adding the first byte of the CypherTextMessage in the previous version. It's already included in the base64encoded string that was uploaded to the server, downloaded from the server and is being processed in the above segment of code.

@RyPoints
Copy link
Author

Even doing:

       let encryptedMessage = try! session.encrypt(message!)
       print("encryptedMessage tapSend: ", encryptedMessage)
       let decryptedMessage = try! session.decrypt(encryptedMessage)
       print("decryptedMessage tapSend: ", decryptedMessage)

Results in throw SignalError(.untrustedIdentity, "Untrusted identity for (remoteAddress)")

@RyPoints
Copy link
Author

RyPoints commented May 28, 2018

Should I be manually writing to the keystores at any point? Like:

try! aliceStore.identityKeyStore.store(identity: identity, for: bobAddress)
try! aliceStore.preKeyStore.store(preKey: prekey!, for: deviceId)
try! aliceStore.signedPreKeyStore.store(signedPreKey: signedprekey!, for: deviceId)

I'm not doing anything like that, because it didn't mention it in the README.md. I feel like since Session doesn't exist as referenced in the Creating a session from a received PreKeySignalMessage section, there's likely some obvious answer. Maybe the README.md just needs to be updated due to code changes?

@RyPoints
Copy link
Author

This library looks great though. 🥇 Really looking forward to getting it implemented and would be thankful for any help you can provide in clarifying the implementation details.

@radvansky-tomas
Copy link

Still no response?! docs are pretty wrong than

@christophhagen
Copy link
Owner

Sorry for the delayed response. The README is incorrect, Session(for: aliceAddress) should be SessionCipher(store: aliceStore, remoteAddress: aliceAddress)

The docs where not up to date with code, sorry for that.

@tunctugcu
Copy link

SessionCipher(for: aliceAddress, store: aliceStore) is the correct one now but the session address name is not plain. I don't know why but when session is created by library, it appends some dummy chars to the end of the name.

@jainpalak95
Copy link

jainpalak95 commented Jun 29, 2020

I am getting an issue in decryption. getting error like untrusted Identity. is anyone has solution please help.

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

5 participants