'use strict' ; import { Router , RequestHandler , Request , Response , NextFunction } from 'express' ; import { setupMetaverseAPI , finishMetaverseAPI } from '@Route-Tools/middleware' ; import { accountFromParams } from '@Route-Tools/middleware' ; import { Logger } from '@Tools/Logging' ; import { createSimplifiedPublicKey , convertBinKeyToPEM } from '@Route-Tools/Util' ; const procGetUsersPublicKey = async ( req , resp , next ) => { if ( req . vAccount ) { req . vRestResp . Data = { 'public_key' : createSimplifiedPublicKey ( req . vAccount . sessionPublicKey ) , 'username' : req . vAccount . username , 'accountid' : req . vAccount . id } ; } else { req . vRestResp . respondFailure ( 'Target account not found' ) ; } ; next ( ) ; } ; export const name = '/api/v1/users/:accoundId/public_key' ; export const router = Router ( ) ; router . get ( '/api/v1/users/:accountId/public_key' , [ setupMetaverseAPI , accountFromParams , procGetUsersPublicKey , finishMetaverseAPI ] ) ;