def getHash(password, publicSalt, privateSalt) return Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(password + publicSalt) + privateSalt) end def createUser(username, password) @publicSalt = SecureRandom.hex(64) @secretSalt = SecureRandom.hex(64) User.create(uuid: SecureRandom.uuid, username: username, publicSalt: @publicSalt, secretSalt: @secretSalt, passwordHash: getHash(password, @publicSalt, @secretSalt)) end createUser('admin', 'changeme') createUser('lukas', 'test') Authority.create(name:`hostname`.tr("\n", ''), signature: Rails.application.credentials.secret_key_base) Authority.create(name: 'thirdParty', signature: 'thirdPartyKKey')