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

Echo register auth #740

Merged
merged 12 commits into from
Mar 31, 2023
Merged

Echo register auth #740

merged 12 commits into from
Mar 31, 2023

Conversation

llbartekll
Copy link
Contributor

@llbartekll llbartekll commented Mar 8, 2023

Description

  • registers at echo server with Authorization header
  • issues self signed jwt

Resolves # (issue)

How Has This Been Tested?

Due Dilligence

  • Breaking change
  • Requires a documentation update

@llbartekll llbartekll marked this pull request as draft March 8, 2023 13:09
@arein arein added the accepted label Mar 8, 2023
@llbartekll llbartekll force-pushed the echo-register-auth branch from 7676520 to b8c32fa Compare March 9, 2023 09:38

actor EchoRegisterService {
private let httpClient: HTTPClient
private let projectId: String
private let clientId: String
private let logger: ConsoleLogging
private let environment: APNSEnvironment
private let echoAuthenticator: EchoAuthenticating
// DID method specific identifier
private var clientIdMutlibase: String {
return clientId.replacingOccurrences(of: "did:key:", with: "")
Copy link
Contributor

Choose a reason for hiding this comment

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

may be use DIDKey object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in what way?
actually clientIdStorage could return DIDKey?

Copy link
Contributor

Choose a reason for hiding this comment

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

i mean:
let clientId: DIDKey

and after you can get the string with did(prefix: Bool, variant: DIDKeyVariant)

I created DIDKey type to avoid of using string keys. Actually good idea to return DIDKey from clientIdStorage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clientID cannot be DIDkey because we could confuse the variant

@llbartekll llbartekll requested a review from flypaper0 March 16, 2023 13:33
@llbartekll llbartekll marked this pull request as ready for review March 16, 2023 13:33
Copy link
Contributor

@flypaper0 flypaper0 left a comment

Choose a reason for hiding this comment

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

lgtm, few comments

@@ -12,6 +12,7 @@ public protocol HTTPService {
var method: HTTPMethod { get }
var body: Data? { get }
var queryParameters: [String: String]? { get }
var headerFields: [String: String]? { get }
Copy link
Contributor

Choose a reason for hiding this comment

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

may be additionalHeaders, because it's not represent all request headers as we are setting Content-Type separately after

@llbartekll llbartekll requested a review from flypaper0 March 30, 2023 10:27
@@ -122,7 +122,7 @@ private extension InvitationHandlingService {
let inviterAccount = try await identityClient.resolveIdentity(iss: claims.iss)
// TODO: Should we cache it?
let inviteePublicKey = try await identityClient.resolveInvite(account: inviterAccount)
let inviterPublicKey = invite.inviterPublicKey.did(prefix: false, variant: .X25519)
let inviterPublicKey = invite.inviterPublicKey.multibase(variant: .ED25519)
Copy link
Contributor

Choose a reason for hiding this comment

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

why you changed for ED25519? inviterPublic key is creating by createX25519KeyPair

Copy link
Contributor

Choose a reason for hiding this comment

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

also could you change it please to .did with prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was a typo, added did prefix too

@llbartekll llbartekll merged commit 1e5f2a9 into develop Mar 31, 2023
@llbartekll llbartekll deleted the echo-register-auth branch March 31, 2023 06:57
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.

4 participants