Skip to content

Commit

Permalink
more enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Nov 2, 2023
1 parent 58d87a9 commit 33489e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions specifications/api/metadata-encrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

```
{
Expand All @@ -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": ....
Expand All @@ -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.

0 comments on commit 33489e9

Please sign in to comment.