edge-core-js
Version:
Edge account & wallet management library
50 lines (40 loc) • 962 B
JavaScript
import { hmacSha256 } from '../../util/crypto/hashes'
import { base58, utf8 } from '../../util/encoding'
import { encryptDisklet } from './encrypt-disklet'
export function getStorageWalletLastChanges(
state,
walletId
) {
return state.storageWallets[walletId].lastChanges
}
export function getStorageWalletDisklet(
state,
walletId
) {
return state.storageWallets[walletId].paths.disklet
}
export function getStorageWalletLocalDisklet(
state,
walletId
) {
return state.storageWallets[walletId].localDisklet
}
export function makeStorageWalletLocalEncryptedDisklet(
state,
walletId,
io
) {
return encryptDisklet(
io,
state.storageWallets[walletId].paths.dataKey,
state.storageWallets[walletId].localDisklet
)
}
export function hashStorageWalletFilename(
state,
walletId,
data
) {
const dataKey = state.storageWallets[walletId].paths.dataKey
return base58.stringify(hmacSha256(utf8.parse(data), dataKey))
}