@monimesl/dot-cli 0.1.0-alpha.23 → 0.1.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,12 +9,13 @@ export default definePage({
9
9
  setNonce: (_state, event: ValueEvent) => ({ nonce: event.detail.value }),
10
10
  },
11
11
  actions: {
12
- async read(state) {
12
+ async signIn(state) {
13
13
  try {
14
- const { fullName, accountIdToken } = await this.dash.account.readProfile({
14
+ const { fullName, alias, accountIdToken } = await this.dash.account.signIn({
15
+ mode: 'simple',
15
16
  nonce: state.nonce,
16
17
  });
17
- this.setState({ fullName, accountIdToken, note: '' });
18
+ this.setState({ fullName, alias, accountIdToken, note: '' });
18
19
  } catch (error) {
19
20
  this.setState({ note: errorMessage(error) });
20
21
  }
@@ -2,6 +2,7 @@ export default {
2
2
  // A fixed nonce, so the token names the person the same way each time in this dot.
3
3
  nonce: 'salone-sounds',
4
4
  fullName: '',
5
+ alias: '',
5
6
  accountIdToken: '',
6
7
  note: '',
7
8
  };
@@ -3,14 +3,15 @@
3
3
  <Text>Who is signed in to Dash. It needs the account permission in dot.json.</Text>
4
4
 
5
5
  <View gap="small">
6
- <Text variant="subtitle">readProfile</Text>
7
- <Text variant="caption" tone="muted">Gives the person's full name, and a token: a hash of their Monimeer id, this dot's id and the nonce. The same nonce gives the same token. Dash makes it on the phone, so it names the person, but proves nothing to the dot's server.</Text>
6
+ <Text variant="subtitle">signIn</Text>
7
+ <Text variant="caption" tone="muted">With mode "simple", Dash says who the person is: their full name, the phone number or email address they use Dash with, and a token: a SHA-512 hash of this dot's id, their Monimeer id and the nonce. The same nonce gives the same token. Dash makes it on the phone, so it names the person, but proves nothing to the dot's server.</Text>
8
8
  <View variant="card" gap="medium">
9
9
  <Input label="Nonce" value="{{ nonce }}" onChange="setNonce" />
10
- <Button onClick="read">Read the profile</Button>
10
+ <Button onClick="signIn">Sign in with Dash</Button>
11
11
  <If condition="{{ fullName }}">
12
12
  <View gap="none">
13
13
  <DetailRow label="fullName" value="{{ fullName }}" />
14
+ <DetailRow label="alias" value="{{ alias }}" />
14
15
  <DetailRow label="accountIdToken" value="{{ accountIdToken }}" />
15
16
  </View>
16
17
  </If>
@@ -41,6 +41,9 @@ export default definePage({
41
41
  case 'denied':
42
42
  await this.dash.network.http.request({ url: 'https://example.com' });
43
43
  break;
44
+ case 'missing':
45
+ await this.dash.storage.file.read('never-saved.txt');
46
+ break;
44
47
  }
45
48
  this.setState({ code: 'none', message: 'It worked' });
46
49
  } catch (error) {
@@ -19,18 +19,20 @@
19
19
 
20
20
  <View gap="small">
21
21
  <Text variant="subtitle">DashError codes</Text>
22
- <Text variant="caption" tone="muted">isDashError(error) tells a Dash call's error from any other, and isDashError(error, 'timeout') also checks its code. Each code has its own check too, such as isDashCancelled(error).</Text>
22
+ <Text variant="caption" tone="muted">isDashError(error) tells a Dash call's error from any other, and isDashError(error, 'timeout') also checks its code.</Text>
23
23
  <View variant="card" gap="none">
24
24
  <DetailRow label="cancelled" value="The person closed it, or the call was cancelled" />
25
25
  <DetailRow label="timeout" value="It took longer than the timeout" />
26
26
  <DetailRow label="denied" value="Not allowed, such as a missing permission" />
27
27
  <DetailRow label="invalid" value="The call's options are wrong" />
28
28
  <DetailRow label="unsupported" value="This Dash can't do it" />
29
+ <DetailRow label="missing" value="There's nothing there, such as a file that isn't saved" />
29
30
  <DetailRow label="failed" value="Anything else went wrong" />
30
31
  </View>
31
32
  <View direction="row" wrap gap="small">
32
33
  <Button variant="secondary" data-call="invalid" onClick="show">Pick a date between bad limits</Button>
33
34
  <Button variant="secondary" data-call="denied" onClick="show">Reach an unlisted host</Button>
35
+ <Button variant="secondary" data-call="missing" onClick="show">Read a file never saved</Button>
34
36
  </View>
35
37
  </View>
36
38
 
@@ -15,7 +15,11 @@ export default definePage({
15
15
  async hash(state) {
16
16
  try {
17
17
  const sha256 = await this.dash.crypto.sha256(state.text);
18
- const hmac = await this.dash.crypto.hmac('sha256', state.key, state.text);
18
+ const hmac = await this.dash.crypto.hmac({
19
+ algorithm: 'sha256',
20
+ key: state.key,
21
+ data: state.text,
22
+ });
19
23
  this.setState({ sha256, hmac, note: '' });
20
24
  } catch (error) {
21
25
  this.setState({ note: errorMessage(error) });
@@ -11,7 +11,6 @@
11
11
  <DetailRow label="Language" value="{{ info.language }}{{ info.region ? ' · ' + info.region : '' }}" />
12
12
  <DetailRow label="Time zone" value="{{ info.timeZone }}" />
13
13
  <DetailRow label="Dash" value="{{ info.dashVersion }}" />
14
- <DetailRow label="DotHost" value="{{ info.hostVersion }}" />
15
14
  </If>
16
15
  <Else>
17
16
  <Button variant="secondary" onClick="readInfo">Read the phone's details</Button>
@@ -191,7 +191,7 @@ export default {
191
191
  {
192
192
  page: 'dash/account',
193
193
  title: 'dash.account',
194
- covers: 'readProfile',
194
+ covers: 'signIn',
195
195
  icon: 'user',
196
196
  },
197
197
  {
@@ -228,7 +228,7 @@ export default {
228
228
  {
229
229
  page: 'dash/calls',
230
230
  title: 'Calls and errors',
231
- covers: 'timeout, cancel, DashError, isDashError, isDashCancelled',
231
+ covers: 'timeout, cancel, DashError, isDashError',
232
232
  icon: 'warning',
233
233
  },
234
234
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monimesl/dot-cli",
3
- "version": "0.1.0-alpha.23",
3
+ "version": "0.1.0-alpha.25",
4
4
  "description": "The dotctl command: build mini apps and run them in the simulator",
5
5
  "type": "module",
6
6
  "repository": {
@@ -24,11 +24,11 @@
24
24
  "dependencies": {
25
25
  "typescript": "^5.9.3",
26
26
  "uqr": "^0.1.3",
27
- "@monimesl/dot-compiler": "0.1.0-alpha.23",
28
- "@monimesl/dot-core": "0.1.0-alpha.23",
29
- "@monimesl/dot-dml-parser": "0.1.0-alpha.23",
30
- "@monimesl/dot-script-parser": "0.1.0-alpha.23",
31
- "@monimesl/dot-simulator": "0.1.0-alpha.23"
27
+ "@monimesl/dot-core": "0.1.0-alpha.25",
28
+ "@monimesl/dot-simulator": "0.1.0-alpha.25",
29
+ "@monimesl/dot-script-parser": "0.1.0-alpha.25",
30
+ "@monimesl/dot-dml-parser": "0.1.0-alpha.25",
31
+ "@monimesl/dot-compiler": "0.1.0-alpha.25"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^22.20.4",