انتقل إلى المحتوى الرئيسي

Function: assertTokenPermitted()

assertTokenPermitted(environment, kind, purposes, policy?): void

Defined in: packages/key-custodian/src/policy.ts:149

The start-up check. Run it before the PIN is used, so a production process with a software token stops without ever logging in to it.

It holds whatever purposes is, including empty: the token kind must first be accepted by at least one row of the policy for this class, and only then is each purpose the process asked for checked. An earlier version checked the purposes alone, so a process started with none skipped the check entirely.

Parameters​

environment​

"staging" | "development" | "ci" | "integration" | "production"

kind​

TokenKind

purposes​

readonly KeyPurpose[]

policy?​

KeyPolicy = KEY_POLICY

Returns​

void

Throws​

Naming KeyCustodian, when no row accepts this kind of token in this class, or when any requested purpose refuses it. main.ts turns that into the configuration exit.