-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from corelayer/0.1.0-dev.20230314
0.1.0 dev.20240314
- Loading branch information
Showing
18 changed files
with
240 additions
and
27 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2024 CoreLayer BV | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package certificates | ||
|
||
import ( | ||
"github.com/corelayer/go-cryptostruct/pkg/cryptostruct" | ||
) | ||
|
||
type Passphrase struct { | ||
Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty" secure:"false"` | ||
Value string `json:"value,omitempty" yaml:"value,omitempty" mapstructure:"value,omitempty" secure:"true"` | ||
} | ||
|
||
func (c Passphrase) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Passphrase{}, | ||
Encrypted: SecurePassphrase{}, | ||
} | ||
} | ||
|
||
type SecurePassphrase struct { | ||
Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty" secure:"false"` | ||
Value string `json:"value,omitempty" yaml:"value,omitempty" mapstructure:"value,omitempty" secure:"true"` | ||
CryptoParams cryptostruct.CryptoParams `json:"cryptoParams" yaml:"cryptoParams" mapstructure:"cryptoParams"` | ||
} | ||
|
||
func (s SecurePassphrase) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Passphrase{}, | ||
Encrypted: SecurePassphrase{}, | ||
} | ||
} | ||
|
||
func (s SecurePassphrase) GetCryptoParams() cryptostruct.CryptoParams { | ||
return s.CryptoParams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2024 CoreLayer BV | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package certificates | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/corelayer/go-cryptostruct/pkg/cryptostruct" | ||
|
||
"github.com/corelayer/go-registry/pkg/registry/certificates/acme" | ||
) | ||
|
||
type Registry struct { | ||
Acme acme.Registry `json:"acme,omitempty" yaml:"acme,omitempty" mapstructure:"acme,omitempty" secure:"true"` | ||
Passphrases []Passphrase `json:"passphrases,omitempty" yaml:"passphrases,omitempty" mapstructure:"passphrases,omitempty" secure:"true"` | ||
} | ||
|
||
func (r Registry) GetPassphraseByName(name string) (Passphrase, error) { | ||
for _, p := range r.Passphrases { | ||
if p.Name == name { | ||
return p, nil | ||
} | ||
} | ||
return Passphrase{}, fmt.Errorf("could not find passphrase %s", name) | ||
} | ||
|
||
func (r Registry) GetPassphraseNames() []string { | ||
names := make([]string, len(r.Passphrases)) | ||
for _, p := range r.Passphrases { | ||
names = append(names, p.Name) | ||
} | ||
return names | ||
} | ||
|
||
func (r Registry) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Registry{}, | ||
Encrypted: SecureRegistry{}, | ||
} | ||
} | ||
|
||
type SecureRegistry struct { | ||
Acme acme.SecureRegistry `json:"acme,omitempty" yaml:"acme,omitempty" mapstructure:"acme,omitempty" secure:"true"` | ||
Passphrases []SecurePassphrase `json:"passphrases,omitempty" yaml:"passphrases,omitempty" mapstructure:"passphrases,omitempty" secure:"true"` | ||
CryptoParams cryptostruct.CryptoParams `json:"cryptoParams" yaml:"cryptoParams" mapstructure:"cryptoParams"` | ||
} | ||
|
||
func (s SecureRegistry) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Registry{}, | ||
Encrypted: SecureRegistry{}, | ||
} | ||
} | ||
|
||
func (s SecureRegistry) GetCryptoParams() cryptostruct.CryptoParams { | ||
return s.CryptoParams | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2024 CoreLayer BV | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package machines | ||
|
||
import ( | ||
"github.com/corelayer/go-cryptostruct/pkg/cryptostruct" | ||
|
||
"github.com/corelayer/go-registry/pkg/registry/machines/netscaler" | ||
) | ||
|
||
type Registry struct { | ||
NetScaler netscaler.Registry `json:"netscaler,omitempty" yaml:"netscaler,omitempty" mapstructure:"netscaler,omitempty" secure:"true"` | ||
} | ||
|
||
func (r Registry) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Registry{}, | ||
Encrypted: SecureRegistry{}, | ||
} | ||
} | ||
|
||
type SecureRegistry struct { | ||
NetScaler netscaler.SecureRegistry `json:"netscaler,omitempty" yaml:"netscaler,omitempty" mapstructure:"netscaler,omitempty" secure:"true"` | ||
CryptoParams cryptostruct.CryptoParams `json:"cryptoParams" yaml:"cryptoParams" mapstructure:"cryptoParams"` | ||
} | ||
|
||
func (s SecureRegistry) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Registry{}, | ||
Encrypted: SecureRegistry{}, | ||
} | ||
} | ||
|
||
func (s SecureRegistry) GetCryptoParams() cryptostruct.CryptoParams { | ||
return s.CryptoParams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2024 CoreLayer BV | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package registry | ||
|
||
import ( | ||
"github.com/corelayer/go-cryptostruct/pkg/cryptostruct" | ||
) | ||
|
||
type Organization struct { | ||
Name string `json:"name" yaml:"name" mapstructure:"name" secure:"false"` | ||
Registry Registry `json:"registry,omitempty" yaml:"registry,omitempty" mapstructure:"registry,omitempty" secure:"true"` | ||
} | ||
|
||
func (o Organization) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Organization{}, | ||
Encrypted: SecureOrganization{}, | ||
} | ||
} | ||
|
||
type SecureOrganization struct { | ||
Name string `json:"name" yaml:"name" mapstructure:"name" secure:"false"` | ||
Registry SecureRegistry `json:"registry,omitempty" yaml:"registry,omitempty" mapstructure:"registry,omitempty" secure:"true"` | ||
CryptoParams cryptostruct.CryptoParams `json:"cryptoParams" yaml:"cryptoParams" mapstructure:"cryptoParams"` | ||
} | ||
|
||
func (s SecureOrganization) GetTransformConfig() cryptostruct.TransformConfig { | ||
return cryptostruct.TransformConfig{ | ||
Decrypted: Organization{}, | ||
Encrypted: SecureOrganization{}, | ||
} | ||
} | ||
|
||
func (s SecureOrganization) GetCryptoParams() cryptostruct.CryptoParams { | ||
return s.CryptoParams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters