@arcblock/did-connect-service 4.0.5 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/fonts/noto-sans-sc-regular.otf +0 -0
- package/dist/embedded.d.ts +32 -0
- package/dist/embedded.d.ts.map +1 -1
- package/dist/embedded.js +3 -0
- package/dist/embedded.js.map +1 -1
- package/dist/handlers/auth-handler.d.ts +5 -0
- package/dist/handlers/auth-handler.d.ts.map +1 -1
- package/dist/handlers/auth-handler.js +1 -22
- package/dist/handlers/auth-handler.js.map +1 -1
- package/dist/handlers/branding-handler.d.ts +17 -0
- package/dist/handlers/branding-handler.d.ts.map +1 -1
- package/dist/handlers/branding-handler.js +107 -5
- package/dist/handlers/branding-handler.js.map +1 -1
- package/dist/identity/gravatar.d.ts +0 -2
- package/dist/identity/gravatar.d.ts.map +1 -1
- package/dist/identity/gravatar.js +0 -9
- package/dist/identity/gravatar.js.map +1 -1
- package/dist/og/emoji.d.ts +12 -0
- package/dist/og/emoji.d.ts.map +1 -0
- package/dist/og/emoji.js +71 -0
- package/dist/og/emoji.js.map +1 -0
- package/dist/og/generator.d.ts +3 -0
- package/dist/og/generator.d.ts.map +1 -0
- package/dist/og/generator.js +338 -0
- package/dist/og/generator.js.map +1 -0
- package/dist/og/index.d.ts +6 -0
- package/dist/og/index.d.ts.map +1 -0
- package/dist/og/index.js +4 -0
- package/dist/og/index.js.map +1 -0
- package/dist/og/passport-svg.d.ts +52 -0
- package/dist/og/passport-svg.d.ts.map +1 -0
- package/dist/og/passport-svg.js +157 -0
- package/dist/og/passport-svg.js.map +1 -0
- package/dist/og/ssrf-guard.d.ts +38 -0
- package/dist/og/ssrf-guard.d.ts.map +1 -0
- package/dist/og/ssrf-guard.js +188 -0
- package/dist/og/ssrf-guard.js.map +1 -0
- package/dist/og/templates.d.ts +26 -0
- package/dist/og/templates.d.ts.map +1 -0
- package/dist/og/templates.js +302 -0
- package/dist/og/templates.js.map +1 -0
- package/dist/og/types.d.ts +74 -0
- package/dist/og/types.d.ts.map +1 -0
- package/dist/og/types.js +14 -0
- package/dist/og/types.js.map +1 -0
- package/package.json +18 -4
- package/dist/access-key-handler.d.ts +0 -37
- package/dist/access-key-handler.d.ts.map +0 -1
- package/dist/access-key-handler.js +0 -316
- package/dist/access-key-handler.js.map +0 -1
- package/dist/access-key-util.d.ts +0 -19
- package/dist/access-key-util.d.ts.map +0 -1
- package/dist/access-key-util.js +0 -45
- package/dist/access-key-util.js.map +0 -1
- package/dist/access-policy.d.ts +0 -53
- package/dist/access-policy.d.ts.map +0 -1
- package/dist/access-policy.js +0 -153
- package/dist/access-policy.js.map +0 -1
- package/dist/auth-client.d.ts +0 -20
- package/dist/auth-client.d.ts.map +0 -1
- package/dist/auth-client.js +0 -42
- package/dist/auth-client.js.map +0 -1
- package/dist/auth-entrypoint.d.ts +0 -45
- package/dist/auth-entrypoint.d.ts.map +0 -1
- package/dist/auth-entrypoint.js +0 -31
- package/dist/auth-entrypoint.js.map +0 -1
- package/dist/auth-handler.d.ts +0 -136
- package/dist/auth-handler.d.ts.map +0 -1
- package/dist/auth-handler.js +0 -408
- package/dist/auth-handler.js.map +0 -1
- package/dist/auth-rpc-types.d.ts +0 -139
- package/dist/auth-rpc-types.d.ts.map +0 -1
- package/dist/auth-rpc-types.js +0 -11
- package/dist/auth-rpc-types.js.map +0 -1
- package/dist/auth-rpc.d.ts +0 -80
- package/dist/auth-rpc.d.ts.map +0 -1
- package/dist/auth-rpc.js +0 -257
- package/dist/auth-rpc.js.map +0 -1
- package/dist/auth-worker.d.ts +0 -42
- package/dist/auth-worker.d.ts.map +0 -1
- package/dist/auth-worker.js +0 -120
- package/dist/auth-worker.js.map +0 -1
- package/dist/blocklet-js-handler.d.ts +0 -22
- package/dist/blocklet-js-handler.d.ts.map +0 -1
- package/dist/blocklet-js-handler.js +0 -205
- package/dist/blocklet-js-handler.js.map +0 -1
- package/dist/branding-handler.d.ts +0 -42
- package/dist/branding-handler.d.ts.map +0 -1
- package/dist/branding-handler.js +0 -326
- package/dist/branding-handler.js.map +0 -1
- package/dist/d1-token-storage.d.ts +0 -31
- package/dist/d1-token-storage.d.ts.map +0 -1
- package/dist/d1-token-storage.js +0 -83
- package/dist/d1-token-storage.js.map +0 -1
- package/dist/did-connect-handler.d.ts +0 -57
- package/dist/did-connect-handler.d.ts.map +0 -1
- package/dist/did-connect-handler.js +0 -182
- package/dist/did-connect-handler.js.map +0 -1
- package/dist/did.d.ts +0 -14
- package/dist/did.d.ts.map +0 -1
- package/dist/did.js +0 -17
- package/dist/did.js.map +0 -1
- package/dist/email-login-handler.d.ts +0 -50
- package/dist/email-login-handler.d.ts.map +0 -1
- package/dist/email-login-handler.js +0 -238
- package/dist/email-login-handler.js.map +0 -1
- package/dist/federation-utils.d.ts +0 -23
- package/dist/federation-utils.d.ts.map +0 -1
- package/dist/federation-utils.js +0 -25
- package/dist/federation-utils.js.map +0 -1
- package/dist/handler.d.ts +0 -90
- package/dist/handler.d.ts.map +0 -1
- package/dist/handler.js +0 -591
- package/dist/handler.js.map +0 -1
- package/dist/identity/invitation-util.d.ts +0 -7
- package/dist/identity/invitation-util.d.ts.map +0 -1
- package/dist/identity/invitation-util.js +0 -66
- package/dist/identity/invitation-util.js.map +0 -1
- package/dist/instance-role.d.ts +0 -10
- package/dist/instance-role.d.ts.map +0 -1
- package/dist/instance-role.js +0 -20
- package/dist/instance-role.js.map +0 -1
- package/dist/jwt.d.ts +0 -7
- package/dist/jwt.d.ts.map +0 -1
- package/dist/jwt.js +0 -72
- package/dist/jwt.js.map +0 -1
- package/dist/login-entry.d.ts +0 -9
- package/dist/login-entry.d.ts.map +0 -1
- package/dist/login-entry.js +0 -9
- package/dist/login-entry.js.map +0 -1
- package/dist/membership-handler.d.ts +0 -27
- package/dist/membership-handler.d.ts.map +0 -1
- package/dist/membership-handler.js +0 -111
- package/dist/membership-handler.js.map +0 -1
- package/dist/oauth-callback-page.d.ts +0 -9
- package/dist/oauth-callback-page.d.ts.map +0 -1
- package/dist/oauth-callback-page.js +0 -31
- package/dist/oauth-callback-page.js.map +0 -1
- package/dist/oauth-handler.d.ts +0 -72
- package/dist/oauth-handler.d.ts.map +0 -1
- package/dist/oauth-handler.js +0 -423
- package/dist/oauth-handler.js.map +0 -1
- package/dist/page.d.ts +0 -33
- package/dist/page.d.ts.map +0 -1
- package/dist/page.js +0 -59
- package/dist/page.js.map +0 -1
- package/dist/pages/auth-script.d.ts +0 -18
- package/dist/pages/auth-script.d.ts.map +0 -1
- package/dist/pages/auth-script.js +0 -185
- package/dist/pages/auth-script.js.map +0 -1
- package/dist/pages/design-tokens.d.ts +0 -86
- package/dist/pages/design-tokens.d.ts.map +0 -1
- package/dist/pages/design-tokens.js +0 -159
- package/dist/pages/design-tokens.js.map +0 -1
- package/dist/pages/did-connect-script.d.ts +0 -16
- package/dist/pages/did-connect-script.d.ts.map +0 -1
- package/dist/pages/did-connect-script.js +0 -105
- package/dist/pages/did-connect-script.js.map +0 -1
- package/dist/pages/shared-styles.d.ts +0 -6
- package/dist/pages/shared-styles.d.ts.map +0 -1
- package/dist/pages/shared-styles.js +0 -109
- package/dist/pages/shared-styles.js.map +0 -1
- package/dist/rbac.d.ts +0 -19
- package/dist/rbac.d.ts.map +0 -1
- package/dist/rbac.js +0 -76
- package/dist/rbac.js.map +0 -1
- package/dist/session-context.d.ts +0 -35
- package/dist/session-context.d.ts.map +0 -1
- package/dist/session-context.js +0 -39
- package/dist/session-context.js.map +0 -1
- package/dist/store.d.ts +0 -222
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -1366
- package/dist/store.js.map +0 -1
- package/dist/team-handler.d.ts +0 -90
- package/dist/team-handler.d.ts.map +0 -1
- package/dist/team-handler.js +0 -1225
- package/dist/team-handler.js.map +0 -1
- package/dist/ticket-handler.d.ts +0 -28
- package/dist/ticket-handler.d.ts.map +0 -1
- package/dist/ticket-handler.js +0 -74
- package/dist/ticket-handler.js.map +0 -1
- package/dist/wallet-identity.d.ts +0 -32
- package/dist/wallet-identity.d.ts.map +0 -1
- package/dist/wallet-identity.js +0 -43
- package/dist/wallet-identity.js.map +0 -1
- package/dist/webauthn.d.ts +0 -65
- package/dist/webauthn.d.ts.map +0 -1
- package/dist/webauthn.js +0 -112
- package/dist/webauthn.js.map +0 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { html } from "satori-html";
|
|
2
|
+
import { __unsafeHTML } from "ultrahtml";
|
|
3
|
+
import { getTextColor } from "./passport-svg.js";
|
|
4
|
+
// Join the raw strings and values to reconstruct the original string
|
|
5
|
+
const join = (strings, ...values) => {
|
|
6
|
+
const original = strings.raw.reduce((result, str, i) => {
|
|
7
|
+
return result + str + (values[i] !== undefined ? values[i] : "");
|
|
8
|
+
}, "");
|
|
9
|
+
return original;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Public brand-logo SVG helper. Returns an inline SVG string with the given
|
|
13
|
+
* stroke color. Not used by any of the 4 OG templates in this file — it's
|
|
14
|
+
* exported for external callers (e.g., admin UI, embed previews) that want
|
|
15
|
+
* the same brand mark with a custom stroke.
|
|
16
|
+
*/
|
|
17
|
+
export const getLogoSvg = (color) => {
|
|
18
|
+
return `<svg
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
style="position: absolute; right: 24px; bottom: 24px; opacity: 0.1"
|
|
21
|
+
width="360"
|
|
22
|
+
height="416"
|
|
23
|
+
viewBox="0 0 45 52"
|
|
24
|
+
>
|
|
25
|
+
<g fill="none" fill-rule="evenodd" stroke="${color}">
|
|
26
|
+
<path
|
|
27
|
+
d="M.5 13.077L22.15.577l21.651 12.5v25l-21.65 12.5L.5 38.077zM22.15.577v50M.5 13.077l43.301 25m-43.301 0l43.301-25"
|
|
28
|
+
></path>
|
|
29
|
+
<path d="M22.15 38.077l10.826-6.25-10.825-18.75-10.825 18.75z"></path>
|
|
30
|
+
</g>
|
|
31
|
+
</svg>`;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Background CSS for image-backed templates. When the blocklet has an
|
|
35
|
+
* uploaded og-image its URL is used as a cover image (legacy blocklet-server
|
|
36
|
+
* behavior); when `background` is empty we fall back to a brand-color
|
|
37
|
+
* gradient so blocklets without uploaded art still get a clean, on-brand
|
|
38
|
+
* card instead of a stretched default letter-SVG.
|
|
39
|
+
*/
|
|
40
|
+
const backgroundStyle = (background, color) => background
|
|
41
|
+
? `background-image: url(${background});
|
|
42
|
+
background-size: cover;
|
|
43
|
+
background-position: center;`
|
|
44
|
+
: `background: linear-gradient(160deg, ${color.start} 0%, ${color.end} 100%);`;
|
|
45
|
+
/**
|
|
46
|
+
* Foreground text color. Legacy image backgrounds were always dark, so the
|
|
47
|
+
* original hardcoded #EEE. On the gradient fallback the brand color can be
|
|
48
|
+
* light (e.g. DID-derived yellow), so pick a contrasting color instead.
|
|
49
|
+
*/
|
|
50
|
+
const foregroundColor = (background, color) => background ? "#EEE" : getTextColor(color.start);
|
|
51
|
+
/**
|
|
52
|
+
* Decorative layer for the gradient fallback: two soft radial glows plus the
|
|
53
|
+
* ArcBlock wireframe brand mark anchored bottom-right (the same mark
|
|
54
|
+
* `getLogoSvg` exposes, embedded as a data URI because satori rasterizes
|
|
55
|
+
* `<img>` sources more reliably than inline `<svg>` children). Empty string
|
|
56
|
+
* in legacy image mode — uploaded backgrounds stay untouched.
|
|
57
|
+
*
|
|
58
|
+
* Paint order matters: callers must place this BEFORE the text content so
|
|
59
|
+
* the glows render underneath.
|
|
60
|
+
*/
|
|
61
|
+
const gradientDecor = (background, color) => {
|
|
62
|
+
if (background)
|
|
63
|
+
return "";
|
|
64
|
+
const stroke = foregroundColor(background, color);
|
|
65
|
+
const mark = `<svg xmlns="http://www.w3.org/2000/svg" width="360" height="416" viewBox="0 0 45 52"><g fill="none" fill-rule="evenodd" stroke="${stroke}" stroke-width="0.6"><path d="M.5 13.077L22.15.577l21.651 12.5v25l-21.65 12.5L.5 38.077zM22.15.577v50M.5 13.077l43.301 25m-43.301 0l43.301-25"></path><path d="M22.15 38.077l10.826-6.25-10.825-18.75-10.825 18.75z"></path></g></svg>`;
|
|
66
|
+
const markUri = `data:image/svg+xml;base64,${Buffer.from(mark).toString("base64")}`;
|
|
67
|
+
// __unsafeHTML: satori-html's tagged template escapes interpolated strings
|
|
68
|
+
// (anti-injection); this wrapper marks the decor markup as trusted. The
|
|
69
|
+
// markup is fully static except for `stroke`/`markUri`, both derived from
|
|
70
|
+
// internal color math — no user input reaches it.
|
|
71
|
+
return __unsafeHTML(`<div style="position: absolute; top: -320px; right: -180px; width: 820px; height: 820px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 68%); display: flex;"></div>
|
|
72
|
+
<div style="position: absolute; bottom: -280px; left: -160px; width: 640px; height: 640px; border-radius: 50%; background: radial-gradient(circle, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0) 68%); display: flex;"></div>
|
|
73
|
+
<img src="${markUri}" style="position: absolute; right: -36px; bottom: -64px; width: 360px; height: 416px; opacity: 0.14" />`);
|
|
74
|
+
};
|
|
75
|
+
const getDefaultTemplate = ({ width, height, logo, background, logoRounded, color, title, description, }, fn) => {
|
|
76
|
+
const fg = foregroundColor(background, color);
|
|
77
|
+
return fn `<div
|
|
78
|
+
style="
|
|
79
|
+
width: ${width}px;
|
|
80
|
+
height: ${height}px;
|
|
81
|
+
${backgroundStyle(background, color)}
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
align-items: flex-start;
|
|
86
|
+
position: relative;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
"
|
|
89
|
+
>
|
|
90
|
+
${gradientDecor(background, color)}
|
|
91
|
+
<img
|
|
92
|
+
src="${logo}"
|
|
93
|
+
height="90"
|
|
94
|
+
width="90"
|
|
95
|
+
style="margin-left: 96px; height: 90px; width: 90px;${logoRounded ? "border-radius: 50%;" : ""} margin-bottom: 64px"
|
|
96
|
+
/>
|
|
97
|
+
<h2
|
|
98
|
+
style="
|
|
99
|
+
font-size: 48px;
|
|
100
|
+
letter-spacing: -2px;
|
|
101
|
+
margin: 0 0 32px;
|
|
102
|
+
color: ${fg};
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
font-family: Arial, sans-serif;
|
|
105
|
+
text-align: left;
|
|
106
|
+
padding: 0 96px;
|
|
107
|
+
"
|
|
108
|
+
>
|
|
109
|
+
${title}
|
|
110
|
+
</h2>
|
|
111
|
+
<h3
|
|
112
|
+
style="
|
|
113
|
+
font-size: 2rem;
|
|
114
|
+
margin: 0;
|
|
115
|
+
color: ${fg};
|
|
116
|
+
opacity: 0.7;
|
|
117
|
+
font-weight: 400;
|
|
118
|
+
font-family: Arial, sans-serif;
|
|
119
|
+
text-align: left;
|
|
120
|
+
padding: 0 96px;
|
|
121
|
+
line-clamp: 3;
|
|
122
|
+
"
|
|
123
|
+
>
|
|
124
|
+
${description}
|
|
125
|
+
</h3>
|
|
126
|
+
</div>`;
|
|
127
|
+
};
|
|
128
|
+
const getSectionTemplate = ({ width, height, logo, logoRounded, background, color, title, description, section, }, fn) => {
|
|
129
|
+
const fg = foregroundColor(background, color);
|
|
130
|
+
// Section label: with an image background the brand color is the accent;
|
|
131
|
+
// on the gradient fallback the brand color IS the background, so the
|
|
132
|
+
// label must use the contrasting foreground instead.
|
|
133
|
+
const labelColor = background ? color.start : fg;
|
|
134
|
+
return fn `<div
|
|
135
|
+
style="
|
|
136
|
+
width: ${width}px;
|
|
137
|
+
height: ${height}px;
|
|
138
|
+
${backgroundStyle(background, color)}
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
align-items: flex-start;
|
|
143
|
+
position: relative;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
"
|
|
146
|
+
>
|
|
147
|
+
${gradientDecor(background, color)}
|
|
148
|
+
<img
|
|
149
|
+
src="${logo}"
|
|
150
|
+
height="90"
|
|
151
|
+
width="90"
|
|
152
|
+
style="margin-left: 96px; height: 90px; width: 90px; ${logoRounded ? "border-radius: 50%;" : ""} margin-bottom: 64px"
|
|
153
|
+
/>
|
|
154
|
+
<p
|
|
155
|
+
style="
|
|
156
|
+
font-size: 1.5rem;
|
|
157
|
+
margin: 0;
|
|
158
|
+
color: ${labelColor};
|
|
159
|
+
font-weight: 400;
|
|
160
|
+
font-family: Arial, sans-serif;
|
|
161
|
+
text-align: left;
|
|
162
|
+
text-transform: uppercase;
|
|
163
|
+
padding: 0 96px;
|
|
164
|
+
"
|
|
165
|
+
>
|
|
166
|
+
${section}
|
|
167
|
+
</p>
|
|
168
|
+
<h2
|
|
169
|
+
style="
|
|
170
|
+
font-size: 48px;
|
|
171
|
+
margin: 0 0 32px;
|
|
172
|
+
color: ${fg};
|
|
173
|
+
letter-spacing: -2px;
|
|
174
|
+
font-weight: 500;
|
|
175
|
+
font-family: Arial, sans-serif;
|
|
176
|
+
text-align: left;
|
|
177
|
+
padding: 0 96px;
|
|
178
|
+
line-clamp: 2;
|
|
179
|
+
"
|
|
180
|
+
>
|
|
181
|
+
${title}
|
|
182
|
+
</h2>
|
|
183
|
+
<h3
|
|
184
|
+
style="
|
|
185
|
+
font-size: 2rem;
|
|
186
|
+
margin: 0;
|
|
187
|
+
color: ${fg};
|
|
188
|
+
opacity: 0.7;
|
|
189
|
+
font-weight: 400;
|
|
190
|
+
font-family: Arial, sans-serif;
|
|
191
|
+
text-align: left;
|
|
192
|
+
padding: 0 96px;
|
|
193
|
+
line-clamp: 3;
|
|
194
|
+
"
|
|
195
|
+
>
|
|
196
|
+
${description}
|
|
197
|
+
</h3>
|
|
198
|
+
</div>`;
|
|
199
|
+
};
|
|
200
|
+
const getCoverTemplate = ({ width, height, logo, logoRounded, color, title, description, cover, }, fn) => {
|
|
201
|
+
const textColor = getTextColor(color.start);
|
|
202
|
+
// TODO: cover template hardcodes 630px panel height (carried from source); replace with ${height} when we generalize.
|
|
203
|
+
return fn `<div style="width: ${width}px; height: ${height}px; display: flex; background: ${color.start};">
|
|
204
|
+
<div style="display: flex; height: ${height}px; background: ${color.start}; width: 45%">
|
|
205
|
+
<div style="margin-left: 32px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-around;">
|
|
206
|
+
<h2
|
|
207
|
+
style="
|
|
208
|
+
font-size: 3rem;
|
|
209
|
+
color: ${textColor};
|
|
210
|
+
font-weight: 400;
|
|
211
|
+
font-family: Arial, sans-serif;
|
|
212
|
+
margin: 32px 32px 0 0;
|
|
213
|
+
text-align: left;
|
|
214
|
+
"
|
|
215
|
+
>
|
|
216
|
+
${description}
|
|
217
|
+
</h2>
|
|
218
|
+
<div style="display: flex; justify-content: flex-start; align-items: center">
|
|
219
|
+
<img src="${logo}" height="60" width="60" style="height: 60px; width: 60px; ${logoRounded ? "border-radius: 50%;" : ""}" />
|
|
220
|
+
<h3
|
|
221
|
+
style="
|
|
222
|
+
font-size: 2rem;
|
|
223
|
+
margin: 0 0 0 16px;
|
|
224
|
+
color: ${textColor};
|
|
225
|
+
font-weight: 400;
|
|
226
|
+
font-family: Arial, sans-serif;
|
|
227
|
+
text-align: left;
|
|
228
|
+
text-transform: capitalize;
|
|
229
|
+
"
|
|
230
|
+
>
|
|
231
|
+
${title}
|
|
232
|
+
</h3>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
<div style="display: flex; height: 630px; width: 55%; background-color: ${color.start}">
|
|
237
|
+
<img src="${cover}" height="630" width="100%" style="height: 630px; width: 100%; object-fit: cover" />
|
|
238
|
+
<div style="
|
|
239
|
+
display: flex;
|
|
240
|
+
background: ${color.start};
|
|
241
|
+
height: ${height * 2}px;
|
|
242
|
+
width: 100px;
|
|
243
|
+
position: absolute;
|
|
244
|
+
transform: rotate(8deg);
|
|
245
|
+
left: -90px;
|
|
246
|
+
top: -25px;"></div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>`;
|
|
249
|
+
};
|
|
250
|
+
const getBannerTemplate = ({ width, height, logo, logoRounded, background, color, title, }, fn) => {
|
|
251
|
+
const fg = foregroundColor(background, color);
|
|
252
|
+
return fn `<div
|
|
253
|
+
style="
|
|
254
|
+
width: ${width}px;
|
|
255
|
+
height: ${height}px;
|
|
256
|
+
${backgroundStyle(background, color)}
|
|
257
|
+
display: flex;
|
|
258
|
+
flex-direction: row;
|
|
259
|
+
justify-content: center;
|
|
260
|
+
align-items: center;
|
|
261
|
+
position: relative;
|
|
262
|
+
overflow: hidden;
|
|
263
|
+
"
|
|
264
|
+
>
|
|
265
|
+
${gradientDecor(background, color)}
|
|
266
|
+
<img
|
|
267
|
+
src="${logo}"
|
|
268
|
+
height="150"
|
|
269
|
+
width="150"
|
|
270
|
+
style="height: 150px; width: 150px; ${logoRounded ? "border-radius: 50%;" : ""} margin-right: 48px"
|
|
271
|
+
/>
|
|
272
|
+
<h2
|
|
273
|
+
style="
|
|
274
|
+
font-size: 72px;
|
|
275
|
+
color: ${fg};
|
|
276
|
+
font-weight: 500;
|
|
277
|
+
font-family: Arial, sans-serif;
|
|
278
|
+
text-align: left;
|
|
279
|
+
line-clamp: 1;
|
|
280
|
+
"
|
|
281
|
+
>
|
|
282
|
+
${title}
|
|
283
|
+
</h2>
|
|
284
|
+
</div>`;
|
|
285
|
+
};
|
|
286
|
+
export const getTemplate = async (params) => {
|
|
287
|
+
const fn = params.format === "html" ? join : html;
|
|
288
|
+
if (params.template === "default") {
|
|
289
|
+
return getDefaultTemplate(params, fn);
|
|
290
|
+
}
|
|
291
|
+
if (params.template === "section") {
|
|
292
|
+
return getSectionTemplate(params, fn);
|
|
293
|
+
}
|
|
294
|
+
if (params.template === "cover") {
|
|
295
|
+
return getCoverTemplate(params, fn);
|
|
296
|
+
}
|
|
297
|
+
if (params.template === "banner") {
|
|
298
|
+
return getBannerTemplate(params, fn);
|
|
299
|
+
}
|
|
300
|
+
throw new Error("Invalid open graph template");
|
|
301
|
+
};
|
|
302
|
+
//# sourceMappingURL=templ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mojiType } from "./emoji.js";
|
|
2
|
+
import type { OgFormat, OgTemplate } from "./templates.js";
|
|
3
|
+
export type { OgFormat, OgTemplate } from "./templates.js";
|
|
4
|
+
export interface OgInfoContext {
|
|
5
|
+
/** Display name of the blocklet/app. Used as title fallback. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Display description. Used as description fallback. */
|
|
8
|
+
description: string;
|
|
9
|
+
/** DID of the blocklet instance. Used to derive brand color when passportColor='auto'. */
|
|
10
|
+
did: string;
|
|
11
|
+
/** Public origin where the blocklet serves logos/og-images (used to build absolute URLs). */
|
|
12
|
+
appUrl: string;
|
|
13
|
+
/** Brand color preference: 'default' | 'auto' | hex string (e.g., '#3882C7'). */
|
|
14
|
+
passportColor?: string;
|
|
15
|
+
/** Hash suffix appended to default logo URL for cache busting. */
|
|
16
|
+
logoHash?: string;
|
|
17
|
+
/** Hash suffix appended to default og-image URL for cache busting. */
|
|
18
|
+
ogImageHash?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface OgGenerateInput {
|
|
21
|
+
template?: OgTemplate;
|
|
22
|
+
title?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
section?: string;
|
|
25
|
+
cover?: string;
|
|
26
|
+
logo?: string;
|
|
27
|
+
logoRounded?: "0" | "1";
|
|
28
|
+
emoji?: EmojiType;
|
|
29
|
+
nocache?: "1";
|
|
30
|
+
}
|
|
31
|
+
export interface OgGenerateOptions {
|
|
32
|
+
input: OgGenerateInput;
|
|
33
|
+
info: OgInfoContext;
|
|
34
|
+
format: OgFormat;
|
|
35
|
+
/** Directory for cached final PNG output. */
|
|
36
|
+
cacheDir: string;
|
|
37
|
+
/** Directory for intermediate downloads (external images converted to PNG). */
|
|
38
|
+
tmpDir: string;
|
|
39
|
+
}
|
|
40
|
+
export interface OgGenerator {
|
|
41
|
+
/** Returns the absolute path to the generated/cached file. */
|
|
42
|
+
generate(opts: OgGenerateOptions): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
export interface CreateOgGeneratorOptions {
|
|
45
|
+
/** Override fetch implementation (used in tests to bypass network). Defaults to global fetch. */
|
|
46
|
+
fetchImpl?: typeof fetch;
|
|
47
|
+
/**
|
|
48
|
+
* Override the DNS resolver used by the SSRF guard before fetching external
|
|
49
|
+
* images (tests inject a public-IP stub to avoid real lookups). Defaults to
|
|
50
|
+
* node:dns lookup. Returns all resolved addresses for a host.
|
|
51
|
+
*/
|
|
52
|
+
lookupImpl?: (host: string) => Promise<Array<{
|
|
53
|
+
address: string;
|
|
54
|
+
}>>;
|
|
55
|
+
/**
|
|
56
|
+
* Remote font URL (OTF/TTF). When set, the font is fetched once, cached on
|
|
57
|
+
* disk, and used for all renders — keeping the 8MB CJK font OUT of the npm
|
|
58
|
+
* package. Falls back to the bundled font when the fetch fails. Defaults to
|
|
59
|
+
* `process.env.OG_FONT_URL`.
|
|
60
|
+
*/
|
|
61
|
+
fontUrl?: string;
|
|
62
|
+
/** Disk cache directory for remote fonts. Defaults to `<os.tmpdir()>/og-fonts`. */
|
|
63
|
+
fontCacheDir?: string;
|
|
64
|
+
}
|
|
65
|
+
export declare const OG_TEMPLATES: readonly OgTemplate[];
|
|
66
|
+
export declare const MAX_TITLE_LENGTH = 128;
|
|
67
|
+
export declare const MAX_DESCRIPTION_LENGTH = 512;
|
|
68
|
+
export declare const MAX_IMAGE_SIZE: number;
|
|
69
|
+
export declare const MAX_IMAGE_DIMENSION = 2400;
|
|
70
|
+
export declare class OgValidationError extends Error {
|
|
71
|
+
statusCode: number;
|
|
72
|
+
constructor(message: string);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/og/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3D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AAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACnE;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAA8C,CAAC;AAG7F,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,cAAc,QAAkB,CAAC;AAC9C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,UAAU,SAAO;gBACL,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/og/types.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const OG_TEMPLATES = ["default", "section", "cover", "banner"];
|
|
2
|
+
// Validation thresholds (match blocklet-server original).
|
|
3
|
+
export const MAX_TITLE_LENGTH = 128;
|
|
4
|
+
export const MAX_DESCRIPTION_LENGTH = 512;
|
|
5
|
+
export const MAX_IMAGE_SIZE = 5 * 1024 * 1024;
|
|
6
|
+
export const MAX_IMAGE_DIMENSION = 2400;
|
|
7
|
+
export class OgValidationError extends Error {
|
|
8
|
+
statusCode = 400;
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "OgValidationError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/og/types.ts"],"names":[],"mappings":"AAuEA,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE7F,0DAA0D;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,UAAU,GAAG,GAAG,CAAC;IACjB,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-connect-service",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Multi-runtime authentication service framework — Passkey, DID Connect, OAuth, Email, Team, RBAC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,6 +33,12 @@
|
|
|
33
33
|
"./d1-compat": {
|
|
34
34
|
"types": "./dist/store/d1-compat.d.ts",
|
|
35
35
|
"import": "./dist/store/d1-compat.js"
|
|
36
|
+
},
|
|
37
|
+
"./og-node": {
|
|
38
|
+
"node": {
|
|
39
|
+
"types": "./dist/og/index.d.ts",
|
|
40
|
+
"default": "./dist/og/index.js"
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
},
|
|
38
44
|
"dependencies": {
|
|
@@ -42,9 +48,16 @@
|
|
|
42
48
|
"@ocap/mcrypto": "^1.30.24",
|
|
43
49
|
"@ocap/util": "^1.30.24",
|
|
44
50
|
"@ocap/wallet": "^1.30.24",
|
|
51
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
45
52
|
"hono": "^4.12.23",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
53
|
+
"satori": "^0.26.0",
|
|
54
|
+
"satori-html": "^0.3.2",
|
|
55
|
+
"sharp": "^0.34.5",
|
|
56
|
+
"ufo": "^1.6.4",
|
|
57
|
+
"ultrahtml": "^1.6.0",
|
|
58
|
+
"valibot": "^1.3.1",
|
|
59
|
+
"@arcblock/did-connect-core": "^4.0.6",
|
|
60
|
+
"@arcblock/did-connect-js": "^4.0.6"
|
|
48
61
|
},
|
|
49
62
|
"optionalDependencies": {
|
|
50
63
|
"@aigne/afs": "^1.11.0-beta.13"
|
|
@@ -58,7 +71,8 @@
|
|
|
58
71
|
},
|
|
59
72
|
"files": [
|
|
60
73
|
"dist",
|
|
61
|
-
"migrations"
|
|
74
|
+
"migrations",
|
|
75
|
+
"assets"
|
|
62
76
|
],
|
|
63
77
|
"publishConfig": {
|
|
64
78
|
"access": "public"
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AccessKeyHandler — HTTP handler for access key management API.
|
|
3
|
-
*
|
|
4
|
-
* API routes (/.well-known/service/api/access-keys):
|
|
5
|
-
* GET / — List access keys (paginated, searchable)
|
|
6
|
-
* POST / — Create a new access key
|
|
7
|
-
* GET /:id — Get access key details
|
|
8
|
-
* PUT /:id — Update access key (remark, expireAt)
|
|
9
|
-
* DELETE /:id — Delete an access key
|
|
10
|
-
*/
|
|
11
|
-
import type { Auth } from "./handlers/passkey-handler.js";
|
|
12
|
-
import type { D1Store } from "./store/d1-store.js";
|
|
13
|
-
export declare class AccessKeyHandler {
|
|
14
|
-
private store;
|
|
15
|
-
private passkey;
|
|
16
|
-
private apiBase;
|
|
17
|
-
constructor(options: {
|
|
18
|
-
store: D1Store;
|
|
19
|
-
passkey: Auth;
|
|
20
|
-
basePath?: string;
|
|
21
|
-
});
|
|
22
|
-
/** Main HTTP router. Returns Response or null if path doesn't match. */
|
|
23
|
-
fetch(request: Request, instanceDid?: string): Promise<Response | null>;
|
|
24
|
-
private handleAPI;
|
|
25
|
-
private verifyAndCheckApproval;
|
|
26
|
-
private handleList;
|
|
27
|
-
private handleCreate;
|
|
28
|
-
private handleGet;
|
|
29
|
-
private handleUpdate;
|
|
30
|
-
private handleDelete;
|
|
31
|
-
/** Non-admin callers can only operate on keys they created. Admin+ can operate on any key. */
|
|
32
|
-
private requireOwnership;
|
|
33
|
-
private jsonResponse;
|
|
34
|
-
private errorResponse;
|
|
35
|
-
private parseJSON;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=access-key-handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"access-key-handler.d.ts","sourceRoot":"","sources":["../src/access-key-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAG1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAenD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,OAAO,CAAO;IACtB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAMzE,wEAAwE;IAClE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;YAU/D,SAAS;YAoDT,sBAAsB;YAyCtB,UAAU;YA6BV,YAAY;YAiFZ,SAAS;YAuBT,YAAY;YAuEZ,YAAY;IAkD1B,8FAA8F;IAC9F,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,aAAa;YAIP,SAAS;CAOxB"}
|