// RestrictedCopy creates an on-disk copy of the embedded security asset // with the provided path. The copy will be created in the provided directory. // Returns the path of the file and a cleanup function that will delete the file. // // The file will have restrictive file permissions (0600), making it // appropriate for usage by libraries that require security assets to have such // restrictive permissions. func RestrictedCopy(t util.Tester, path, tempdir, name string) string { contents, err := Asset(path) if err != nil { if t == nil { log.Fatal(context.TODO(), err) } else { t.Fatal(err) } } return util.CreateRestrictedFile(t, contents, tempdir, name) }