-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
9 changed files
with
219 additions
and
157 deletions.
There are no files selected for viewing
File renamed without changes.
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
108 changes: 108 additions & 0 deletions
108
apps/authz/src/opa/rego/__test__/criteria/signMessage_test.rego
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,108 @@ | ||
package main | ||
|
||
import future.keywords.in | ||
|
||
test_checkSignMessage { | ||
signMessageRequest = { | ||
"action": "signTransaction", | ||
"intent": { | ||
"from": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", | ||
"type": "signMessage", | ||
"message": "Hello world!", | ||
}, | ||
} | ||
|
||
checkSignMessageIntent({"signMessage", "signRawMessage"}) with input as signMessageRequest | ||
with data.entities as entities | ||
|
||
signMessageEquals("Hello world!") with input as signMessageRequest | ||
with data.entities as entities | ||
|
||
signMessageContains("Hello") with input as signMessageRequest | ||
with data.entities as entities | ||
} | ||
|
||
test_checkSignRawPayload { | ||
signRawPayloadRequest = { | ||
"action": "signTransaction", | ||
"intent": { | ||
"from": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", | ||
"type": "signRawPayload", | ||
"payload": "Hello world!", | ||
}, | ||
} | ||
|
||
checkSignRawPayloadIntent({"signRawPayload"}) with input as signRawPayloadRequest | ||
with data.entities as entities | ||
|
||
signRawPayloadEquals("Hello world!") with input as signRawPayloadRequest | ||
with data.entities as entities | ||
|
||
signRawPayloadContains("Hello") with input as signRawPayloadRequest | ||
with data.entities as entities | ||
} | ||
|
||
test_checkSignTypedData { | ||
typedData = { | ||
"account": "0xA0Cf798816D4b9b9866b5330EEa46a18382f251e", | ||
"domain": { | ||
"name": "Ether Mail", | ||
"version": "1", | ||
"chainId": 1, | ||
"verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", | ||
}, | ||
"types": { | ||
"Person": [ | ||
{ | ||
"name": "name", | ||
"type": "string", | ||
}, | ||
{ | ||
"name": "wallet", | ||
"type": "address", | ||
}, | ||
], | ||
"Mail": [ | ||
{ | ||
"name": "from", | ||
"type": "Person", | ||
}, | ||
{ | ||
"name": "to", | ||
"type": "Person", | ||
}, | ||
{ | ||
"name": "contents", | ||
"type": "string", | ||
}, | ||
], | ||
}, | ||
"primaryType": "Mail", | ||
"message": { | ||
"from": { | ||
"name": "Cow", | ||
"wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", | ||
}, | ||
"to": { | ||
"name": "Bob", | ||
"wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", | ||
}, | ||
"contents": "Hello, Bob!", | ||
}, | ||
} | ||
|
||
signTypedDataRequest = { | ||
"action": "signTransaction", | ||
"intent": { | ||
"from": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", | ||
"type": "signTypedData", | ||
"typedData": typedData, | ||
}, | ||
} | ||
|
||
checkSignTypedDataIntent({"signTypedData"}) with input as signTypedDataRequest | ||
with data.entities as entities | ||
|
||
signTypedDataEquals(typedData) with input as signTypedDataRequest | ||
with data.entities as entities | ||
} |
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
File renamed without changes.
Oops, something went wrong.