gnap-caep-client
    Preparing search index...

    Function subjectMatches

    • Tests whether a subject identifier refers to a known identity.

      identity fields: iss, sub, sid (a session id, or an array of them), email and email_verified, phone_number and phone_number_verified, plus any of device/application/tenant/org_unit/group as opaque ids.

      A GNAP grant is a session of its own: iya-sts names a revoked grant gnap-grant:<id> and a revoked access token gnap-token:<jti> as the session of a complex subject. An account's sid is therefore an array holding both, and a session-scoped event matches when it names either.

      • An email or phone number identifies somebody only when the AS said it was verified (email_verified / phone_number_verified true): neither is a stable or unique identifier, and an unverified one may be anybody's.
      • A top-level opaque id is compared with sub. A session is named inside a complex subject.
      • In a complex subject every member must match, and the members this identity can't be checked against count as a non-match: an event about one session matches only an identity holding it.

      Parameters

      • subId: Record<string, any>

        An RFC 9493 subject identifier, e.g. a SET's sub_id

      • identity: Record<string, any>

      Returns boolean