@atproto/oauth-provider 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/oauth-provider",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "description": "Generic OAuth2 and OpenID Connect provider for Node.js. Currently only supports features needed for Atproto.",
6
6
  "keywords": [
@@ -40,13 +40,13 @@
40
40
  "zod": "^3.23.8",
41
41
  "@atproto-labs/fetch": "0.1.1",
42
42
  "@atproto-labs/fetch-node": "0.1.1",
43
- "@atproto-labs/simple-store-memory": "0.1.1",
44
43
  "@atproto-labs/pipe": "0.1.0",
45
- "@atproto/common": "^0.4.3",
44
+ "@atproto-labs/simple-store": "0.1.1",
45
+ "@atproto-labs/simple-store-memory": "0.1.1",
46
+ "@atproto/common": "^0.4.4",
46
47
  "@atproto/jwk": "0.1.1",
47
48
  "@atproto/jwk-jose": "0.1.2",
48
- "@atproto/oauth-types": "0.1.5",
49
- "@atproto-labs/simple-store": "0.1.1"
49
+ "@atproto/oauth-types": "0.1.5"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@rollup/plugin-commonjs": "^25.0.7",
@@ -77,8 +77,12 @@ export function AcceptForm({
77
77
  </div>
78
78
  )}
79
79
  <p>
80
- <ClientName clientId={clientId} clientMetadata={clientMetadata} /> is
81
- asking for permission to access your account (
80
+ <ClientName
81
+ clientId={clientId}
82
+ clientMetadata={clientMetadata}
83
+ clientTrusted={clientTrusted}
84
+ />{' '}
85
+ is asking for permission to access your account (
82
86
  <AccountIdentifier account={account} />
83
87
  ).
84
88
  </p>
@@ -10,29 +10,28 @@ import { UrlViewer } from './url-viewer'
10
10
  export type ClientNameProps = {
11
11
  clientId: string
12
12
  clientMetadata: OAuthClientMetadata
13
+ clientTrusted: boolean
14
+ loopbackClientName?: string
13
15
  } & HTMLAttributes<Element>
14
16
 
15
17
  export function ClientName({
16
18
  clientId,
17
19
  clientMetadata,
20
+ clientTrusted,
21
+ loopbackClientName = 'An application on your device',
18
22
  ...attrs
19
23
  }: ClientNameProps) {
24
+ if (clientTrusted && clientMetadata.client_name) {
25
+ return <span {...attrs}>{clientMetadata.client_name}</span>
26
+ }
27
+
20
28
  if (isOAuthClientIdLoopback(clientId)) {
21
- return <span {...attrs}>An application on your device</span>
29
+ return <span {...attrs}>{loopbackClientName}</span>
22
30
  }
23
31
 
24
32
  if (isOAuthClientIdDiscoverable(clientId)) {
25
- if (clientMetadata.client_name) {
26
- return (
27
- <span {...attrs}>
28
- {clientMetadata.client_name} (
29
- <UrlViewer url={clientId} path />)
30
- </span>
31
- )
32
- }
33
-
34
33
  return <UrlViewer {...attrs} url={clientId} path />
35
34
  }
36
35
 
37
- return <span {...attrs}>{clientMetadata.client_name || clientId}</span>
36
+ return <span {...attrs}>{clientId}</span>
38
37
  }