-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0200e3b
commit dee1e57
Showing
3 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package transport | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
|
||
"github.com/iden3/go-schema-processor/verifiable" | ||
"github.com/iden3/iden3comm/protocol" | ||
"github.com/iden3/iden3comm/transport/notification" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func SendAuthRequest( | ||
ctx context.Context, | ||
diddoc verifiable.DIDDocument, | ||
authMsg protocol.AuthorizationRequestMessage, | ||
) (*notification.UserNotificationResult, error) { | ||
authMsgBytes, err := json.Marshal(authMsg) | ||
if err != nil { | ||
return nil, errors.WithStack(err) | ||
} | ||
return notification.Notify( | ||
ctx, | ||
authMsgBytes, | ||
diddoc, | ||
nil, | ||
) | ||
} | ||
|
||
func SendContractInvokeRequest( | ||
ctx context.Context, | ||
diddoc verifiable.DIDDocument, | ||
contractInvokeMsg protocol.ContractInvokeRequestMessage, | ||
) (*notification.UserNotificationResult, error) { | ||
ciMsgBytes, err := json.Marshal(contractInvokeMsg) | ||
if err != nil { | ||
return nil, errors.WithStack(err) | ||
} | ||
return notification.Notify( | ||
ctx, | ||
ciMsgBytes, | ||
diddoc, | ||
nil, | ||
) | ||
} |