New gatekeeper protocol
This commit is contained in:
parent
4e2db5b17b
commit
ab85a1f078
|
@ -19,10 +19,10 @@ Start a Syndicate broker (such as
|
|||
|
||||
Find the line of broker output giving the root capability:
|
||||
|
||||
... rootcap=<ref "syndicate" [] #x"69ca300c1dbfa08fba692102dd82311a"> ...
|
||||
... rootcap=<ref {oid: "syndicate" sig: #x"69ca300c1dbfa08fba692102dd82311a"}> ...
|
||||
|
||||
Then, run [chat.py](chat.py) several times in several separate windows:
|
||||
|
||||
python chat.py \
|
||||
--address '<tcp "localhost" 8001>' \
|
||||
--cap '<ref "syndicate" [] #x"69ca300c1dbfa08fba692102dd82311a">'
|
||||
--cap '<ref {oid: "syndicate" sig: #x"69ca300c1dbfa08fba692102dd82311a"}>'
|
||||
|
|
2
chat.py
2
chat.py
|
@ -17,7 +17,7 @@ parser.add_argument('--address', metavar='\'<tcp "HOST" PORT>\'',
|
|||
default='<ws "ws://localhost:9001/">')
|
||||
parser.add_argument('--cap', metavar='\'<ref ...>\'',
|
||||
help='capability for the dataspace on the server',
|
||||
default='<ref "syndicate" [] #[acowDB2/oI+6aSEC3YIxGg==]>')
|
||||
default='<ref {oid: "syndicate" sig: #[acowDB2/oI+6aSEC3YIxGg==]}>')
|
||||
args = parser.parse_args()
|
||||
|
||||
Present = simpleChatProtocol.Present
|
||||
|
|
|
@ -5,8 +5,11 @@ from . import turn
|
|||
# decorator
|
||||
def resolve(gk, cap, *args, **kwargs):
|
||||
def configure_handler(handler):
|
||||
def unwrapping_handler(wrapped_ref):
|
||||
return handler(wrapped_ref.embeddedValue)
|
||||
def unwrapping_handler(r):
|
||||
resolved = gatekeeper.Resolved.decode(r)
|
||||
if resolved.VARIANT.name == 'accepted':
|
||||
return handler(resolved.responderSession)
|
||||
raise Exception('Could not resolve reference: ' + repr(resolved))
|
||||
return _resolve(gk, cap)(During(*args, **kwargs).add_handler(unwrapping_handler))
|
||||
return configure_handler
|
||||
|
||||
|
|
Loading…
Reference in New Issue