Compare commits

...

4 Commits

4 changed files with 30 additions and 4 deletions

View File

@ -1,3 +1,10 @@
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-10-09)
### Bug Fixes
* translate seed phrase length into bits ([935675f](https://git.lumeweb.com/LumeWeb/sdk/commit/935675f7e8a33f87459d7fe817d260495948075b))
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-10-09) # [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-10-09)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@lumeweb/sdk", "name": "@lumeweb/sdk",
"version": "0.1.0-develop.6", "version": "0.1.0-develop.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lumeweb/sdk", "name": "@lumeweb/sdk",
"version": "0.1.0-develop.6", "version": "0.1.0-develop.7",
"dependencies": { "dependencies": {
"@lumeweb/kernel-network-registry-client": "0.1.0-develop.10", "@lumeweb/kernel-network-registry-client": "0.1.0-develop.10",
"@lumeweb/libkernel": "0.1.0-develop.65", "@lumeweb/libkernel": "0.1.0-develop.65",

View File

@ -1,6 +1,6 @@
{ {
"name": "@lumeweb/sdk", "name": "@lumeweb/sdk",
"version": "0.1.0-develop.6", "version": "0.1.0-develop.7",
"type": "module", "type": "module",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@ -20,6 +20,23 @@ async function seedToKey(seed: string) {
return bip39.mnemonicToSeed(seed); return bip39.mnemonicToSeed(seed);
} }
function getStrength(wordCount: number) {
switch (wordCount) {
case 12:
return 128;
case 15:
return 160;
case 18:
return 192;
case 21:
return 224;
case 24:
return 256;
default:
throw new Error("Invalid word count");
}
}
// Extracted components // Extracted components
const SubmitButtonComponent = () => { const SubmitButtonComponent = () => {
const { setVisibleComponent } = useSwitchableComponent(); const { setVisibleComponent } = useSwitchableComponent();
@ -101,7 +118,9 @@ const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => {
const { signIn } = useLumeIndentity(); const { signIn } = useLumeIndentity();
const phrases = useMemo(() => { const phrases = useMemo(() => {
return bip39.generateMnemonic(wordlist, phraseLength).split(" "); return bip39
.generateMnemonic(wordlist, getStrength(phraseLength))
.split(" ");
}, [phraseLength]); }, [phraseLength]);
const key = useMemo(() => { const key = useMemo(() => {