mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-09-13 14:29:09 +00:00
Add v5 Resource Metadata and Secret Structs, impl Handle Resource Get
for v5 Resources
This commit is contained in:
parent
2197d9e0f7
commit
d5f79a943f
3 changed files with 168 additions and 4 deletions
|
@ -6,8 +6,8 @@ import (
|
|||
"github.com/ProtonMail/gopenpgp/v3/crypto"
|
||||
)
|
||||
|
||||
// ResourceMetadataTypePasswordAndDescription
|
||||
type ResourceMetadataTypePasswordAndDescription struct {
|
||||
// ResourceMetadataTypeV5Default
|
||||
type ResourceMetadataTypeV5Default struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
@ -16,6 +16,35 @@ type ResourceMetadataTypePasswordAndDescription struct {
|
|||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceMetadataTypeV5DefaultWithTOTP
|
||||
type ResourceMetadataTypeV5DefaultWithTOTP struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
URIs []string `json:"uris,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceMetadataTypeV5PasswordString
|
||||
type ResourceMetadataTypeV5PasswordString struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
URIs []string `json:"uris,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceMetadataTypeV5TOTPStandalone
|
||||
type ResourceMetadataTypeV5TOTPStandalone struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
URIs []string `json:"uris,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) DecryptMetadata(metadataKey *crypto.Key, armoredCiphertext string) (string, error) {
|
||||
// TODO Get SessionKey from Cache
|
||||
var sessionKey *crypto.SessionKey = nil
|
||||
|
|
|
@ -41,6 +41,33 @@ type SecretDataTypePasswordDescriptionTOTP struct {
|
|||
TOTP SecretDataTOTP `json:"totp"`
|
||||
}
|
||||
|
||||
// SecretDataTypeV5Default
|
||||
type SecretDataTypeV5Default struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// SecretDataTypeV5DefaultWithTOTP
|
||||
type SecretDataTypeV5DefaultWithTOTP struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
TOTP SecretDataTOTP `json:"totp"`
|
||||
}
|
||||
|
||||
// SecretDataTypeV5PasswordString, is just the Password directly
|
||||
type SecretDataTypeV5PasswordString string
|
||||
|
||||
// SecretDataTypeV5TOTPStandalone
|
||||
type SecretDataTypeV5TOTPStandalone struct {
|
||||
ObjectType string `json:"object_type"`
|
||||
ResourceTypeID string `json:"resource_type_id,omitempty"`
|
||||
TOTP SecretDataTOTP `json:"totp"`
|
||||
}
|
||||
|
||||
// GetSecret gets a Passbolt Secret
|
||||
func (c *Client) GetSecret(ctx context.Context, resourceID string) (*Secret, error) {
|
||||
err := checkUUIDFormat(resourceID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue