FAST: Add option to invalidate current fast token.

This commit is contained in:
Martin Dosch 2024-04-13 12:08:36 +02:00
parent 9161feef4d
commit 321c2b14a5

10
xmpp.go
View File

@ -269,6 +269,10 @@ type Options struct {
// XEP-0484: Fast Authentication Streamlining Tokens
// Fast Mechanism
FastMechanism string
// XEP-0484: Fast Authentication Streamlining Tokens
// Invalidate the current token
FastInvalidate bool
}
// NewClient establishes a new Client connection based on a set of Options.
@ -639,7 +643,11 @@ func (c *Client) init(o *Options) error {
}
fastAuth = fmt.Sprintf("<request-token xmlns='%s' mechanism='%s'/>", nsFast, mech)
} else {
fastAuth = fmt.Sprintf("<fast xmlns='%s' />", nsFast)
var fastInvalidate string
if o.FastInvalidate {
fastInvalidate = " invalidate='true'"
}
fastAuth = fmt.Sprintf("<fast xmlns='%s'%s/>", nsFast, fastInvalidate)
tlsState := tlsConn.ConnectionState()
mechanism = o.FastMechanism
switch mechanism {