From 113f24f4d8a4fd7dca8108fcf76210bf2f3eeaf3 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 18 Jan 2024 10:01:56 -0500 Subject: [PATCH] fix: need to update directory struct so that EncryptionKey is nullable, and URI and Key are omitted if empty --- metadata/directory_reference.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata/directory_reference.go b/metadata/directory_reference.go index 29ac727..5981f42 100644 --- a/metadata/directory_reference.go +++ b/metadata/directory_reference.go @@ -12,20 +12,20 @@ type DirectoryReference struct { Name string `json:"name"` EncryptedWriteKey Base64UrlBinary `json:"encryptedWriteKey,string"` PublicKey Base64UrlBinary `json:"publicKey,string"` - EncryptionKey Base64UrlBinary `json:"encryptionKey,string"` + EncryptionKey *Base64UrlBinary `json:"encryptionKey,string"` Ext map[string]interface{} `json:"ext"` - URI string `json:"uri"` - Key string `json:"key"` + URI string `json:"uri,omitempty"` + Key string `json:"key,omitempty"` Size int64 `json:"size"` } -func NewDirectoryReference(created uint64, name string, encryptedWriteKey, publicKey, encryptionKey []byte, ext map[string]interface{}) *DirectoryReference { +func NewDirectoryReference(created uint64, name string, encryptedWriteKey, publicKey, encryptionKey Base64UrlBinary, ext map[string]interface{}) *DirectoryReference { return &DirectoryReference{ Created: created, Name: name, EncryptedWriteKey: encryptedWriteKey, PublicKey: publicKey, - EncryptionKey: encryptionKey, + EncryptionKey: &encryptionKey, Ext: ext, URI: "", Key: "", @@ -80,7 +80,7 @@ func (dr *DirectoryReference) DecodeMsgpack(dec *msgpack.Decoder) error { case int8(4): dr.EncryptedWriteKey = value.([]byte) case int8(5): - dr.EncryptionKey = value.([]byte) + dr.EncryptionKey = value.(*Base64UrlBinary) case int8(6): dr.Ext = value.(map[string]interface{}) }