@owlmeans/test-auth 0.1.18-rc.43 → 0.1.18-rc.45
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/README.md +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/testing-auth-unit/SKILL.md +1 -1
- package/build/consts.local.d.ts +4 -0
- package/build/consts.local.d.ts.map +1 -0
- package/build/consts.local.js +4 -0
- package/build/consts.local.js.map +1 -0
- package/build/guard.d.ts +3 -11
- package/build/guard.d.ts.map +1 -1
- package/build/guard.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/trusted.d.ts +1 -1
- package/build/trusted.d.ts.map +1 -1
- package/build/trusted.js +1 -3
- package/build/trusted.js.map +1 -1
- package/build/types.d.ts +12 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +10 -10
- package/src/consts.local.ts +4 -0
- package/src/guard.ts +3 -13
- package/src/index.ts +1 -0
- package/src/trusted.ts +2 -7
- package/src/types.ts +12 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
20
20
|
your project's skill store (`.agents/skills/`):
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
23
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.48
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/test-auth",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.45",
|
|
5
|
+
"generatedAt": "2026-10-05T08:32:19.090Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -6,7 +6,7 @@ description: Category-B unit tests for OwlMeans Common — auth/authz packages w
|
|
|
6
6
|
|
|
7
7
|
# Auth Unit Tests — Category B
|
|
8
8
|
|
|
9
|
-
**Install:** `"@owlmeans/test-auth": "^0.1.18-rc.
|
|
9
|
+
**Install:** `"@owlmeans/test-auth": "^0.1.18-rc.45"` in `devDependencies`
|
|
10
10
|
|
|
11
11
|
Category B applies to the auth/authz packages: `auth`, `auth-common`, `auth-otp`, `basic-envelope`, `basic-keys`, `client-auth`, `client-did`, `client-iam`, `client-payment`, `did`, `mui-oidc-rp`, `oidc`, `server-auth`, `server-auth-otp`, `server-oidc-provider`, `server-oidc-rp`, `web-auth`, `web-oidc-provider`, `web-oidc-rp`, `wled`. These tests run under `bun test` (no Playwright even when there are React bits) and are the **only** place mocks are allowed — and only for authentication/authorization, via `@owlmeans/test-auth`.
|
|
12
12
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,YAAY,CAAA;AAE9C,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,UAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../src/consts.local.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAA;AAE9C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA"}
|
package/build/guard.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BasicConfig, type BasicContext } from '@owlmeans/context';
|
|
2
2
|
import type { Auth } from '@owlmeans/auth';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
alias?: string;
|
|
6
|
-
/** Auth payload that `handle` will resolve into the response. */
|
|
7
|
-
auth?: Auth;
|
|
8
|
-
/** Optional predicate that decides whether `match` reports a hit. Defaults to "always match". */
|
|
9
|
-
allow?: (req: AbstractRequest, res: AbstractResponse<unknown>) => boolean | Promise<boolean>;
|
|
10
|
-
/** Token returned by the client-side `authenticated()` method. */
|
|
11
|
-
token?: string;
|
|
12
|
-
}
|
|
3
|
+
import type { GuardService } from '@owlmeans/entrypoint';
|
|
4
|
+
import type { MockGuardOptions } from './types.js';
|
|
13
5
|
/**
|
|
14
6
|
* Build a `GuardService` that resolves to a chosen `Auth` without exercising
|
|
15
7
|
* any real cryptography or trusted-record lookup. Use this in category-B
|
package/build/guard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,UAAU,gBAAgB,KAAQ,YAsB3D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,WAC9D,CAAC,QACJ,IAAI,UACH,MAAM,KACZ,CAGF,CAAA"}
|
package/build/guard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../src/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuC,MAAM,mBAAmB,CAAA;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAKrD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAI,GAAqB,EAAE,EAAgB,EAAE;IACzE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,aAAa,CAAA;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAExC,MAAM,KAAK,GAAG,aAAa,CAAe,KAAK,EAAE;QAC/C,KAAK,EAAE,IAAI,CAAC,KAAK;QAEjB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;YACxB,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QACvC,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC1B,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;gBACtB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACxB,CAAC;YACD,OAAO,IAAI,CAAC,IAAa,CAAA;QAC3B,CAAC;QAED,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;KAC9C,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,OAAU,EACV,IAAU,EACV,KAAK,GAAW,aAAa,EAC1B,EAAE;IACL,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5C,OAAO,OAAO,CAAC,eAAe,CAAI,KAAK,CAAC,CAAA;AAC1C,CAAC,CAAA"}
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAE1B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
|
package/build/trusted.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TrustedRecord } from '@owlmeans/auth-common';
|
|
2
|
-
import type
|
|
2
|
+
import { type Resource } from '@owlmeans/resource';
|
|
3
3
|
/**
|
|
4
4
|
* In-memory `Resource<TrustedRecord>` used to satisfy `trust()` lookups
|
|
5
5
|
* (`@owlmeans/auth-common/utils/trusted.ts`). Pre-populate with the
|
package/build/trusted.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted.d.ts","sourceRoot":"","sources":["../src/trusted.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"trusted.d.ts","sourceRoot":"","sources":["../src/trusted.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAoC,KAAK,QAAQ,EAA4B,MAAM,oBAAoB,CAAA;AAU9G;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,aAC3B,aAAa,EAAE,UACjB,MAAM,KACZ,QAAQ,CAAC,aAAa,CAqExB,CAAA"}
|
package/build/trusted.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { appendContextual } from '@owlmeans/context';
|
|
2
2
|
import { UnsupportedArgumentError } from '@owlmeans/resource';
|
|
3
|
-
|
|
4
|
-
/** The fields a `trust()` lookup keys on — the only index this map has. */
|
|
5
|
-
const SUPPORTED_FIELDS = ['id', 'name'];
|
|
3
|
+
import { SUPPORTED_FIELDS, TRUSTED_DEFAULT_ALIAS } from './consts.local.js';
|
|
6
4
|
const notImplemented = (op) => {
|
|
7
5
|
throw new Error(`@owlmeans/test-auth: in-memory TRUSTED resource does not implement ${op}()`);
|
|
8
6
|
};
|
package/build/trusted.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted.js","sourceRoot":"","sources":["../src/trusted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"trusted.js","sourceRoot":"","sources":["../src/trusted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAA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AI,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;YACjF,CAAC;YACD,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,CAAC,EAAE,iBAAiB,CAAC,CAAA;YACpF,CAAC;YACD,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAuB,CAAC,CAAA;YAC7C,OAAO,MAAuB,CAAA;QAChC,CAAC;QAED,GAAG,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC;QAChC,IAAI,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC;QAClC,KAAK,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC;QACpC,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;QACtC,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;QACtC,IAAI,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC;QAClC,KAAK,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC;KACrC,CAAA;IAED,OAAO,gBAAgB,CAA0B,KAAK,EAAE,QAAQ,CAAC,CAAA;AACnE,CAAC,CAAA"}
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Auth } from '@owlmeans/auth';
|
|
2
|
+
import type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint';
|
|
3
|
+
export interface MockGuardOptions {
|
|
4
|
+
alias?: string;
|
|
5
|
+
/** Auth payload that `handle` will resolve into the response. */
|
|
6
|
+
auth?: Auth;
|
|
7
|
+
/** Optional predicate that decides whether `match` reports a hit. Defaults to "always match". */
|
|
8
|
+
allow?: (req: AbstractRequest, res: AbstractResponse<unknown>) => boolean | Promise<boolean>;
|
|
9
|
+
/** Token returned by the client-side `authenticated()` method. */
|
|
10
|
+
token?: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE7E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,iGAAiG;IACjG,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5F,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/test-auth",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
25
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
26
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
27
|
-
"@owlmeans/basic-keys": "^0.1.18-rc.
|
|
28
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
29
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
30
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
31
|
-
"@owlmeans/test": "^0.1.18-rc.
|
|
24
|
+
"@owlmeans/auth": "^0.1.18-rc.39",
|
|
25
|
+
"@owlmeans/auth-common": "^0.1.18-rc.46",
|
|
26
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.45",
|
|
27
|
+
"@owlmeans/basic-keys": "^0.1.18-rc.47",
|
|
28
|
+
"@owlmeans/context": "^0.1.18-rc.33",
|
|
29
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.40",
|
|
30
|
+
"@owlmeans/resource": "^0.1.18-rc.39",
|
|
31
|
+
"@owlmeans/test": "^0.1.18-rc.34"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@owlmeans/dep-config": "workspace:*",
|
|
35
|
-
"@types/bun": "^1.4.
|
|
35
|
+
"@types/bun": "^1.4.2",
|
|
36
36
|
"nodemon": "^3.1.14",
|
|
37
37
|
"typescript": "^7.0.2"
|
|
38
38
|
},
|
package/src/guard.ts
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import { createService } from '@owlmeans/context'
|
|
2
|
-
import type { BasicConfig, BasicContext } from '@owlmeans/context'
|
|
1
|
+
import { createService, type BasicConfig, type BasicContext } from '@owlmeans/context'
|
|
3
2
|
import { DEFAULT_GUARD } from '@owlmeans/auth-common'
|
|
4
3
|
import type { Auth } from '@owlmeans/auth'
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
export interface MockGuardOptions {
|
|
8
|
-
alias?: string
|
|
9
|
-
/** Auth payload that `handle` will resolve into the response. */
|
|
10
|
-
auth?: Auth
|
|
11
|
-
/** Optional predicate that decides whether `match` reports a hit. Defaults to "always match". */
|
|
12
|
-
allow?: (req: AbstractRequest, res: AbstractResponse<unknown>) => boolean | Promise<boolean>
|
|
13
|
-
/** Token returned by the client-side `authenticated()` method. */
|
|
14
|
-
token?: string
|
|
15
|
-
}
|
|
4
|
+
import type { GuardService } from '@owlmeans/entrypoint'
|
|
5
|
+
import type { MockGuardOptions } from './types.js'
|
|
16
6
|
|
|
17
7
|
/**
|
|
18
8
|
* Build a `GuardService` that resolves to a chosen `Auth` without exercising
|
package/src/index.ts
CHANGED
package/src/trusted.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { appendContextual } from '@owlmeans/context'
|
|
2
2
|
import type { TrustedRecord } from '@owlmeans/auth-common'
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const TRUSTED_DEFAULT_ALIAS = 'TRUSTED'
|
|
7
|
-
|
|
8
|
-
/** The fields a `trust()` lookup keys on — the only index this map has. */
|
|
9
|
-
const SUPPORTED_FIELDS = ['id', 'name']
|
|
3
|
+
import { type Criteria, type FirstOptions, type Resource, UnsupportedArgumentError } from '@owlmeans/resource'
|
|
4
|
+
import { SUPPORTED_FIELDS, TRUSTED_DEFAULT_ALIAS } from './consts.local.js'
|
|
10
5
|
|
|
11
6
|
const notImplemented = (op: string): never => {
|
|
12
7
|
throw new Error(`@owlmeans/test-auth: in-memory TRUSTED resource does not implement ${op}()`)
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Auth } from '@owlmeans/auth'
|
|
2
|
+
import type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint'
|
|
3
|
+
|
|
4
|
+
export interface MockGuardOptions {
|
|
5
|
+
alias?: string
|
|
6
|
+
/** Auth payload that `handle` will resolve into the response. */
|
|
7
|
+
auth?: Auth
|
|
8
|
+
/** Optional predicate that decides whether `match` reports a hit. Defaults to "always match". */
|
|
9
|
+
allow?: (req: AbstractRequest, res: AbstractResponse<unknown>) => boolean | Promise<boolean>
|
|
10
|
+
/** Token returned by the client-side `authenticated()` method. */
|
|
11
|
+
token?: string
|
|
12
|
+
}
|