Macaroon.Util.CaveatHelpers (macaroon v0.5.1)
Link to this section Summary
Functions
This is a convenience method to help you create RSA public-key encrypted third-party caveats. You would use this when you have a well-known public key from the third-party server you wish to sent the caveate to.
This is a convenience method to help you decrypt a third-party caveat that has been encrypted by a RSA public key
Provided you know the private key, and length of the nonce you can unpack the cipher text into the 2 components: {discharge_root_key, predicate_to_validate}
Link to this section Functions
add_rsa_third_party_caveat(macaroon, location, predicate, public_key, nonce_len \\ 32)
Specs
add_rsa_third_party_caveat( Macaroon.Types.Macaroon.t(), binary(), binary(), :RSAPublicKey.t(), non_neg_integer() ) :: Macaroon.Types.Macaroon.t()
This is a convenience method to help you create RSA public-key encrypted third-party caveats. You would use this when you have a well-known public key from the third-party server you wish to sent the caveate to.
This method also takes care of generating a random nonce for the verification portion of the caveat.
decrypt_rsa_third_party_caveat(caveat, private_key)
Specs
decrypt_rsa_third_party_caveat(Macaroon.Types.Caveat.t(), :RSAPrivateKey.t()) :: binary()
decrypt_rsa_third_party_caveat(caveat, private_key, nonce_length)
Specs
decrypt_rsa_third_party_caveat( Macaroon.Types.Caveat.t(), :RSAPrivateKey.t(), non_neg_integer() ) :: {binary(), binary()}
This is a convenience method to help you decrypt a third-party caveat that has been encrypted by a RSA public key
Provided you know the private key, and length of the nonce you can unpack the cipher text into the 2 components: {discharge_root_key, predicate_to_validate}
If you do NOT know the nonce length it will simply return the decrypted cipher text.