Skip to content

Commit

Permalink
Merge branch 'chore/query-parameters-ui' of github.com:getAlby/nostr-…
Browse files Browse the repository at this point in the history
…wallet-connect into chore/query-parameters-ui
  • Loading branch information
rolznz committed Nov 3, 2023
2 parents 6a0c869 + 94b98cf commit e75ad07
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 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 @@ -87,7 +87,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 @@ -240,7 +240,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
2 changes: 1 addition & 1 deletion views/apps/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h2 class="font-bold text-2xl font-headline mb-4 dark:text-white">
</div>
</div>
{{else}}
<p class="text-lg font-medium mb-2">Connection expiry time</p>
<p class="text-lg font-medium mb-2 text-gray-800 dark:text-neutral-200">Connection expiry time</p>
<p class="text-gray-600 dark:text-gray-300 text-sm">{{ .ExpiresAtFormatted }}</p>
{{end}}

Expand Down
2 changes: 1 addition & 1 deletion views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<body class="bg-gray-50 dark:bg-surface-00dp">
<div class="bg-white border-b border-gray-200 dark:bg-surface-01dp dark:border-neutral-700 mb-6">
<nav class="container max-w-screen-lg mx-auto px-4 py-3">
<nav class="container max-w-screen-lg mx-auto px-4 lg:px-0 py-3">
<div class="flex justify-between items-center">
<div class="flex items-center space-x-12">
<a href="/" class="font-headline text-[20px] dark:text-white">
Expand Down

0 comments on commit e75ad07

Please sign in to comment.