Skip to content

Commit

Permalink
chore: rename app name parameter (#154)
Browse files Browse the repository at this point in the history
* chore: rename app name parameter

* doc: replace all instances of `c` parameter with `name` in README
  • Loading branch information
rolznz authored Nov 2, 2023
1 parent 91c404c commit 6be8c41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ The default option is that the NWC app creates a secret and the user uses the no

##### Query parameter options

- `c`: the name of the client app
- `name`: the name of the client app

Example:

`/apps/new?c=myapp`
`/apps/new?name=myapp`

#### Client created secret
If the client creates the secret the client only needs to share the public key of that secret for authorization. The user authorized that pubkey and no sensitivate data needs to be shared.

##### Query parameter options for /new
- `c`: the name of the client app
- `name`: the name of the client app
- `pubkey`: the public key of the client's secret for the user to authorize
- `return_to`: (optional) if a `return_to` URL is provided the user will be redirected to that URL after authorization. The `lud16`, `relay` and `pubkey` query parameters will be added to the URL.
- `expires_at` (optional) connection cannot be used after this date. Unix timestamp in seconds.
Expand All @@ -88,7 +88,7 @@ If the client creates the secret the client only needs to share the public key o

Example:

`/apps/new?c=myapp&pubkey=47c5a21...&return_to=https://example.com`
`/apps/new?name=myapp&pubkey=47c5a21...&return_to=https://example.com`

#### Web-flow: client created secret
Web clients can open a new prompt popup to load the authorization page.
Expand Down
6 changes: 5 additions & 1 deletion echo_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ func getEndOfBudgetString(endOfBudget time.Time) (result string) {
}

func (svc *Service) AppsNewHandler(c echo.Context) error {
appName := c.QueryParam("c") // c - for client
appName := c.QueryParam("name")
if (appName == "") {
// c - for client (deprecated)
appName = c.QueryParam("c")
}
pubkey := c.QueryParam("pubkey")
returnTo := c.QueryParam("return_to")
maxAmount := c.QueryParam("max_amount")
Expand Down

0 comments on commit 6be8c41

Please sign in to comment.