Made message signing in Cryptography use SHA512 as the message content for... #1

Closed
netkas wants to merge 421 commits from master into dev
5 changed files with 43 additions and 21 deletions
Showing only changes of commit 34b31c58a8 - Show all commits

8
.env
View file

@ -28,9 +28,9 @@ REDIS_PASSWORD=root
# Test Configuration, can be ignored. Used for docker-compose-test.yml # Test Configuration, can be ignored. Used for docker-compose-test.yml
SB_COFFEE_NAME=coffee SB_COFFEE_NAME=coffee
SB_COFFEE_DOMAIN=coffee.com SB_COFFEE_DOMAIN=coffee.com
SB_COFFEE_RPC_ENDPOINT=http://127.0.0.0:8086/ SB_COFFEE_RPC_ENDPOINT=http://coffee_socialbox:8085/
SB_INSTANCE_DNS_MOCK_COFFEE="coffee.com v=socialbox;sb-rpc=http://127.0.0.0:8086/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0" SB_INSTANCE_DNS_MOCK_COFFEE="coffee.com v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"
SB_TEAPOT_DOMAIN=teapot.com SB_TEAPOT_DOMAIN=teapot.com
SB_TEAPOT_RPC_ENDPOINT=http://127.0.0.0:8087/ SB_TEAPOT_RPC_ENDPOINT=http://teapot_socialbox:8085/
SB_INSTANCE_DNS_MOCK_TEAPOT="teapot.com v=socialbox;sb-rpc=http://127.0.0.0:8087/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0" SB_INSTANCE_DNS_MOCK_TEAPOT="teapot.com v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"

View file

