Skip to content

Commit

Permalink
Revert "Fix new sdk types in devtool (#358)"
Browse files Browse the repository at this point in the history
This reverts commit 56caa6f.
  • Loading branch information
Ptroger committed Jun 21, 2024
1 parent 8bdd845 commit b84f048
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions apps/devtool/src/app/_components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { faArrowsRotate, faFileSignature } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { AuthorizationResponse, SendEvaluationResponse, SignatureRequest } from '@narval/armory-sdk'
import { AuthorizationRequest, SendEvaluationResponse, SignatureRequest } from '@narval/armory-sdk'
import { EvaluationRequest, hexSchema } from '@narval/policy-engine-shared'
import { FC, ReactNode, useEffect, useState } from 'react'
import NarButton from '../_design-system/NarButton'
Expand All @@ -25,7 +25,7 @@ interface PlaygroundProps {
configModal: ReactNode
response?: string
errors?: string | undefined
authorize?: (req: EvaluationRequest) => Promise<AuthorizationResponse | undefined> | undefined
authorize?: (req: EvaluationRequest) => Promise<AuthorizationRequest | undefined> | undefined
evaluate?: (req: EvaluationRequest) => Promise<SendEvaluationResponse> | undefined
validateResponse: (res: any) => Promise<SignatureRequest | undefined>
}
Expand Down Expand Up @@ -57,7 +57,7 @@ const Playground: FC<PlaygroundProps> = ({
useEffect(() => {
if (response) {
setResponseEditor(response)
const authResponseParsed = AuthorizationResponse.parse(JSON.parse(response))
const authResponseParsed = AuthorizationRequest.parse(JSON.parse(response))
setVaultAccessToken(authResponseParsed.evaluations[0]?.signature || '')
}
}, [response])
Expand Down Expand Up @@ -99,7 +99,7 @@ const Playground: FC<PlaygroundProps> = ({
const response = authorize && (await authorize(request))
if (response) {
setResponseEditor(JSON.stringify(response, null, 2))
const authResponseParsed = AuthorizationResponse.parse(response)
const authResponseParsed = AuthorizationRequest.parse(response)
setVaultAccessToken(authResponseParsed.evaluations[0]?.signature || '')
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { AuthorizationResponse, SignatureRequest } from '@narval/armory-sdk'
import { AuthorizationRequest, SignatureRequest } from '@narval/armory-sdk'
import Playground from '../../_components/Playground'
import AuthConfigModal from '../../_components/modals/AuthConfigModal'
import useAuthServerApi from '../../_hooks/useAuthServerApi'
Expand All @@ -9,7 +9,7 @@ const AuthServerPlayground = () => {
const { errors: authErrors, authorizationResponse, authorize } = useAuthServerApi()

const validateResponse = async (res: any): Promise<SignatureRequest | undefined> => {
const response = AuthorizationResponse.safeParse(res)
const response = AuthorizationRequest.safeParse(res)

if (!response.success || !response.data.evaluations[0]?.signature) {
return undefined
Expand Down

0 comments on commit b84f048

Please sign in to comment.