MCPcopy
hub / github.com/wandb/openui / getPublicKey

Function getPublicKey

frontend/src/api/openui.ts:107–124  ·  view source on GitHub ↗
(username: string, create = false)

Source from the content-addressed store, hash-verified

105 .replaceAll('/', '_')
106
107async function getPublicKey(username: string, create = false) {
108 const r = await fetch(
109 `${API_HOST}/${create ? 'register' : 'auth'}/${encodeURIComponent(
110 username
111 )}`,
112 {
113 credentials: 'same-origin'
114 }
115 )
116
117 if (r.status !== 200) {
118 throw new Error(`Unexpected response ${r.status}: ${await r.text()}`)
119 }
120 if (create) {
121 return (await r.json()) as PublicKeyCredentialCreationOptions
122 }
123 return (await r.json()) as PublicKeyCredentialRequestOptions
124}
125
126interface AuthResponse {
127 attestationObject?: ArrayBuffer

Callers 2

registerFunction · 0.85
authFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected