File: test_newapi_cryptosign.py

package info (click to toggle)
python-autobahn 17.10.1%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,452 kB
  • sloc: python: 22,598; javascript: 2,705; makefile: 497; sh: 3
file content (29 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import print_function

from autobahn.twisted.component import Component, run
from autobahn.wamp import cryptosign
import binascii

privkey_hex = '6e3a302aa67d55ffc2059efeb5cf679470b37a26ae9ac18693b56ea3d0cd331c'
# pubkey: 020b13239ca0f10a1c65feaf26e8dfca6e84c81d2509a2b7b75a7e5ee5ce4b66


component = Component(
    transports=u'ws://localhost:8080/auth_ws',
    realm=u'crossbardemo',
    authentication={
        u"cryptosign": {
            "authid": u"alice",
            "privkey": privkey_hex,
        }
    }
)


@component.on_join
def join(session, details):
    print("Session {} joined: {}".format(details.session, details))


if __name__ == '__main__':
    run(component)