API reference / @jsprismarine/prismarine / identity/Subject
identity/Subject
Type Aliases
Subject
Subject = {
kind:"xbox";xuid:string; } | {kind:"java";uuid:string; } | {edition?:"java";kind:"offline";name:string; }
Defined in: packages/prismarine/src/identity/Subject.ts:13
A player as one platform knows them.
Union Members
Type Literal
{ kind: "xbox"; xuid: string; }
An Xbox Live account, by its XUID.
Type Literal
{ kind: "java"; uuid: string; }
A Java Edition account, by its Mojang profile UUID. No login produces one yet.
Type Literal
{ edition?: "java"; kind: "offline"; name: string; }
A player on an offline-mode server, by the name the client typed. edition marks a Java Edition login, whose player is not the Bedrock player of the same name: the two keep their own records and can play at once. Permission files ignore it, so an entry for an offline name covers both editions.
SubjectKind
SubjectKind =
Subject["kind"]
Defined in: packages/prismarine/src/identity/Subject.ts:27
The platforms a subject can come from.
Variables
SUBJECT_KINDS
constSUBJECT_KINDS: readonly ["xbox","java","offline"]
Defined in: packages/prismarine/src/identity/Subject.ts:30
Every SubjectKind, in the order a file lists its sections.
Functions
isSubjectKind()
isSubjectKind(
value): value is "java" | "xbox" | "offline"
Defined in: packages/prismarine/src/identity/Subject.ts:37
Whether a string read from a file names a SubjectKind.
Parameters
value
unknown
Returns
value is "java" | "xbox" | "offline"
loginSubject()
loginSubject(
login):Subject
Defined in: packages/prismarine/src/identity/Subject.ts:97
The subject of a login. A chain the server verified against Xbox Live gives the account's XUID; any other login is an offline player known by name, whatever XUID the client claimed.
Parameters
login
What the login carried and whether it was verified.
name
string
verified
boolean
xuid
string
Returns
The subject.
parseSubject()
parseSubject(
kind,key):Subject|undefined
Defined in: packages/prismarine/src/identity/Subject.ts:65
The subject a file section and key name, the reverse of subjectKey.
Parameters
kind
"java" | "xbox" | "offline"
The section's kind.
key
string
The key under it.
Returns
Subject | undefined
The subject, or undefined for an empty key.
sameSubject()
sameSubject(
a,b):boolean
Defined in: packages/prismarine/src/identity/Subject.ts:83
Whether two subjects are the same player on the same platform. An offline Steve is never the Xbox account named Steve.
Parameters
a
b
Returns
boolean
subjectId()
subjectId(
subject):string
Defined in: packages/prismarine/src/identity/Subject.ts:89
One string for both the kind and the key, for a Map key or a log line. It is not a file layout and not the xbox:Steve form /perms accepts; those are spelled where they belong.
Parameters
subject
Returns
string
subjectKey()
subjectKey(
subject):string
Defined in: packages/prismarine/src/identity/Subject.ts:46
The string a file keys this subject under inside its kind's section: the XUID, the UUID or the name. No other module spells the layout; parseSubject is the reverse.
Parameters
subject
The subject.
Returns
string
The key.