Skip to content

Commit

Permalink
Merge pull request #45 from ashcherbakov/forward-msg
Browse files Browse the repository at this point in the history
add ForwardMessage
  • Loading branch information
ashcherbakov authored Oct 15, 2021
2 parents f423863 + 566ea5b commit 476fc3e
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 228 deletions.
27 changes: 25 additions & 2 deletions lib/src/main/kotlin/org/didcommx/didcomm/DIDComm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class DIDComm(private val didDocResolver: DIDDocResolver, private val secretReso
* and it is the format used in the DIDComm spec to give examples of headers and other internals.
* Depending on ambient security, plaintext may or may not be an appropriate format for DIDComm data at rest.
*
* @throws DIDCommException if pack can not be done, in particular:
* - DIDDocException If a DID or DID URL (for example a key ID) can not be resolved to a DID Doc.
* - SecretNotFoundException If there is no secret for the given DID or DID URL (key ID)
* - DIDCommIllegalArgumentException If invalid input is provided.
*
* @param params Pack Plaintext Parameters.
* @return Result of Pack Plaintext Operation.
*/
Expand Down Expand Up @@ -76,6 +81,12 @@ class DIDComm(private val didDocResolver: DIDDocResolver, private val secretReso
* verification method identified by the given key ID is used.
*
* @param params Pack Signed Parameters.
*
* @throws DIDCommException if pack can not be done, in particular:
* - DIDDocException If a DID or DID URL (for example a key ID) can not be resolved to a DID Doc.
* - SecretNotFoundException If there is no secret for the given DID or DID URL (key ID)
* - DIDCommIllegalArgumentException If invalid input is provided.
*
* @return Result of Pack Signed Operation.
*/
fun packSigned(params: PackSignedParams): PackSignedResult {
Expand Down Expand Up @@ -140,6 +151,12 @@ class DIDComm(private val didDocResolver: DIDDocResolver, private val secretReso
* - If [PackEncryptedParams.signFrom] is a key ID, then the sender's [DIDDoc.authentications]
* verification method identified by the given key ID is used.
*
* @throws DIDCommException if pack can not be done, in particular:
* - DIDDocException If a DID or DID URL (for example a key ID) can not be resolved to a DID Doc.
* - SecretNotFoundException If there is no secret for the given DID or DID URL (key ID)
* - DIDCommIllegalArgumentException If invalid input is provided.
* - IncompatibleCryptoException If the sender and target crypto is not compatible (for example, there are no compatible keys for key agreement)
*
* @param params Pack Encrypted Parameters.
* @return Result of pack encrypted operation.
*/
Expand Down Expand Up @@ -182,9 +199,15 @@ class DIDComm(private val didDocResolver: DIDDocResolver, private val secretReso
}

/**
* Unpacks the packed DIDComm message by doing decryption and verifying the signatures.
* Unpacks the packed DIDComm message by doing decryption and verifying the signatures.
*
* @param params Unpack Parameters.
*
* @throws DIDCommException if unpack can not be done, in particular:
* - MalformedMessageException if the message is invalid (can not be decrypted, signature is invalid, the plaintext is invalid, etc.)
* - DIDDocException If a DID or DID URL (for example a key ID) can not be resolved to a DID Doc.
* - SecretNotFoundException If there is no secret for the given DID or DID URL (key ID)
*
* @param params Unpack Parameters.
* @return Result of Unpack Operation.
*/
fun unpack(params: UnpackParams): UnpackResult {
Expand Down
Loading

0 comments on commit 476fc3e

Please # to comment.