MCPcopy Index your code
hub / github.com/SignTools/SignTools / loadProfile

Function loadProfile

src/storage/profile.go:44–81  ·  view source on GitHub ↗
(id string)

Source from the content-addressed store, hash-verified

42}
43
44func loadProfile(id string) (*profile, error) {
45 p := newProfile(id)
46 isAccount, err := p.IsAccount()
47 if err != nil {
48 return nil, errors.WithMessage(err, "is account")
49 }
50 for _, file := range ProfilePaths {
51 if !isAccount && (file == ProfileAccountName || file == ProfileAccountPass) {
52 continue
53 }
54 if isAccount && file == ProfileProv {
55 continue
56 }
57 if _, err := p.Stat(file); err != nil {
58 return nil, errors.WithMessagef(err, "check required file %s", file)
59 }
60 }
61 pass, err := p.GetString(ProfileCertPass)
62 if err != nil {
63 return nil, errors.WithMessagef(err, "get %s", ProfileCertPass)
64 }
65 origCertFile, err := p.GetFile(ProfileCert)
66 if err != nil {
67 return nil, errors.WithMessagef(err, "get %s", ProfileCert)
68 }
69 defer origCertFile.Close()
70 origCertBytes, err := ioutil.ReadAll(origCertFile)
71 if err != nil {
72 return nil, errors.WithMessage(err, "read cert file")
73 }
74 fixedCert, teamId, err := processP12(origCertBytes, pass)
75 if err != nil {
76 return nil, errors.WithMessage(err, "validate certificate")
77 }
78 p.fixedCert = fixedCert
79 p.teamId = teamId
80 return p, nil
81}
82
83type PublicKeyComparator interface {
84 Equal(x crypto.PublicKey) bool

Callers 1

refreshMethod · 0.85

Calls 6

newProfileFunction · 0.85
processP12Function · 0.85
IsAccountMethod · 0.65
StatMethod · 0.65
GetStringMethod · 0.65
GetFileMethod · 0.65

Tested by

no test coverage detected