oficina / meet Public

Clone
git clone https://amadan.net/oficina/meet

Plain git — no account needed to clone.

Download

Download this file

1package bridge
2
3import (
4 "amadan.net/oficina/calls/callscore"
5 "context"
6 "encoding/json"
7)
8
9type Authentication struct{ auth *callscore.Authentication }
10
11func BeginAuthentication(address string) (*Authentication, error) {
12 a, e := callscore.BeginAuthentication(context.Background(), address)
13 if e != nil {
14 return nil, e
15 }
16 return &Authentication{auth: a}, nil
17}
18
19// BeginOfferAuthentication is the handoff for a link from the web's
20// "Join in the app", which carries the offer its browser made: that
21// browser asks the person to confirm, so the app opens none. See
22// callscore.BeginOfferAuthentication.
23func BeginOfferAuthentication(address, offer string) (*Authentication, error) {
24 a, e := callscore.BeginOfferAuthentication(context.Background(), address, offer)
25 if e != nil {
26 return nil, e
27 }
28 return &Authentication{auth: a}, nil
29}
30func (a *Authentication) BrowserURL() string { return a.auth.BrowserURL() }
31func (a *Authentication) Cancel() { a.auth.Cancel() }
32func (a *Authentication) Wait() (string, error) {
33 r, e := a.auth.Wait()
34 if e != nil {
35 return "", e
36 }
37 b, e := json.Marshal(r)
38 return string(b), e
39}
40
41func (a *Authentication) ConfirmationCode() string { return a.auth.ConfirmationCode() }
42