Our CompactJws::sign function signature currently looks like this:
pub fn sign(
bearer_did: &BearerDid,
key_selector: &KeySelector,
header: &JwsHeader,
payload: &[u8], // JSON string as a byte array, TODO add a doc comment for this
) -> Result<String, JwsError> {
pub fn sign_detached(
bearer_did: &BearerDid,
key_selector: &KeySelector,
header: &JwsHeader,
payload: &[u8], // JSON string as a byte array, TODO add a doc comment for this
) -> Result<String, JwsError> {
// ...call CompactJws::sign() and then splice out the payload from the string
Proposal B
Introduce a fifth parameter to CompactJws::sign called CompactJwsSignOptions which includes a single property pub detached: bool
pub struct CompactJwsSignOptions {
pub detached: Option<bool>
}
// ...
pub fn sign(
bearer_did: &BearerDid,
key_selector: &KeySelector,
header: &JwsHeader,
payload: &[u8], // JSON string as a byte array, TODO add a doc comment for this
options: Option<CompactJwsSignOptions>
) -> Result<String, JwsError> { // ...
Proposal C
Introduce a fifth parameter to CompactJws::sign called detached of type bool
pub fn sign(
bearer_did: &BearerDid,
key_selector: &KeySelector,
header: &JwsHeader,
payload: &[u8], // JSON string as a byte array, TODO add a doc comment for this
detached: Option<bool>
) -> Result<String, JwsError> { // ...
We need to add support for detached content to our compact JWS implementation. Specifically, tbdex signatures make use of detached content.
Our
CompactJws::sign
function signature currently looks like this:Prior Art
AFAIK web5-js doesn't support detached compact JWS's, and instead tbdex-js creates the detached JWS
web5-kt inlines it as a function parameter
web5-go does support detached compact JWS's via an option parameter sent to the sign function
Proposal A
New function,
sign_detached
Proposal B
Introduce a fifth parameter to
CompactJws::sign
calledCompactJwsSignOptions
which includes a single propertypub detached: bool
Proposal C
Introduce a fifth parameter to
CompactJws::sign
calleddetached
of typebool