github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/encrypt/none.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 // Copyright 2019 Drone IO, Inc. 7 // 8 // Licensed under the Apache License, Version 2.0 (the "License"); 9 // you may not use this file except in compliance with the License. 10 // You may obtain a copy of the License at 11 // 12 // http://www.apache.org/licenses/LICENSE-2.0 13 // 14 // Unless required by applicable law or agreed to in writing, software 15 // distributed under the License is distributed on an "AS IS" BASIS, 16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 // See the License for the specific language governing permissions and 18 // limitations under the License. 19 20 package encrypt 21 22 // none is an encryption strategy that stores secret 23 // values in plain text. This is the default strategy 24 // when no key is specified. 25 type None struct{} 26 27 func (*None) Encrypt(plaintext string) ([]byte, error) { 28 return []byte(plaintext), nil 29 } 30 31 func (*None) Decrypt(ciphertext []byte) (string, error) { 32 return string(ciphertext), nil 33 }