Skip to content

Commit bc3842c

Browse files
committed
annotate new tcpsock:setclientcert() method
1 parent 0accbf0 commit bc3842c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

meta/3rd/OpenResty/library/ngx.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,6 +2920,18 @@ function tcpsock:connect(host, port, opts) end
29202920
---@return string? error
29212921
function tcpsock:sslhandshake(reused_session, server_name, ssl_verify, send_status_req) end
29222922

2923+
--- Set client certificate chain and corresponding private key to the TCP socket object.
2924+
---
2925+
--- The certificate chain and private key provided will be used later by the `tcpsock:sslhandshake` method.
2926+
---
2927+
--- If both of `cert` and `pkey` are `nil`, this method will clear any existing client certificate and private key that was previously set on the cosocket object
2928+
---
2929+
---@param cert ffi.cdata*|nil # a client certificate chain cdata object that will be used while handshaking with remote server. These objects can be created using ngx.ssl.parse_pem_cert function provided by lua-resty-core. Note that specifying the cert option requires corresponding pkey be provided too.
2930+
---@param key ffi.cdata*|nil # a private key corresponds to the cert option above. These objects can be created using ngx.ssl.parse_pem_priv_key function provided by lua-resty-core.
2931+
---@return boolean ok
2932+
---@return string? error
2933+
function tcpsock:setclientcert(cert, key) end
2934+
29232935

29242936
--- Sends data without blocking on the current TCP or Unix Domain Socket connection.
29252937
---

0 commit comments

Comments
 (0)