code: func (ns *NonceService) Valid(nonce string) bool {
  	c, err := ns.decrypt(nonce)
  	if err != nil {
  		ns.stats.Inc("Invalid.Decrypt", 1)
  		return false
  	}
  
  	ns.mu.Lock()
  	defer ns.mu.Unlock()
  	if c > ns.latest {
  		ns.stats.Inc("Invalid.TooHigh", 1)
  		return false
  	}
  
  	if c <= ns.earliest {
  		ns.stats.Inc("Invalid.TooLow", 1)
  		return false
  	}
  
  	if ns.used[c] {
  		ns.stats.Inc("Invalid.AlreadyUsed", 1)
  		return false
  	}
  
  	ns.used[c] = true
  	heap.Push(ns.usedHeap, c)
  	if len(ns.used) > ns.maxUsed {
  		s := time.Now()
  		ns.earliest = heap.Pop(ns.usedHeap).(int64)
  		ns.stats.TimingDuration("Heap.Latency", time.Since(s))
  		delete(ns.used, ns.earliest)
  	}
  
  	ns.stats.Inc("Valid", 1)
  	return true
  }
docs: // Valid determines whether the provided Nonce string is valid, returning
  // true if so.