File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -460,6 +460,14 @@ class _EphemeralAgentAdapter:
460460 def __init__ (self , native_agent ):
461461 self ._native = native_agent
462462
463+ def sign_string (self , data ):
464+ """Sign a raw string and return the base64-encoded signature.
465+
466+ Delegates to the native SimpleAgent.sign_string() method which
467+ provides raw string signing (same as JacsAgent.sign_string()).
468+ """
469+ return self ._native .sign_string (data )
470+
463471 def verify_agent (self , agentfile = None ):
464472 """Delegate to SimpleAgent.verify_self(); returns True or raises."""
465473 result = self ._native .verify_self ()
Original file line number Diff line number Diff line change @@ -734,6 +734,27 @@ impl SimpleAgent {
734734 Ok ( dict. into ( ) )
735735 }
736736
737+ /// Sign a raw string and return the base64-encoded signature.
738+ ///
739+ /// This provides the same raw-string signing as JacsAgent.sign_string(),
740+ /// using the underlying KeyManager::sign_string() via sign_raw_bytes().
741+ ///
742+ /// Args:
743+ /// data: The UTF-8 string to sign
744+ ///
745+ /// Returns:
746+ /// Base64-encoded signature string
747+ fn sign_string ( & self , data : & str ) -> PyResult < String > {
748+ use base64:: Engine ;
749+ let raw_bytes = self . inner . sign_raw_bytes ( data. as_bytes ( ) ) . map_err ( |e| {
750+ PyErr :: new :: < pyo3:: exceptions:: PyRuntimeError , _ > ( format ! (
751+ "Failed to sign string: {}" ,
752+ e
753+ ) )
754+ } ) ?;
755+ Ok ( base64:: engine:: general_purpose:: STANDARD . encode ( & raw_bytes) )
756+ }
757+
737758 /// Export the current agent's identity JSON for P2P exchange.
738759 ///
739760 /// Returns:
You can’t perform that action at this time.
0 commit comments