id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c160800
messagePlaintext.ClientHeader.MessageType, Prev: messagePlaintext.ClientHeader.Prev, Sender: messagePlaintext.ClientHeader.Sender, SenderDevice: messagePlaintext.ClientHeader.SenderDevice, MerkleRoot: nil, // MerkleRoot cannot be sent in MBv1 messages BodyHash: b...
c160801
messagePlaintext.ClientHeader.MerkleRoot, OutboxInfo: messagePlaintext.ClientHeader.OutboxInfo, OutboxID: messagePlaintext.ClientHeader.OutboxID, KbfsCryptKeysUsed: messagePlaintext.ClientHeader.KbfsCryptKeysUsed, EphemeralMetadata: messagePlaintext.ClientHeader.EphemeralMetadata, // In Messa...
c160802
var encKey [libkb.NaclSecretBoxKeySize]byte = key sealed := secretbox.Seal(nil, []byte(s), &nonce, &encKey) enc := &chat1.EncryptedData{ V: 1, E: sealed, N: nonce[:], } return enc, nil }
c160803
plain, ok := secretbox.Open(nil, data.E, &nonce, (*[32]byte)(&key)) if !ok { return nil, libkb.DecryptOpenError{} } return plain, nil }
c160804
if err != nil { return chat1.SignatureInfo{}, err } return b.sign(encoded, kp, prefix) }
c160805
error) { encoded, err := b.marshal(data) if err != nil { return chat1.SignEncryptedData{}, err } return b.signEncrypt(encoded, encryptionKey, signingKeyPair, prefix) }
c160806
S: sig.Sig[:], K: sig.Kid, } if b.testingSignatureMangle != nil { b.assertInTest() sigInfo.S = b.testingSignatureMangle(sigInfo.S) } return sigInfo, nil }
c160807
nil { return chat1.SignEncryptedData{}, err } var encKey [signencrypt.SecretboxKeySize]byte = encryptionKey var signKey [ed25519.PrivateKeySize]byte = *signingKeyPair.Private signEncryptedBytes := signencrypt.SealWhole( msg, &encKey, &signKey, prefix, &nonce) signEncryptedInfo := chat1.SignEncryptedData{ ...
c160808
*verifyKey var nonce [signencrypt.NonceSize]byte if copy(nonce[:], data.N) != signencrypt.NonceSize { return nil, libkb.DecryptBadNonceError{} } plain, err := signencrypt.OpenWhole(data.E, &encKey, &verKey, prefix, &nonce) if err != nil { return nil, err } return plain, nil }
c160809
versions here, you must also update // chat1/extras.go so MessageUnboxedError.ParseableVersion understands the // new max version default: return verifyMessageRes{}, NewPermanentUnboxingError(NewHeaderVersionError(headerVersion, b.headerUnsupported(ctx, headerVersion, header))) } }
c160810
if !validAtCtime { return verifyMessageRes{}, NewPermanentUnboxingError(libkb.NoKeyError{Msg: "key invalid for sender at message ctime"}) } // check signature hcopy := header hcopy.HeaderSignature = nil hpack, err := b.marshal(hcopy) if err != nil { return verifyMessageRes{}, NewPermanentUnboxingError(err) ...
c160811
Payload: data, } copy(sigInfo.Sig[:], si.S) _, err := sigInfo.Verify() return (err == nil) }
c160812
for another sender if !hServer.Sender.Eq(hSigned.Sender) { return NewPermanentUnboxingError(NewHeaderMismatchError("Sender")) } // SenderDevice if !bytes.Equal(hServer.SenderDevice.Bytes(), hSigned.SenderDevice.Bytes()) { return NewPermanentUnboxingError(NewHeaderMismatchError("SenderDevice")) } // _Don't_...
c160813
{ plainsink, err = saltpack.NewSigncryptArmor62SealStream(arg.Sink, emptyKeyring{}, signer, receiverBoxKeys, arg.SymmetricReceivers, KeybaseSaltpackBrand) } } else { if arg.Binary { plainsink, err = saltpack.NewEncryptStream(saltpackVersion, arg.Sink, bsk, receiverBoxKeys) } else { plainsink, err = sal...
c160814
now.Sub(root.fetched) < freshness { m.VLogf(VLog0, "freshness=%d, and was current enough, so returning non-nil previously fetched root", freshness) return root, nil } return mc.fetchRootFromServer(m, root) }
c160815
"merkle/path", SessionType: APISessionTypeNONE, Args: q, AppStatusCodes: []int{SCOk, SCNotFound, SCDeleted}, RetryCount: 3, InitialTimeout: 4 * time.Second, RetryMultiplier: 1.1, }) if err != nil { return nil, err } switch apiRes.AppStatus.Code { case SCNotFound: err = NotF...
c160816
// with: (1) the most recent root, sent back in this reply; and (2) our last // root, which we read out of cache (in memory or on disk). HOWEVER, in the // case of lookup up historical roots, the ordering might be reversed. So // we swap in that case. left, right := thisRoot.payload, lastRoot.payload if left.s...
c160817
!= nil { m.Error("Cannot commit Merkle root to local DB: %s", err) } else { mc.lastRoot = root } }
c160818
{ h := &chatLocalHandler{ BaseHandler: NewBaseHandler(g.ExternalG(), xp), } h.Server = chat.NewServer(g, gh, h) return h }
c160819
&SpecialReadFile{ read: func(ctx context.Context) ([]byte, time.Time, error) { return libfs.GetEncodedStatus(ctx, fs.config) }, } }
c160820
string) bool { _, ok := NormalizeSocialAssertion(ctx, s) return ok }
c160821
:= false for _, code := range knownRaceConditions { if libkb.IsAppStatusCode(err, code) { mctx.Debug("teamEKRetryWrapper found a retryable error on try %d: %s", tries, err) retryableError = true break } } if !retryableError { return err } } return nil }
c160822
= verifySigWithLatestPTK(mctx, teamID, *parsedResponse.Sig) // Check the wrongKID condition before checking the error, since an error // is still returned in this case. TODO: Turn this warning into an error // after EK support is sufficiently widespread. if wrongKID { mctx.Debug("It looks like someone rolled the...
c160823
return nil, fmt.Errorf("Server lied about team membership! %v is not a member of team %v", uv, teamID) } memberStatement, _, wrongKID, err := verifySigWithLatestPUK(mctx, uid, sig) // Check the wrongKID condition before checking the error, since an error // is still returned in this case. TODO: Turn this wa...
c160824
range fs { f.TlfHandleChange(ctx, nil) } if newUser != kbname.NormalizedUsername("") { fl.fs.config.KBFSOps().ForceFastForward(ctx) } }
c160825
getLinksLows, readSubteamID *keybase1.TeamID) (*rawTeam, error) { return l.getLinksFromServerCommon(ctx, teamID, &lows, nil, readSubteamID) }
c160826
[]keybase1.Seqno, readSubteamID *keybase1.TeamID) (*rawTeam, error) { return l.getLinksFromServerCommon(ctx, teamID, nil, requestSeqnos, readSubteamID) }
c160827
Chan: reflect.ValueOf(ctx.mutateCh), }, { Dir: reflect.SelectRecv, Chan: reflect.ValueOf(closeCh), }, } ctx.appendContext(parent) go ctx.loop() cancelFunc := func() { select { case <-closeCh: default: close(closeCh) } } return ctx, cancelFunc }
c160828
return nil case <-ctx.doneCh: return context.Canceled } }
c160829
"sender": HexArg(sender[:]), "seqno": I{Val: int(seqno)}, "msg": B64Arg(msg), }, } mctx = mctx.BackgroundWithLogTags() kexAPITimeout(&arg, time.Second*5) _, err = mctx.G().API.Post(mctx, arg) return err }
c160830
Endpoint: "kex2/receive", Args: HTTPArgs{ "I": HexArg(sessID[:]), "receiver": HexArg(receiver[:]), "low": I{Val: int(low)}, "poll": I{Val: int(poll / time.Millisecond)}, }, } kexAPITimeout(&arg, 2*poll) var j kexResp if err = mctx.G().API.GetDecode(mctx.BackgroundWithLogTags(), ar...
c160831
cl.SetNoStandalone() }, Flags: []cli.Flag{ cli.IntFlag{ Name: "b, buffersize", Value: readBufSizeDefault, Usage: "read buffer size", }, cli.IntFlag{ Name: "rev", Usage: "a revision number for the KBFS folder", }, cli.StringFlag{ Name: "time", Usage: "a time for the KBF...
c160832
newTriggerableTimer(flushFrequency), shutdown: make(chan struct{}), doneShutdown: make(chan struct{}), } go result.backgroundFlush() return result, result.shutdown, result.doneShutdown }
c160833
logBackend := logging.NewLogBackend(writer, "", 0) logging.SetBackend(logBackend) }
c160834
epc.Printf("LoadLibrary(%q) -> %v,%v\n", path, hdl, err) return hdl, err }
c160835
nil || !guessPath { return hdl, err } // User probably has not installed KB2533623 which is a security update // from 2011. Without this Windows security update loading libraries // is unsafe on Windows. // Continue to try to load the DLL regardless. if runtime.GOARCH == `386` { hdl, err = loadLibrary(epc, ...
c160836
doLoadDokanAndGetSymbols(&epc, cfg.DllPath) cfg.FileSystem.Printf("%s", epc.buf.Bytes()) return err }
c160837
stellar1.ParticipantType_STELLAR fillOwnAccounts(mctx, loc, oc) loc.StatusSimplified = stellar1.PaymentStatus_COMPLETED loc.StatusDescription = strings.ToLower(loc.StatusSimplified.String()) loc.Unread = p.Unread loc.IsInflation = p.IsInflation loc.InflationSource = p.InflationSource return loc, nil }
c160838
switch { case loc.FromAccountName != "": // we are sender loc.WorthAtSendTime, _, err = formatWorthAtSendTime(mctx, p, true) case loc.ToAccountName != "": // we are recipient loc.WorthAtSendTime, _, err = formatWorthAtSendTime(mctx, p, false) } if err != nil { return nil, err } loc.StatusSimplified = ...
c160839
} if q.IsUsedAlready { used = append(used, fmt.Sprintf("%s@%s", q.Username, k)) } } if !aq.Valid { aq.Subtitle = status.AirdropConfig.AccountCreationSubtitle if len(used) > 0 { usedDisplay := strings.Join(used, ", ") aq.Subtitle += " " + fmt.Sprintf(status.AirdropConfig.AccountUsed, usedDisplay) ...
c160840
a trace we have already encountered, then we have hit a deadlock if waiters[waitingOnTrace] { c.Debug(ctx, "deadlockDetect: deadlock detected: trace: %s waitingOnTrace: %s waiters: %v", trace, waitingOnTrace, waiters) return true } // Set the current trace as waiting, and then continue down the chain waiter...
c160841
sleeping and trying again: attempt: %d", i) time.Sleep(sleep) continue } return blocked, nil } c.Debug(ctx, "Acquire: giving up, max attempts reached") return true, ErrConvLockTabDeadlock }
c160842
rc, convID, uid, maxMsgID, 0) switch err.(type) { case nil: // ok if len(rc.Result()) == 0 { err := s.ephemeralTracker.inactivatePurgeInfo(ctx, convID, uid) return nil, nil, err } case MissError: s.Debug(ctx, "record-only ephemeralTracker: no local messages") // We don't have these messages in cache...
c160843
} res := make([]UID, 0) for _, uid := range m { res = append(res, uid) } return res }
c160844
return h, nil } return h.ResolveAgainForUser( ctx, resolver, idGetter, osg, keybase1.UID("")) }
c160845
// the user list in the current MD head (done via // `MDOps.GetIDForHandle()`). if other.TypeForKeying() == tlf.TeamKeying { if h.IsFinal() { return false, nil, errors.New("Can't migrate a finalized folder") } other.resolvedWriters = partialResolvedH.resolvedWriters other.resolvedReaders = ...
c160846
{ return HandleMismatchError{ rev, h.GetCanonicalPath(), tlfID, fmt.Errorf( "MD contained unexpected handle path %s (%s -> %s) (%s -> %s)", otherPath, h.GetCanonicalPath(), partialResolvedHandle.GetCanonicalPath(), other.GetCanonicalPath(), partialResolvedOther.GetCanonicalPath()), } ...
c160847
return idutil.ImplicitTeamInfo{}, errors.New("Skipping implicit team lookup for quick handle parsing") }
c160848
implicit teams. kbpki = noImplicitTeamKBPKI{kbpki} return ParseHandlePreferred(ctx, kbpki, nil, osg, name, ty) }
c160849
Contextified: libkb.NewContextified(g), username: strings.TrimSpace(username), } }
c160850
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSListRecursive", []interface{}{__arg}, nil) return }
c160851
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSListRecursiveToDepth", []interface{}{__arg}, nil) return }
c160852
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSReadList", []interface{}{__arg}, &res) return }
c160853
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSCopy", []interface{}{__arg}, nil) return }
c160854
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSSymlink", []interface{}{__arg}, nil) return }
c160855
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSCopyRecursive", []interface{}{__arg}, nil) return }
c160856
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSRename", []interface{}{__arg}, nil) return }
c160857
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSWrite", []interface{}{__arg}, nil) return }
c160858
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSRemove", []interface{}{__arg}, nil) return }
c160859
"keybase.1.SimpleFS.simpleFSStat", []interface{}{__arg}, &res) return }
c160860
(err error) { err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSGetRevisions", []interface{}{__arg}, nil) return }
c160861
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSReadRevisions", []interface{}{__arg}, &res) return }
c160862
c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSMakeOpid", []interface{}{SimpleFSMakeOpidArg{}}, &res) return }
c160863
:= SimpleFSCancelArg{OpID: opID} err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSCancel", []interface{}{__arg}, nil) return }
c160864
c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSCheck", []interface{}{__arg}, &res) return }
c160865
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSGetOps", []interface{}{SimpleFSGetOpsArg{}}, &res) return }
c160866
:= SimpleFSWaitArg{OpID: opID} err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSWait", []interface{}{__arg}, nil) return }
c160867
"keybase.1.SimpleFS.simpleFSDumpDebuggingInfo", []interface{}{SimpleFSDumpDebuggingInfoArg{}}, nil) return }
c160868
:= SimpleFSClearConflictStateArg{Path: path} err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSClearConflictState", []interface{}{__arg}, nil) return }
c160869
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSSyncStatus", []interface{}{__arg}, &res) return }
c160870
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSListFavorites", []interface{}{SimpleFSListFavoritesArg{}}, &res) return }
c160871
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSGetUserQuotaUsage", []interface{}{SimpleFSGetUserQuotaUsageArg{}}, &res) return }
c160872
= c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSGetTeamQuotaUsage", []interface{}{__arg}, &res) return }
c160873
:= SimpleFSResetArg{Path: path} err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSReset", []interface{}{__arg}, nil) return }
c160874
// Team TLFs can't be rekeyed, so readers aren't ever valid. return isWriter, nil } if h.IsWriter(currentUID.AsUserOrTeam()) { return true, nil } if h.IsReader(currentUID.AsUserOrTeam()) { // if this is a reader, are they acting within their // restrictions? return newMd.IsValidRekeyRequest( codec,...
c160875
kbChatCtx = svc.ChatContextified.ChatG() kbChatCtx.NativeVideoHelper = newVideoHelper(nvh) logs := libkb.Logs{ Service: config.GetLogFile(), EK: config.GetEKLogFile(), } fmt.Printf("Go: Using config: %+v\n", kbCtx.Env.GetLogFileConfig(config.GetLogFile())) logSendContext = libkb.LogSendContext{ Cont...
c160876
If you increase this, check go/libkb/env.go:Env.GetLogFileConfig to make sure we store at least that much. return logSendContext.LogSend(status, feedback, sendLogs, sendLogMaxSizeBytes, env.GetUID(), env.GetInstallID(), true /* mergeExtendedStatus */) }
c160877
n, err := conn.Write(data) if err != nil { return fmt.Errorf("Write error: %s", err) } if n != len(data) { return errors.New("Did not write all the data") } return nil }
c160878
return str, nil } if err != nil { // Attempt to fix the connection Reset() return "", fmt.Errorf("Read error: %s", err) } return "", nil }
c160879
return fmt.Errorf("Socket error: %s", err) } return nil }
c160880
fmt.Printf("Starting force gc\n") debug.FreeOSMemory() fmt.Printf("Done force gc\n") }
c160881
Tap here to retry them.", -1, "default", obr.ConvID.String(), "chat.failedpending") return } } kbCtx.Log.Debug("pushPendingMessageFailure: skipped notification for: %d items", len(obrs)) }
c160882
to send, let the user // know they will get stuck pushPendingMessageFailure(obrs, pusher) } kbCtx.MobileAppState.Update(keybase1.MobileAppState_BACKGROUND) }
c160883
case obrs := <-ch: kbCtx.Log.Debug( "AppBeginBackgroundTask: failure received, alerting the user: %d marked", len(obrs)) pushPendingMessageFailure(obrs, pusher) return errors.New("failure received") case <-ctx.Done(): return ctx.Err() } }) g.Go(func() error { successCount := 0 for { sele...
c160884
kbfscrypto.SigningKeySigner{Key: signingKey}, cryptPrivateKey, make(map[keybase1.TeamID]perTeamKeyPairs), } }
c160885
kbfscrypto.EncryptedTLFCryptKeyClientHalf) ( kbfscrypto.TLFCryptKeyClientHalf, error) { return kbfscrypto.DecryptTLFCryptKeyClientHalf( c.cryptPrivateKey, publicKey, encryptedClientHalf) }
c160886
isDecryptionError := errors.Cause(err).(libkb.DecryptionError) if firstNonDecryptionErr == nil && !isDecryptionError { firstNonDecryptionErr = err } continue } return clientHalf, i, nil } // This is to mimic the behavior in // CryptoClient.DecryptTLFCryptKeyClientHalfAny, which is to, // if al...
c160887
i++ { decryptedData, err := kbfscrypto.DecryptMerkleLeaf( perTeamKeys[i].privKey, publicKey, encryptedMerkleLeaf) if err == nil { return decryptedData, nil } } return nil, errors.WithStack(libkb.DecryptionError{}) }
c160888
err = json.Marshal(history) if err != nil { return nil, time.Time{}, err } data = append(data, '\n') return data, time.Time{}, nil }
c160889
panic(err.Error()) } return &KeyCacheStandard{head} }
c160890
} // shouldn't really be possible return kbfscrypto.TLFCryptKey{}, KeyCacheHitError{tlf, keyGen} } return kbfscrypto.TLFCryptKey{}, KeyCacheMissError{tlf, keyGen} }
c160891
key kbfscrypto.TLFCryptKey) error { cacheKey := keyCacheKey{tlf, keyGen} k.lru.Add(cacheKey, key) return nil }
c160892
{ return nil, err } data = append(data, '\n') return data, nil }
c160893
s.lock.RUnlock() return s.count }
c160894
s.count -= n return nil, s.count } return s.onRelease, s.count }
c160895
that the mount is not in use, and is // not really an error. log.Debug("Continuing despite error in lsof: %s", err) return nil, nil } var ret []CommonLsofResult for _, process := range processes { ret = append(ret, CommonLsofResult{process.PID, process.Command}) } return ret, nil }
c160896
StatusFileName, reader: func(ctx context.Context) ([]byte, time.Time, error) { return GetEncodedStatus(ctx, rfs.config) }, log: rfs.log, }, nil default: panic(fmt.Sprintf("Name %s was in map, but not in switch", filename)) } }
c160897
return nil, errors.New("RootFS can't create files") } return rfs.Open(filename) }
c160898
return nil, os.ErrNotExist } switch filename { case StatusFileName: wrf := &wrappedReadFile{ name: StatusFileName, reader: func(ctx context.Context) ([]byte, time.Time, error) { return GetEncodedStatus(ctx, rfs.config) }, log: rfs.log, } return wrf.GetInfo(), nil default: panic(fmt.Sprint...
c160899
{ return rfs.Lstat(filename) }