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

Claim gateways using a QR code #7270

Closed
2 of 6 tasks
KrishnaIyer opened this issue Aug 27, 2024 · 7 comments
Closed
2 of 6 tasks

Claim gateways using a QR code #7270

KrishnaIyer opened this issue Aug 27, 2024 · 7 comments
Assignees
Labels
needs/testing This needs to be tested on staging
Milestone

Comments

@KrishnaIyer
Copy link
Member

Summary

Claim gateways using a QR code.

Current Situation

We can currently claim gateways using an EUI and an owner token.

Why do we need this? Who uses it, and when?

Users with a gateway QR code can claim it. This is very similar to claiming end devices.

Proposed Implementation

Backend:

  • Introduce a GatewayQRCodeGenerator service similar to the EndDeviceQRCodeGenerator with one single method Parse.
  • For the actual implementation, we can introduce a new format for this; I propose ttigw001 with the rest of the interfaces/parsing fully adapted from the TR005 implementation.

Frontend:

  • Introduce a scan QR Code option in the gateway onboarding flow. I think we can replicate the end device onboarding UX; cc: @kschiffer
  • Use the ParseGatewayQRCodeRequest RPC, which will return a ClaimGatewayRequest with only the identifiers filled. Fill the rest of the fields (ex: Gateway ID, frequency plans etc) as with the current claiming flow and make a request to claim the gateway.

Contributing

  • I can help by doing more research.
  • I can help by implementing the feature after the proposal above is approved.
  • I can help by testing the feature before it's released.

Validation

Code of Conduct

@KrishnaIyer KrishnaIyer added this to the v3.32.1 milestone Aug 27, 2024
@github-actions github-actions bot added the needs/triage We still need to triage this label Aug 27, 2024
@KrishnaIyer KrishnaIyer removed the needs/triage We still need to triage this label Aug 27, 2024
@vlasebian
Copy link
Contributor

The ttigw001 is going to be identical to the TR005? Or will it be slightly different?

@KrishnaIyer
Copy link
Member Author

Identical in what way?

@vlasebian
Copy link
Contributor

Will the implementation be the same?

@johanstokking
Copy link
Member

Commented on the PR, that's easier I think.

@vlasebian
Copy link
Contributor

vlasebian commented Sep 3, 2024

Currently, the request for this endpoint looks like this (the format id is specified as a path argument, or it defaults to a format):

message ParseGatewayQRCodeRequest {
  string format_id = 1 [(validate.rules).string = {
    pattern: "^[a-z0-9](?:[-]?[a-z0-9]){2,}$|^$",
    max_len: 36
  }];
  // Raw QR code contents.
  bytes qr_code = 2 [(validate.rules).bytes = {
    min_len: 10,
    max_len: 1024
  }];
}

From what I understand, the QR code will contain a URL. Will the URL be encoded when sending it to this endpoint in the qr_code field? Because if it's plain text, it will not pass the validation. What I mean is if it's simply sent like this:

{ "qr_code": "https://ttig.pro/c/ec656efffe000128/abcdef123456" }

The endpoint will return the following error:

{"code":3, "message":"proto: (line 1:14): invalid value for bytes type: \"https://ttig.pro/c/ec656efffe000128/abcdef123456\""}

So the URL probably has to be in a base64 encoded form before passing it to the request. Does that make sense? Or would it be better to just change the type of the request field?

@johanstokking

(I left a comment here not in the issue because it might be relevant for fe too)

@johanstokking
Copy link
Member

johanstokking commented Sep 3, 2024

So the URL probably has to be in a base64 encoded form before passing it to the request. Does that make sense? Or would it be better to just change the type of the request field?

Yeah I'm a bit conflicted on this. If we use bytes for the end device QR code, then let's do that here as well. Indeed when using JSON it'd be base64 encoded.

@vlasebian vlasebian added the needs/testing This needs to be tested on staging label Sep 10, 2024
@KrishnaIyer
Copy link
Member Author

This is done and tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/testing This needs to be tested on staging
Projects
None yet
Development

No branches or pull requests

4 participants