*Update build script

This commit is contained in:
Derrick Hammer 2022-08-22 11:47:27 -04:00
parent 245114caaf
commit 1e3b565b59
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 8 deletions

View File

@ -6,11 +6,11 @@ import {
b64ToBuf, b64ToBuf,
bufToHex, bufToHex,
deriveRegistryEntryID, deriveRegistryEntryID,
entryIDToSkylink,
generateSeedPhraseDeterministic, generateSeedPhraseDeterministic,
resolverLink, seedPhraseToSeed,
sha512, sha512,
taggedRegistryEntryKeys, taggedRegistryEntryKeys,
validSeedPhrase,
} from "libskynet" } from "libskynet"
import { generateSeedPhraseRandom, overwriteRegistryEntry, upload } from "libskynetnode" import { generateSeedPhraseRandom, overwriteRegistryEntry, upload } from "libskynetnode"
import read from "read" import read from "read"
@ -60,7 +60,7 @@ function writeFile(fileName: string, fileData: string): string | null {
function hardenedSeedPhrase(password: string): [string, string | null] { function hardenedSeedPhrase(password: string): [string, string | null] {
let pw = password let pw = password
// Add some hashing iterations to the password to make it stronger. // Add some hashing iterations to the password to make it stronger.
for(let i = 0; i < 1000000; i++) { for (let i = 0; i < 1000000; i++) {
let passU8 = new TextEncoder().encode(password) let passU8 = new TextEncoder().encode(password)
let hashIter = sha512(passU8) let hashIter = sha512(passU8)
password = bufToHex(hashIter) password = bufToHex(hashIter)
@ -71,7 +71,7 @@ function hardenedSeedPhrase(password: string): [string, string | null] {
// seedPhraseToRegistryKeys will convert a seed phrase to the set of registry // seedPhraseToRegistryKeys will convert a seed phrase to the set of registry
// keys that govern the registry entry where the module is published. // keys that govern the registry entry where the module is published.
function seedPhraseToRegistryKeys(seedPhrase: string): [any, Uint8Array, string | null] { function seedPhraseToRegistryKeys(seedPhrase: string): [any, Uint8Array, string | null] {
let [seed, errVSP] = validSeedPhrase(seedPhrase) let [seed, errVSP] = seedPhraseToSeed(seedPhrase)
if (errVSP !== null) { if (errVSP !== null) {
return [nkp, nu8, addContextToErr(errVSP, "unable to compute seed phrase")] return [nkp, nu8, addContextToErr(errVSP, "unable to compute seed phrase")]
} }
@ -93,10 +93,7 @@ function seedPhraseToRegistryLink(seedPhrase: string): [string, string | null] {
if (errDREID !== null) { if (errDREID !== null) {
return ["", addContextToErr(errDREID, "unable to compute registry entry id")] return ["", addContextToErr(errDREID, "unable to compute registry entry id")]
} }
let [registryLink, errRL] = resolverLink(entryID) let registryLink = entryIDToSkylink(entryID)
if (errRL !== null) {
return ["", addContextToErr(errRL, "unable to compute registry link")]
}
return [registryLink, null] return [registryLink, null]
} }