public final class Signer
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
Signer |
body(byte[] body)
Add the full request body.
|
Signer |
body(java.lang.String body)
Add the full request body.
|
static Signer |
from(java.lang.String kid,
byte[] privateKeyPem)
Start building a request Tl-Signature header value using private key
RFC 7468 PEM-encoded data and the key's kid.
|
static Signer |
from(java.lang.String kid,
java.security.interfaces.ECPrivateKey privateKeyPem)
Start building a request Tl-Signature header value using private key
RFC 7468 PEM-encoded data and the key's kid.
|
static Signer |
from(java.lang.String kid,
java.lang.String privateKeyPem)
Start building a request Tl-Signature header value using private key
RFC 7468 PEM-encoded data and the key's kid.
|
Signer |
header(java.lang.String name,
java.lang.String value)
Add a header name and value.
|
Signer |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
Add a Map of headers.
|
Signer |
method(java.lang.String method)
Add the request method, defaults to `"POST"` if unspecified.
|
Signer |
path(java.lang.String path)
Add the request absolute path starting with a leading `/` and without any trailing slashes.
|
java.lang.String |
sign()
Produce a JWS `Tl-Signature` v2 header value
|
public Signer method(java.lang.String method)
method - - the request method must be non nulljava.lang.IllegalArgumentException - if the provided param is nullpublic Signer path(java.lang.String path)
path - - the request absolute path must not be nulljava.lang.IllegalArgumentException - if the provided param is null or invalidpublic Signer body(byte[] body)
body - - the full request body must not be nulljava.lang.IllegalArgumentException - if the provided param is nullpublic Signer body(java.lang.String body)
body - - the full request body must not be nulljava.lang.IllegalArgumentException - if the provided param is nullpublic Signer header(java.lang.String name, java.lang.String value)
name - - must not be nullvalue - - must not be nulljava.lang.IllegalArgumentException - if the provided params are nullpublic Signer headers(java.util.Map<java.lang.String,java.lang.String> headers)
headers - - must not be nulljava.lang.IllegalArgumentException - if the provided params are nullpublic static Signer from(java.lang.String kid, byte[] privateKeyPem)
kid - key identifier of the private key - must not be nullprivateKeyPem - the privateKey RFC 7468 PEM-encoded - must not be nullKeyException - if the provided key is invalidjava.lang.IllegalArgumentException - if the provided params are nullpublic static Signer from(java.lang.String kid, java.lang.String privateKeyPem)
kid - key identifier of the private key - must not be nullprivateKeyPem - the privateKey RFC 7468 PEM-encoded - must not be nullKeyException - if the provided key is invalidjava.lang.IllegalArgumentException - if the provided params are nullpublic static Signer from(java.lang.String kid, java.security.interfaces.ECPrivateKey privateKeyPem)
kid - key identifier of the private key - must not be nullprivateKeyPem - the privateKey RFC 7468 PEM-encoded - must not be nullKeyException - if the provided key is invalidjava.lang.IllegalArgumentException - if the provided params are nullpublic java.lang.String sign()
SignatureException - if signature fails