@ -3,10 +3,10 @@
"enabled": true, "enabled": true,
"name": "coffee", "name": "coffee",
"domain": "coffee.com", "domain": "coffee.com",
"rpc_endpoint": "http://127.0.0.0:8086/", "rpc_endpoint": "http://coffee_socialbox:8085/",
"dns_mocks": { "dns_mocks": {
"teapot.com": "v=socialbox;sb-rpc=http://127.0.0.0:8087/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0", "teapot.com": "v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0",
"coffee.com": "v=socialbox;sb-rpc=http://127.0.0.0:8086/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0" "coffee.com": "v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"
} }
}, },
"security": { "security": {

View file

@ -19,6 +19,7 @@ services:
condition: service_healthy condition: service_healthy
networks: networks:
- coffee_network - coffee_network
- shared_network
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./coffee_socialbox/config:/etc/config - ./coffee_socialbox/config:/etc/config
@ -34,7 +35,7 @@ services:
# Change these values to match your environment or update the .env file # Change these values to match your environment or update the .env file
SB_INSTANCE_NAME: ${SB_COFFEE_NAME:-coffee} # Instance name SB_COFFEE_NAME SB_INSTANCE_NAME: ${SB_COFFEE_NAME:-coffee} # Instance name SB_COFFEE_NAME
SB_INSTANCE_DOMAIN: ${SB_COFFEE_DOMAIN:-coffee.com} # Instance domain SB_COFFEE_DOMAIN SB_INSTANCE_DOMAIN: ${SB_COFFEE_DOMAIN:-coffee.com} # Instance domain SB_COFFEE_DOMAIN
SB_INSTANCE_RPC_ENDPOINT: ${SB_COFFEE_RPC_ENDPOINT:-http://127.0.0.0:8086/} # Instance RPC endpoint SB_COFFEE_RPC_ENDPOINT SB_INSTANCE_RPC_ENDPOINT: ${SB_COFFEE_RPC_ENDPOINT:-http://coffee_socialbox:8085/} # Instance RPC endpoint SB_COFFEE_RPC_ENDPOINT
SB_LOGGING_CONSOLE_ENABLED: ${SB_LOGGING_CONSOLE_ENABLED:-true} SB_LOGGING_CONSOLE_ENABLED: ${SB_LOGGING_CONSOLE_ENABLED:-true}
SB_LOGGING_CONSOLE_LEVEL: ${SB_LOGGING_CONSOLE_LEVEL:-debug} SB_LOGGING_CONSOLE_LEVEL: ${SB_LOGGING_CONSOLE_LEVEL:-debug}
SB_LOGGING_FILE_ENABLED: ${SB_LOGGING_FILE_ENABLED:-true} SB_LOGGING_FILE_ENABLED: ${SB_LOGGING_FILE_ENABLED:-true}
@ -59,10 +60,10 @@ services:
# Usage: SB_INSTANCE_DNS_MOCK_<INSTANCE_NAME>: <DOMAIN> <TXT_RECORD> # Usage: SB_INSTANCE_DNS_MOCK_<INSTANCE_NAME>: <DOMAIN> <TXT_RECORD>
# Environment Variable name is ignored, only the value is used with the prefix being used to detect # Environment Variable name is ignored, only the value is used with the prefix being used to detect
# the instance name and the suffix being used to detect the TXT record # the instance name and the suffix being used to detect the TXT record
SB_INSTANCE_DNS_MOCK_COFFEE: ${SB_INSTANCE_DNS_MOCK_COFFEE:-"coffee.com v=socialbox;sb-rpc=http://127.0.0.0:8086/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"} SB_INSTANCE_DNS_MOCK_COFFEE: ${SB_INSTANCE_DNS_MOCK_COFFEE:-"coffee.com v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"}
SB_INSTANCE_DNS_MOCK_TEAPOT: ${SB_INSTANCE_DNS_MOCK_TEAPOT:-"teapot.com v=socialbox;sb-rpc=http://127.0.0.0:8087/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"} SB_INSTANCE_DNS_MOCK_TEAPOT: ${SB_INSTANCE_DNS_MOCK_TEAPOT:-"teapot.com v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"}
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "-H", "Request-Type: ping", "${SB_INSTANCE_RPC_ENDPOINT-http://127.0.0.0:8086/}"] test: ["CMD", "curl", "-f", "-H", "Request-Type: ping", "${SB_INSTANCE_RPC_ENDPOINT-http://coffee_socialbox:8085/}"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
@ -122,6 +123,7 @@ services:
condition: service_healthy condition: service_healthy
networks: networks:
- teapot_network - teapot_network
- shared_network
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./teapot_socialbox/config:/etc/config - ./teapot_socialbox/config:/etc/config
@ -137,7 +139,7 @@ services:
# Change these values to match your environment or update the .env file # Change these values to match your environment or update the .env file
SB_INSTANCE_NAME: ${SB_TEAPOT_NAME:-teapot} # Instance name SB_TEAPOT_NAME SB_INSTANCE_NAME: ${SB_TEAPOT_NAME:-teapot} # Instance name SB_TEAPOT_NAME
SB_INSTANCE_DOMAIN: ${SB_TEAPOT_DOMAIN:-teapot.com} # Instance domain SB_TEAPOT_DOMAIN SB_INSTANCE_DOMAIN: ${SB_TEAPOT_DOMAIN:-teapot.com} # Instance domain SB_TEAPOT_DOMAIN
SB_INSTANCE_RPC_ENDPOINT: ${SB_TEAPOT_RPC_ENDPOINT:-http://127.0.0.0:8087/} # Instance RPC endpoint SB_TEAPOT_RPC_ENDPOINT SB_INSTANCE_RPC_ENDPOINT: ${SB_TEAPOT_RPC_ENDPOINT:-http://teapot_socialbox:8085/} # Instance RPC endpoint SB_TEAPOT_RPC_ENDPOINT
SB_LOGGING_CONSOLE_ENABLED: ${SB_LOGGING_CONSOLE_ENABLED:-true} SB_LOGGING_CONSOLE_ENABLED: ${SB_LOGGING_CONSOLE_ENABLED:-true}
SB_LOGGING_CONSOLE_LEVEL: ${SB_LOGGING_CONSOLE_LEVEL:-debug} SB_LOGGING_CONSOLE_LEVEL: ${SB_LOGGING_CONSOLE_LEVEL:-debug}
SB_LOGGING_FILE_ENABLED: ${SB_LOGGING_FILE_ENABLED:-true} SB_LOGGING_FILE_ENABLED: ${SB_LOGGING_FILE_ENABLED:-true}
@ -162,10 +164,10 @@ services:
# Usage: SB_INSTANCE_DNS_MOCK_<INSTANCE_NAME>: <DOMAIN> <TXT_RECORD> # Usage: SB_INSTANCE_DNS_MOCK_<INSTANCE_NAME>: <DOMAIN> <TXT_RECORD>
# Environment Variable name is ignored, only the value is used with the prefix being used to detect # Environment Variable name is ignored, only the value is used with the prefix being used to detect
# the instance name and the suffix being used to detect the TXT record # the instance name and the suffix being used to detect the TXT record
SB_INSTANCE_DNS_MOCK_COFFEE: ${SB_INSTANCE_DNS_MOCK_COFFEE:-"coffee.com v=socialbox;sb-rpc=http://127.0.0.0:8086/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"} SB_INSTANCE_DNS_MOCK_COFFEE: ${SB_INSTANCE_DNS_MOCK_COFFEE:-"coffee.com v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"}
SB_INSTANCE_DNS_MOCK_TEAPOT: ${SB_INSTANCE_DNS_MOCK_TEAPOT:-"teapot.com v=socialbox;sb-rpc=http://127.0.0.0:8087/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"} SB_INSTANCE_DNS_MOCK_TEAPOT: ${SB_INSTANCE_DNS_MOCK_TEAPOT:-"teapot.com v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"}
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "-H", "Request-Type: ping", "${SB_INSTANCE_RPC_ENDPOINT-http://127.0.0.0:8087/}"] test: ["CMD", "curl", "-f", "-H", "Request-Type: ping", "${SB_INSTANCE_RPC_ENDPOINT-http://teapot_socialbox:8085/}"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
@ -226,4 +228,6 @@ networks:
name: teapot_network name: teapot_network
coffee_network: coffee_network:
driver: bridge driver: bridge
name: coffee_network name: coffee_network
shared_network:
driver: bridge

View file

@ -3,10 +3,10 @@
"enabled": true, "enabled": true,
"name": "teapot", "name": "teapot",
"domain": "teapot.com", "domain": "teapot.com",
"rpc_endpoint": "http://127.0.0.0:8087/", "rpc_endpoint": "http://teapot_socialbox:8085/",
"dns_mocks": { "dns_mocks": {
"teapot.com": "v=socialbox;sb-rpc=http://127.0.0.0:8087/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0", "teapot.com": "v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0",
"coffee.com": "v=socialbox;sb-rpc=http://127.0.0.0:8086/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0" "coffee.com": "v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"
} }
}, },
"security": { "security": {

View file

@ -39,9 +39,17 @@
return 'user' . $randomString . '@' . $domain; return 'user' . $randomString . '@' . $domain;
} }
public function testConnection() :void private static function registerUser(string $domain): SocialClient
{ {
$coffeeClient = new SocialClient(self::generateUsername('intvo.id')); $client = new SocialClient(self::generateUsername($domain));
$client->settingsSetPassword("password");
$client->settingsSetDisplayName("Example User");
return $client;
}
public function testRegistration(): void
{
$coffeeClient = new SocialClient(self::generateUsername(self::COFFEE_DOMAIN));
// Check initial session state // Check initial session state
$this->assertFalse($coffeeClient->getSessionState()->isAuthenticated()); $this->assertFalse($coffeeClient->getSessionState()->isAuthenticated());
@ -58,4 +66,14 @@
$this->assertFalse($coffeeClient->getSessionState()->containsFlag(SessionFlags::REGISTRATION_REQUIRED)); $this->assertFalse($coffeeClient->getSessionState()->containsFlag(SessionFlags::REGISTRATION_REQUIRED));
$this->assertTrue($coffeeClient->getSessionState()->isAuthenticated()); $this->assertTrue($coffeeClient->getSessionState()->isAuthenticated());
} }
public function testResolveDecentralizedPeer(): void
{
$coffeeUser = self::registerUser(self::COFFEE_DOMAIN);
$this->assertTrue($coffeeUser->getSessionState()->isAuthenticated());
$teapotUser = self::registerUser(self::TEAPOT_DOMAIN);
$this->assertTrue($teapotUser->getSessionState()->isAuthenticated());
$coffeePeer = $coffeeUser->resolvePeer($teapotUser->getIdentifiedAs());
}
} }