@nevermined-io/payments
    Preparing search index...

    Function getEnvironmentFromApiKey

    • Maps the prefix of an NVM API key (<prefix>:<jwt>) to the environment the key targets. This is the inverse of the backend's addPrefixToToken: a key minted for staging_sandbox carries the prefix sandbox-staging, i.e. {env}-{deployment} on the wire maps to {deployment}_{env} here.

      Parameters

      • nvmApiKey: string

        The full NVM API key (<prefix>:<jwt>), or a bare JWT.

      Returns EnvironmentName | undefined

      The mapped EnvironmentName, or undefined when the key has no prefix or the prefix is not recognized (caller falls back to the deprecated environment option, else custom).