コード例 #1
0
        /// <summary>
        /// Converts the <see cref="EnvelopeKeyRecord"/> to a <see cref="JObject"/> format:
        /// <code>
        /// {
        ///   "Created": Creation time of the encrypted key,
        ///   "ParentKeyMeta": Parent key meta of the encrypted key(if present),
        ///   "Key": Encrypted Key,
        ///   "Revoked": True/False
        /// }
        /// </code>
        /// </summary>
        ///
        /// <returns>The <see cref="EnvelopeKeyRecord"/> converted to a <see cref="JObject"/>.</returns>
        public JObject ToJson()
        {
            Json json = new Json();

            json.Put("Created", Created);
            json.Put("Key", EncryptedKey);
            ParentKeyMeta.IfSome(keyMeta => json.Put("ParentKeyMeta", keyMeta.ToJson()));
            Revoked.IfSome(revoked => json.Put("Revoked", revoked));
            return(json.ToJObject());
        }