MCPcopy Create free account
hub / github.com/Noumena-Network/code / buildAuthStatusView

Function buildAuthStatusView

src/auth/runtime/status.ts:94–130  ·  view source on GitHub ↗
(
  session: ResolvedAuthSession,
)

Source from the content-addressed store, hash-verified

92}
93
94export function buildAuthStatusView(
95 session: ResolvedAuthSession,
96): AuthStatusView {
97 const authMethod = buildAuthMethod(session)
98 const authExpired = authMethod === 'managed_oauth_expired'
99 const loggedIn =
100 session.principalSource === 'third_party_provider' ||
101 session.sessionState === 'usable'
102
103 const authTokenSource =
104 session.principalSource === 'managed_oauth'
105 ? 'noumena_managed'
106 : authMethod === 'oauth_token' || authMethod === 'api_key_helper'
107 ? session.rawAuthTokenSource
108 : null
109
110 const baseView = {
111 loggedIn,
112 authMethod,
113 authExpired,
114 apiProvider: getAPIProvider(),
115 email: session.identity.email,
116 orgId: session.identity.organizationUuid,
117 orgName: session.identity.organizationName,
118 subscriptionType: session.subscription.subscriptionType,
119 subscriptionName: session.subscription.subscriptionName,
120 apiKeySource: session.rawApiKeySource,
121 authTokenSource,
122 recoveryAction: session.recoveryAction,
123 recoveryMessage: session.recoveryMessage,
124 }
125
126 return {
127 ...baseView,
128 accountProperties: buildAccountProperties(baseView),
129 }
130}

Callers 2

buildAccountPropertiesFunction · 0.85
getStatusViewMethod · 0.85

Calls 3

buildAuthMethodFunction · 0.85
getAPIProviderFunction · 0.85
buildAccountPropertiesFunction · 0.70

Tested by

no test coverage detected