Add v5 Resource Metadata and Secret Structs, impl Handle Resource Get

for v5 Resources
This commit is contained in:
Samuel Lorch 2025-04-07 16:04:27 +02:00
parent 2197d9e0f7
commit d5f79a943f
3 changed files with 168 additions and 4 deletions

View file

@ -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