
    yj                        d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZmZmZ d dlmZ  ej        e          Z eddg e ed	
                    g          Ze                    d           edd           edd           edd          dfdedz  dedz  dedz  de j         dz  fd            ZdS )    N)	APIRouterDependsQuery)settings)DisabledExceptionValidationException)	JWTParams
create_jwtrequire_auth)format_datetime_utcz/keyskeysT)admin)prefixtagsdependencies z'ID of the workspace to scope the key to)descriptionz"ID of the peer to scope the key toz%ID of the session to scope the key toworkspace_idpeer_id
session_id
expires_atc                    K   t           j        j        st                      t	          | ||g          st          d          t          t          |rt          |          nd| ||                    }d|iS )zCreate a new KeyzEAt least one of workspace_id, peer_id, or session_id must be providedN)expwpskey)	r   AUTHUSE_AUTHr   anyr   r
   r	   r   )r   r   r   r   key_strs        8/DATA/AppData/hermes/projects/honcho/src/routers/keys.py
create_keyr#      s       =! "!!! gz233 
!S
 
 	
 3=G#J///4		
 	
 	
 G 	w     )datetimeloggingfastapir   r   r   
src.configr   src.exceptionsr   r   src.securityr	   r
   r   src.utils.formattingr   	getLogger__name__loggerrouterpoststrr#    r$   r"   <module>r3      s     - - - - - - - - - -       A A A A A A A A         
 5 4 4 4 4 4		8	$	$	
',,T222334
 
 
 R$uC       %2VWWW"UA   ,0 * 4Z	
 d
 !D(     r$   