Skip to content

Commit

Permalink
transaction: Add BinaryConversationFunc adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
3v1n0 committed Nov 4, 2023
1 parent 5f33540 commit c56a85a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,20 @@ func (f ConversationFunc) RespondPAM(s Style, msg string) (string, error) {
return f(s, msg)
}

// BinaryConversationFunc is an adapter to allow the use of ordinary functions
// as binary (only) conversation callbacks.
type BinaryConversationFunc func(BinaryPointer) ([]byte, error)

// RespondPAMBinary is a conversation callback adapter.
func (f BinaryConversationFunc) RespondPAMBinary(ptr BinaryPointer) ([]byte, error) {
return f(ptr)
}

// RespondPAM is a dummy conversation callback adapter.
func (f BinaryConversationFunc) RespondPAM(Style, string) (string, error) {
return "", ConvErr
}

// cbPAMConv is a wrapper for the conversation callback function.
//
//export cbPAMConv
Expand Down

0 comments on commit c56a85a

Please sign in to comment.