"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
rc: implement core/obscure
Nick Craig-Woodbc17ca7ed986
diff --git a/fs/rc/internal.go b/fs/rc/internal.goindex 448cd2f95..6d8a296fd 100644--- a/fs/rc/internal.go+++ b/fs/rc/internal.go@@ -7,6 +7,7 @@ import ("runtime""github.com/ncw/rclone/fs"+ "github.com/ncw/rclone/fs/config/obscure""github.com/ncw/rclone/fs/version""github.com/pkg/errors")@@ -191,3 +192,34 @@ func rcVersion(in Params) (out Params, err error) {}return out, nil}++func init() {+ Add(Call{+ Path: "core/obscure",+ Fn: rcObscure,+ Title: "Obscures a string passed in.",+ Help: `+Pass a clear string and rclone will obscure it for the config file:+- clear - string++Returns+- obscured - string+`,+ })+}++// Return obscured string+func rcObscure(in Params) (out Params, err error) {+ clear, err := in.GetString("clear")+ if err != nil {+ return nil, err+ }+ obscured, err := obscure.Obscure(clear)+ if err != nil {+ return nil, err+ }+ out = Params{+ "obscured": obscured,+ }+ return out, nil+}diff --git a/fs/rc/internal_test.go b/fs/rc/internal_test.goindex 4cd133ffc..39789bdfd 100644--- a/fs/rc/internal_test.go+++ b/fs/rc/internal_test.go@@ -5,6 +5,7 @@ import ("testing""github.com/ncw/rclone/fs"+ "github.com/ncw/rclone/fs/config/obscure""github.com/ncw/rclone/fs/version""github.com/stretchr/testify/assert""github.com/stretchr/testify/require"@@ -93,3 +94,15 @@ func TestCoreVersion(t *testing.T) {v := out["decomposed"].(version.Version)assert.True(t, len(v) >= 2)}++func TestCoreObscure(t *testing.T) {+ call := Calls.Get("core/obscure")+ assert.NotNil(t, call)+ in := Params{+ "clear": "potato",+ }+ out, err := call.Fn(in)+ require.NoError(t, err)+ require.NotNil(t, out)+ assert.Equal(t, in["clear"], obscure.MustReveal(out["obscured"].(string)))+}