chore: rename app name parameter (#154)

* chore: rename app name parameter

* doc: replace all instances of `c` parameter with `name` in README
This commit is contained in:
Roland 2023-11-02 21:22:39 +08:00 committed by GitHub
parent 91c404c030
commit 6be8c413f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -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.
@ -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.

View file

@ -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")