Skip to content

Add secret key Stream#144

Merged
Kleidukos merged 10 commits intomainfrom
141-add-secret-stream-api-to-sel
Feb 20, 2024
Merged

Add secret key Stream#144
Kleidukos merged 10 commits intomainfrom
141-add-secret-stream-api-to-sel

Conversation

@Kleidukos
Copy link
Copy Markdown
Member

closes #141

@domenkozar
Copy link
Copy Markdown

Nonce is managed by the lower level?

@Kleidukos Kleidukos force-pushed the 141-add-secret-stream-api-to-sel branch from 68a04b5 to af514dd Compare February 7, 2024 10:19
@Kleidukos
Copy link
Copy Markdown
Member Author

@domenkozar Absolutely, as said here: https://doc.libsodium.org/secret-key_cryptography/secretstream#algorithm

Initialization (secretstream_init): a subkey k and a 64-bit nonce n are derived from a key K and a 192-bit random nonce N, using the same algorithm as XChaCha20

libsodium handles this for us. :)

@Kleidukos Kleidukos marked this pull request as ready for review February 16, 2024 10:58
@Kleidukos
Copy link
Copy Markdown
Member Author

Okay, here is the provisional API:

Screenshot 2024-02-16 at 11-57-55 Sel SecretKey Stream

@Kleidukos Kleidukos requested a review from kozross February 20, 2024 13:13
@Kleidukos Kleidukos force-pushed the 141-add-secret-stream-api-to-sel branch from 64184c3 to 910072d Compare February 20, 2024 13:18
@kozross kozross self-requested a review February 20, 2024 18:00
@Kleidukos Kleidukos merged commit b63fe1f into main Feb 20, 2024
@Kleidukos Kleidukos deleted the 141-add-secret-stream-api-to-sel branch February 20, 2024 20:43
Comment on lines +343 to +345
secretKeyFromHexByteString :: Base16 StrictByteString -> Either Text SecretKey
secretKeyFromHexByteString hexSecretKey = unsafeDupablePerformIO $
case Base16.decodeBase16Untyped (Base16.extractBase16 hexSecretKey) of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for digging this up from the past, but I'm a bit confused by this and just wanted to see if there's some context I'm missing.

Why do we call decodeBase16Untyped . extractBase16 on a Base16 StrictByteString when we could use decodeBase16?

If the value is a Base16 a, shouldn't we assume that it's already Base16-encoded and we can use decodeBase16?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this is weird. I'll go over it later. Thanks!

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.

Add SecretStream API to sel

4 participants