Skip to content

Expose functionality underlying private cookies. #477

@dpc

Description

@dpc

Feature Requests

Expose new API: encrypt_private(&str) -> String and decrypt_private(&str) -> Result<String> or something like it, that would use the same scheme as private cookies do.

Why you believe this feature is necessary.

It's not necessary, but it would be useful to be able to use the same encryption that private cookies use on arbitrary data/strings. This way encrypted values can be embedded eg. in rendered forms to pass authenticated, unforgeable data.

A convincing use-case for this feature.

I'd like to embed an URL and some control data in one of my forms, to control some flow after form submission, and not have to worry about all the possible attack vectors. It would greatly simplify everything if I could trust that data was not tampered with. I can't put it in cookies since it's page, and not session, related.

Why this feature can't or shouldn't exist outside of Rocket.

Obviously, it can be done manually / through another library, but since Rocket already takes care of managing the encryption key, it would be much easier to just reuse it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    requestRequest for new functionality

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions