-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add audio encryption/decryption utilities #573
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, this lgtm!
Co-authored-by: lukasIO <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, some question inline. Sorry for the late review.
unencrypted_audio_bytes = 1 | ||
) | ||
|
||
var ErrIncorrectKeyLength = errors.New("incorrect key length for encryption/decryption") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, very late on this review. In case you get a chance, suggest a style like
var (
Err1 =
Err2 =
)
That makes it easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I can change in the next PR, I was going to add example on how to use the utilities separately.
|
||
key, err := DeriveKeyFromBytes(inputSecret) | ||
assert.Nil(t, err) | ||
assert.Equal(t, expectedKey, key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we switch these to require
package? LK has been using it in other repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, I'll have a look
copy(cipherText, sample[cipherTextStart:cipherTextStart+cipherTextLength]) | ||
|
||
// setup AES | ||
aesCipher, err := aes.NewCipher(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any performance penalty to creating this for every sample? Can this be created in track context and re-used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to keep it as separate and self-contained as possible without the need to instantiate anything separately to use it. I believe the AES operations are highly optimized in Go with the use of Go Assembler, but I'll see if I can run a quick benchmark with and without the cipher reuse.
Added:
client-sdk-js
with the same inputsclient-sdk-js
Changed:
sifTrailer
from joinResponse so thatsifTrailer
can be passed later to Decryption utility