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

[Chat] Identity keys API #722

Merged
merged 23 commits into from
Feb 22, 2023
Merged

[Chat] Identity keys API #722

merged 23 commits into from
Feb 22, 2023

Conversation

flypaper0
Copy link
Contributor

@flypaper0 flypaper0 commented Feb 16, 2023

Description

  • JWT API
  • Sample app updated for demo
  • New Identity and Invite keys API
  • Client interface updated

Resolves # (issue)

How Has This Been Tested?

Due Dilligence

  • Breaking change
  • Requires a documentation update

@arein arein added the accepted label Feb 16, 2023
@flypaper0 flypaper0 marked this pull request as ready for review February 17, 2023 10:41
}

func registerIdentity(account: Account,
onSign: (String) -> CacaoSignature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed we should request to sign async

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated
created specs PR: WalletConnect/walletconnect-docs#510

Copy link
Contributor

@llbartekll llbartekll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The biggest PR I ever reviewed xd

}

func registerInvite(account: Account,
onSign: (String) -> CacaoSignature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need onSign here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@@ -3,19 +3,29 @@ import Foundation
class KeyedDatabase<Element> where Element: Codable & Equatable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think we could extract it from Chat to Utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, I'll do it separately in InviteKeys package PR, ok?

@@ -0,0 +1,54 @@
import Foundation

public struct ChatInviteKeyClaims: JWTEncodable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed - move to chat sdk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also in InviteKeys package PR


private extension Web3InboxViewController {

func onSing(_ message: String) -> SigningResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we eventually need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we need to sign cacao from Chat SDK register method

resources: [DIDKey]
)

let result = await onSign(try messageFormatter.formatMessage(from: cacaoPayload))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, we're going to make it async later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now its async

)
}

private func getNonce() -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel a little like it gives 0 extra security when it's generated this way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how we should do it?

var sut: SocketAuthenticator!
let expectedToken = "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6a2V5Ono2TWtvZEhad25lVlJTaHRhTGY4SktZa3hwREdwMXZHWm5wR21kQnBYOE0yZXh4SCIsInN1YiI6ImM0NzlmZTVkYzQ2NGU3NzFlNzhiMTkzZDIzOWE2NWI1OGQyNzhjYWQxYzM0YmZiMGI1NzE2ZTViYjUxNDkyOGUifQ.0JkxOM-FV21U7Hk-xycargj_qNRaYV2H5HYtE4GzAeVQYiKWj7YySY5AdSqtCgGzX4Gt98XWXn2kSr9rE1qvCA"

override func setUp() {
clientIdStorage = ClientIdStorageMock()
DIDKeyFactory = ED25519DIDKeyFactoryMock()
DIDKeyFactory.did = "did:key:z6MkodHZwneVRShtaLf8JKYkxpDGp1vGZnpGmdBpX8M2exxH"
// DIDKeyFactory = ED25519DIDKeyFactoryMock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this commented code?

@flypaper0 flypaper0 merged commit c69aca1 into develop Feb 22, 2023
@flypaper0 flypaper0 deleted the feature/invite-keys-invite branch February 22, 2023 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants