1 | /**
|
2 | * Error prefixes used for known verification failure cases.
|
3 | *
|
4 | * For compatibility, these error prefixes match the existing error messages, but will be adjusted in a future major
|
5 | * version update to match the scenarios better.
|
6 | *
|
7 | * @beta
|
8 | */
|
9 | export const JWT_ERROR = {
|
10 | /**
|
11 | * Thrown when a JWT payload schema is unexpected or when validity period does not match
|
12 | */
|
13 | INVALID_JWT: 'invalid_jwt',
|
14 | /**
|
15 | * Thrown when the verifier audience does not match the one set in the JWT payload
|
16 | */
|
17 | INVALID_AUDIENCE: 'invalid_config',
|
18 | /**
|
19 | * Thrown when none of the public keys of the issuer match the signature of the JWT.
|
20 | *
|
21 | * This is equivalent to `NO_SUITABLE_KEYS` when the `proofPurpose` is NOT specified.
|
22 | */
|
23 | INVALID_SIGNATURE: 'invalid_signature',
|
24 | /**
|
25 | * Thrown when the DID document of the issuer does not have any keys that match the signature for the given
|
26 | * `proofPurpose`.
|
27 | *
|
28 | * This is equivalent to `invalid_signature`, when a `proofPurpose` is specified.
|
29 | */
|
30 | NO_SUITABLE_KEYS: 'no_suitable_keys',
|
31 | /**
|
32 | * Thrown when the `alg` of the JWT or the encoding of the key is not supported
|
33 | */
|
34 | NOT_SUPPORTED: 'not_supported',
|
35 | /**
|
36 | * Thrown when the DID resolver is unable to resolve the issuer DID.
|
37 | */
|
38 | RESOLVER_ERROR: 'resolver_error',
|
39 | }
|