private string GetFoldername (SecureStorageRequest request) { var folderBytes = Encoding.UTF8.GetBytes ($"{request.Service}{request.Label}"); var retVal = Path.Combine (_BaseDirectory, $"{Misc.HexSHA1Digest (folderBytes)}"); Directory.CreateDirectory (retVal); return retVal; }
internal Status Compile(IDictionary <string, object> viewProps, string language) { language = language ?? "javascript"; string mapSource = viewProps.Get("map") as string; if (mapSource == null) { return(new Status(StatusCode.NotFound)); } MapDelegate mapDelegate = Compiler.CompileMap(mapSource, language); if (mapDelegate == null) { Log.To.View.W(TAG, "{0} could not compile {1} map fn: {2}", Name, language, new SecureLogString(mapSource, LogMessageSensitivity.PotentiallyInsecure)); return(new Status(StatusCode.CallbackError)); } string reduceSource = viewProps.Get("reduce") as string; ReduceDelegate reduceDelegate = null; if (reduceSource != null) { reduceDelegate = Compiler.CompileReduce(reduceSource, language); if (reduceDelegate == null) { Log.To.View.W(TAG, "{0} could not compile {1} reduce fn: {2}", Name, language, new SecureLogString(reduceSource, LogMessageSensitivity.PotentiallyInsecure)); return(new Status(StatusCode.CallbackError)); } } string version = Misc.HexSHA1Digest(Manager.GetObjectMapper().WriteValueAsBytes(viewProps)); SetMapReduce(mapDelegate, reduceDelegate, version); DocumentType = viewProps.GetCast <string>("documentType"); var options = viewProps.Get("options").AsDictionary <string, object>(); Collation = ViewCollation.Unicode; if (options != null && options.ContainsKey("collation")) { string collation = options["collation"] as string; if (collation.ToLower().Equals("raw")) { Collation = ViewCollation.Raw; } } return(new Status(StatusCode.Ok)); }
private string GetFilename(SecureStorageRequest request) { var filenameBytes = Encoding.UTF8.GetBytes($"{request.Account}"); return Path.Combine(GetFoldername(request), $"{Misc.HexSHA1Digest(filenameBytes)}.bin"); }
private string GetFilename(SecureStorageRequest request) { var filenameBytes = Encoding.UTF8.GetBytes($"{request.Service}{request.Label}{request.Account}"); return(Path.Combine(_BaseDirectory, $"{Misc.HexSHA1Digest(filenameBytes)}.bin")); }