Skip to content

Commit

Permalink
Enforce max 24 characters Lattice suffix (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholtzman authored Oct 8, 2021
1 parent ea14b44 commit 90e8788
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/App/Panel/Local/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ class Settings extends React.Component {
inputLatticeSuffix (e) {
e.preventDefault()
clearTimeout(this.inputLatticeSuffixTimeout)
const value = e.target.value.replace(/\s+/g, '')

// Lattice only supports a suffix of up to 24 characters, and we append "Frame-"
// to the front so limit it to 18 characters
const value = e.target.value.replace(/\s+/g, '').substring(0, 18)

this.setState({ latticeSuffix: value })
// TODO: Update to target specific Lattice device rather than global
this.inputLatticeSuffixTimeout = setTimeout(() => link.send('tray:action', 'setLatticeSuffix', this.state.latticeSuffix), 1000)
Expand Down
4 changes: 3 additions & 1 deletion main/signers/lattice/Lattice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Lattice extends Signer {
} else {
baseUrl = 'https://signing.gridpl.us'
}

suffix = store('main.latticeSettings.suffix')
privKey = store('main.lattice', this.deviceId, 'privKey')

Expand All @@ -62,7 +63,8 @@ class Lattice extends Signer {
this.baseUrl = baseUrl
this.privKey = privKey
this.client = new Client({
name: suffix ? `Frame-${suffix}` : 'Frame',
// Lattice supports a suffix with a max of 24 characters
name: suffix ? `Frame-${suffix.substring(0, 18)}` : 'Frame',
crypto: crypto,
timeout: 120000,
baseUrl,
Expand Down

0 comments on commit 90e8788

Please sign in to comment.