forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proof_checkers.go
41 lines (31 loc) · 1.03 KB
/
proof_checkers.go
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
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package libkb
import (
keybase1 "github.com/keybase/client/go/protocol"
)
type ProofChecker interface {
CheckHint(h SigHint) ProofError
CheckStatus(h SigHint) ProofError
GetTorError() ProofError
}
//
//=============================================================================
//=============================================================================
//
type ProofCheckHook func(l RemoteProofChainLink) (ProofChecker, ProofError)
var _dispatch = make(map[string]ProofCheckHook)
func RegisterProofCheckHook(s string, h ProofCheckHook) {
_dispatch[s] = h
}
func NewProofChecker(l RemoteProofChainLink) (ProofChecker, ProofError) {
k := l.TableKey()
hook, found := _dispatch[l.TableKey()]
if !found {
return nil, NewProofError(keybase1.ProofStatus_UNKNOWN_TYPE,
"No proof checker for type: %s", k)
}
return hook(l)
}
//
//=============================================================================