OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package dm |
| 6 |
| 7 import "fmt" |
| 8 |
| 9 // MinimumActivationTokenLength is the minimum number of bytes in an appropriate |
| 10 // ExecutionToken. |
| 11 const MinimumActivationTokenLength = 32 |
| 12 |
| 13 // Normalize returns an error iff the ActivateExecutionReq has bad form (nils, |
| 14 // insufficient activation token length, etc. |
| 15 func (a *ActivateExecutionReq) Normalize() error { |
| 16 if err := a.Auth.Normalize(); err != nil { |
| 17 return err |
| 18 } |
| 19 if len(a.ExecutionToken) < MinimumActivationTokenLength { |
| 20 return fmt.Errorf("insufficiently long ExecutionToken: %d", |
| 21 len(a.ExecutionToken)) |
| 22 } |
| 23 return nil |
| 24 } |
OLD | NEW |