@agoric/access-token 0.4.22-u18.1 → 0.4.22-u20.0
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.
- package/CHANGELOG.md +1 -9
- package/package.json +3 -2
- package/test/state.test.js +5 -2
- package/test/token.test.js +5 -3
- package/test/tmp.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [0.4.22-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @agoric/access-token
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### [0.4.22-u18.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.21...@agoric/access-token@0.4.22-u18.0) (2024-10-31)
|
|
6
|
+
### [0.4.22-u20.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/access-token@0.4.21...@agoric/access-token@0.4.22-u20.0) (2025-04-16)
|
|
15
7
|
|
|
16
8
|
|
|
17
9
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/access-token",
|
|
3
|
-
"version": "0.4.22-
|
|
3
|
+
"version": "0.4.22-u20.0",
|
|
4
4
|
"description": "Persistent credentials for Agoric users, backed by a simple JSON file",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/access-token.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"lint:types": "tsc"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@agoric/internal": "^0.4.0-u20.0",
|
|
21
22
|
"n-readlines": "^1.0.0",
|
|
22
23
|
"proper-lockfile": "^4.1.2",
|
|
23
24
|
"tmp": "^0.2.1"
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"typeCoverage": {
|
|
44
45
|
"atLeast": 83.97
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "8e4207fa19dabf76c1f91f8779b5b5b93570ecea"
|
|
47
48
|
}
|
package/test/state.test.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import
|
|
2
|
+
import tmp from 'tmp';
|
|
3
|
+
import { makeTempDirFactory } from '@agoric/internal/src/tmpDir.js';
|
|
3
4
|
import {
|
|
4
5
|
initJSONStore,
|
|
5
6
|
openJSONStore,
|
|
@@ -7,6 +8,8 @@ import {
|
|
|
7
8
|
isJSONStore,
|
|
8
9
|
} from '../src/json-store.js';
|
|
9
10
|
|
|
11
|
+
const tmpDir = makeTempDirFactory(tmp);
|
|
12
|
+
|
|
10
13
|
function testStorage(t, storage) {
|
|
11
14
|
t.falsy(storage.has('missing'));
|
|
12
15
|
t.is(storage.get('missing'), undefined);
|
|
@@ -39,7 +42,7 @@ function testStorage(t, storage) {
|
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
test('storageInFile', async t => {
|
|
42
|
-
const [dbDir, cleanup] =
|
|
45
|
+
const [dbDir, cleanup] = tmpDir('testdb');
|
|
43
46
|
t.teardown(cleanup);
|
|
44
47
|
t.is(isJSONStore(dbDir), false);
|
|
45
48
|
const { storage, commit, close } = await initJSONStore(dbDir);
|
package/test/token.test.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import tmp from 'tmp';
|
|
3
|
+
import { makeTempDirFactory } from '@agoric/internal/src/tmpDir.js';
|
|
4
4
|
import { getAccessToken } from '../src/access-token.js';
|
|
5
5
|
|
|
6
|
+
const tmpDir = makeTempDirFactory(tmp);
|
|
7
|
+
|
|
6
8
|
test('access tokens', async t => {
|
|
7
|
-
const [sharedStateDir, removeCallback] =
|
|
9
|
+
const [sharedStateDir, removeCallback] = tmpDir('access-token-test');
|
|
8
10
|
const [a, b, c] = await Promise.all([
|
|
9
11
|
getAccessToken(1234, sharedStateDir),
|
|
10
12
|
getAccessToken(1234, sharedStateDir),
|
package/test/tmp.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import tmp from 'tmp';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} [prefix]
|
|
5
|
-
* @returns {Promise<[string, () => void]>}
|
|
6
|
-
*/
|
|
7
|
-
export const tmpDir = prefix =>
|
|
8
|
-
new Promise((resolve, reject) => {
|
|
9
|
-
// We use `unsafeCleanup` because we want to remove the directory even if it
|
|
10
|
-
// still contains files.
|
|
11
|
-
const unsafeCleanup = true;
|
|
12
|
-
tmp.dir({ unsafeCleanup, prefix }, (err, name, removeCallback) => {
|
|
13
|
-
if (err) {
|
|
14
|
-
reject(err);
|
|
15
|
-
} else {
|
|
16
|
-
resolve([name, removeCallback]);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|