diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs index 88bcc201c66..06a43d079d3 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs @@ -3293,7 +3293,8 @@ decodeSharedTransaction -> ApiDecodeTransactionPostData -> Handler (ApiDecodedTransaction n) decodeSharedTransaction ctx (ApiT wid) postData = do - let (ApiDecodeTransactionPostData (ApiT sealed) _ ) = postData + let (ApiDecodeTransactionPostData (ApiT sealed) decryptMetadata ) = postData + when (isJust decryptMetadata) $ error "not implemented" era <- liftIO $ NW.currentNodeEra nl (txinsOutsPaths, collateralInsOutsPaths, outsPath, pp, certs, txId, fee , metadata, scriptValidity, interval, witsCount, withdrawals, rewardAcctM) @@ -3456,7 +3457,8 @@ decodeTransaction -> Handler (ApiDecodedTransaction n) decodeTransaction ctx@ApiLayer{..} (ApiT wid) postData = do - let (ApiDecodeTransactionPostData (ApiT sealed) _ ) = postData + let (ApiDecodeTransactionPostData (ApiT sealed) decryptMetadata ) = postData + when (isJust decryptMetadata) $ error "not implemented" era <- liftIO $ NW.currentNodeEra netLayer withWorkerCtx ctx wid liftE liftE $ \wrk -> do (k, _) <- liftHandler $ W.readPolicyPublicKey wrk diff --git a/specifications/api/metadata-encrypt.md b/specifications/api/metadata-encrypt.md index 3abb040f6ff..6ec89663fba 100644 --- a/specifications/api/metadata-encrypt.md +++ b/specifications/api/metadata-encrypt.md @@ -21,7 +21,7 @@ Specifically: In the `encrypt_metadata` field, passphrase used in encryption is established. `metadata` field to be encrypted is required. - Example `POST` data for the endpoint: + Example `POST` data for the endpoint, ie., /wallets/{walletId}/transactions-construct`: ``` { @@ -42,13 +42,19 @@ Specifically: ... } ``` - The same is the case for `GET` transaction. + The same is the case for `GET` transaction. `encrypt_metadata` is an object as we might want to introduce + optional choice of encryption method in the future. In that case the new enhancement to api will be introduced in + nonintrusive way. -2. Decoding transaction with encrypted metadata is possible by using the same passphrase as upon encryption in `encrypt_metadata` field. It is realized by calling `POST` on ` /wallets/{walletId}/transactions-decode` endpoint with `POST` data: + Metadata encryption can be used for shared wallet style when calling `/shared-wallets/{walletId}/transactions-construct` endpoint with the same `POST` payload. + +## Metadata decryption + +2. Decoding transaction with encrypted metadata is possible by using the same passphrase as upon encryption in `encrypt_metadata` field. It is realized by calling `POST` on `/wallets/{walletId}/transactions-decode` endpoint with `POST` data: ``` { - "encrypt_metadata": + "decrypt_metadata": { "passphrase": "my secret encryption password" }, "transaction": .... @@ -63,3 +69,5 @@ Specifically: ... } ``` + + Metadata decryption can be used for shared wallet style when calling `/shared-wallets/{walletId}/transactions-decode` endpoint with the same `POST` payload.