-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from serenity-kit/hkdf
feat: add hkdf 256
- Loading branch information
Showing
11 changed files
with
205 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
example/src/tests/_unstable_crypto_kdf_hkdf_sha256_expand_test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { _unstable_crypto_kdf_hkdf_sha256_expand } from 'react-native-libsodium'; | ||
import { expect, test } from '../utils/testRunner'; | ||
|
||
test('_unstable_crypto_kdf_hkdf_sha256_expand_test', () => { | ||
const key = new Uint8Array([ | ||
75, 222, 64, 255, 217, 41, 81, 229, 21, 194, 0, 72, 125, 254, 2, 182, 113, | ||
28, 24, 1, 227, 2, 226, 196, 127, 221, 56, 72, 15, 126, 128, 30, | ||
]); | ||
|
||
expect( | ||
_unstable_crypto_kdf_hkdf_sha256_expand(key, 'some_context', 32) | ||
).toEqual( | ||
new Uint8Array([ | ||
94, 202, 158, 208, 160, 172, 67, 223, 68, 62, 180, 53, 79, 68, 173, 141, | ||
136, 4, 177, 112, 84, 31, 14, 18, 40, 35, 230, 251, 53, 81, 81, 151, | ||
]) | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
example/src/tests/_unstable_crypto_kdf_hkdf_sha256_extract_test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { _unstable_crypto_kdf_hkdf_sha256_extract } from 'react-native-libsodium'; | ||
import { expect, test } from '../utils/testRunner'; | ||
|
||
test('_unstable_crypto_kdf_hkdf_sha256_extract_test', () => { | ||
const key = new Uint8Array([ | ||
75, 222, 64, 255, 217, 41, 81, 229, 21, 194, 0, 72, 125, 254, 2, 182, 113, | ||
28, 24, 1, 227, 2, 226, 196, 127, 221, 56, 72, 15, 126, 128, 30, | ||
]); | ||
|
||
const salt = new Uint8Array([ | ||
75, 222, 64, 255, 217, 41, 81, 229, 21, 194, 0, 72, 125, 254, 2, 182, 113, | ||
28, 24, 1, 227, 2, 226, 196, 127, 221, 56, 72, 15, 126, 128, 30, | ||
]); | ||
|
||
expect(_unstable_crypto_kdf_hkdf_sha256_extract(key, salt)).toEqual( | ||
new Uint8Array([ | ||
96, 198, 77, 78, 235, 17, 136, 179, 112, 240, 235, 48, 24, 198, 36, 27, | ||
180, 72, 174, 165, 180, 1, 95, 228, 38, 21, 51, 60, 114, 37, 20, 108, | ||
]) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1754,6 +1754,11 @@ | |
dependencies: | ||
eslint-scope "5.1.1" | ||
|
||
"@noble/hashes@^1.3.2": | ||
version "1.3.2" | ||
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" | ||
integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== | ||
|
||
"@nodelib/[email protected]": | ||
version "2.1.5" | ||
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" | ||
|