Skip to content

Comments

Display whether escrowed secret is newly created or not#148

Merged
grahamgilbert merged 2 commits intograhamgilbert:masterfrom
aysiu:newly_updated
Jan 16, 2026
Merged

Display whether escrowed secret is newly created or not#148
grahamgilbert merged 2 commits intograhamgilbert:masterfrom
aysiu:newly_updated

Conversation

@aysiu
Copy link
Contributor

@aysiu aysiu commented Jan 2, 2026

Details of PR

This obviously isn't necessary for core functionality, but it is just more interesting information to get back when escrowing a key (is it a new key, or are you just escrowing the old one again?).

Testing Done

First time escrowing returns true for newly_created:

NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY2&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "newly_created": true}

Subsequent escrows return false:

NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY2&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "newly_created": false}
NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY2&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "newly_created": false}

Same happens for another key:

NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY3&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "newly_created": true}
NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY3&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "newly_created": false}

In total, only two key entries:
Screenshot 2026-01-01 at 23 01 27

@grahamgilbert
Copy link
Owner

I like the idea, but I don’t love the key name you’ve chosen. What is newly created? I’d suggest secret_saved instead.

@aysiu
Copy link
Contributor Author

aysiu commented Jan 5, 2026

I like the idea, but I don’t love the key name you’ve chosen. What is newly created? I’d suggest secret_saved instead.

Good point. I hear what you're saying, but I think secret_saved could potentially alarm people who think the secrets aren't being saved. Yes, technically, if it's an existing secret, it won't be re-saved, but I can see new users of Crypt perhaps panicking that secret_saved: false means their Crypt setup is broken somehow.

What do you think about new_secret_added or new_secret_escrowed?

@grahamgilbert
Copy link
Owner

Either of those seem reasonable to me.

@aysiu
Copy link
Contributor Author

aysiu commented Jan 5, 2026

Thanks! Just pushed another commit.

Testing Done...

First curl says it's a new secret escrowed...

NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY4&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "new_secret_escrowed": true}

Subsequent curls say it's not a new secret escrowed:

NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY4&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "new_secret_escrowed": false}
NAMEOFHOST:~$ curl -d "serial=ACTUALSERIALNUMB&secret_type=recovery_key&recovery_password=NEWRECOVERYKEY4&username=ACTUALUSERNAME"  http://localhost:8000/checkin/
{"serial": "ACTUALSERIALNUMB", "username": "ACTUALUSERNAME", "rotation_required": false, "new_secret_escrowed": false}

@grahamgilbert grahamgilbert merged commit 042f680 into grahamgilbert:master Jan 16, 2026
0 of 2 checks passed
@aysiu aysiu deleted the newly_updated branch January 16, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants