Friend Services

Friend Services

Friend User Service “frd:u” #

Command HeaderDescription
0x00010000HasLoggedIn
0x00020000IsOnline
0x00030002Login
0x00040000Logout
0x00050000GetMyFriendKey
0x00060000GetMyPreference
0x00070000GetMyProfile
0x00080000GetMyPresence
0x00090000GetMyScreenName
0x000A0000GetMyMii
0x000B0000GetMyLocalAccountId
0x000C0000GetMyPlayingGame
0x000D0000GetMyFavoriteGame
0x000E0000GetMyNcPrincipalId
0x000F0000GetMyComment
0x00100040GetMyPassword
0x00110080GetFriendKeyList
0x00120042GetFriendPresence
0x00130142GetFriendScreenName
0x00140044GetFriendMii
0x00150042GetFriendProfile
0x00160042GetFriendRelationship
0x00170042GetFriendAttributeFlags
0x00180044GetFriendPlayingGame
0x00190042GetFriendFavoriteGame
0x001A00C4GetFriendInfo
0x001B0080IsIncludedInFriendList
0x001C0042UnscrambleLocalFriendCode
0x001D0002UpdateGameModeDescription
0x001E02C2UpdateMyPresence
0x001F0042SendInvitation
0x00200002AttachToEventNotification
0x00210040SetNotificationMask
0x00220040GetEventNotification
0x00230000GetLastResponseResult
0x00240040PrincipalIdToFriendCode
0x00250080FriendCodeToPrincipalId
0x00260080IsValidFriendCode
0x00270040ResultToErrorCode
0x00280244RequestGameAuthentication
0x00290000GetGameAuthenticationData
0x002A0204RequestServiceLocator
0x002B0000GetServiceLocatorData
0x002C0002DetectNatProperties
0x002D0000GetNatProperties
0x002E0000GetServerTimeDifference
0x002F0040AllowHalfAwake
0x00300000GetServerTypes
0x00310082GetFriendComment
0x00320042SetClientSdkVersion
0x00330000GetMyApproachContext
0x00340046AddFriendWithApproach
0x00350082DecryptApproachContext
0x00360000GetExtendedNatProperties

Friend Network Daemon Service “frd:n” #

Command HeaderDescription
0x00010000GetHandleOfNdmStatusChangedEvent
0x00020000Resume
0x00030040SuspendAsync
0x00040000QueryStatus

Friend Admin Service “frd:a” #

Includes all the commands in frd:u, and, in addition:

Command HeaderDescription
0x04010100CreateLocalAccount
0x04020040DeleteLocalAccount
0x04030040LoadLocalAccount
0x04040000UnloadLocalAccount
0x04050000SaveLocalAccountData
0x04060042AddFriendOnline
0x04070D80AddFriendOffline
0x040802C0UpdateFriendDisplayName
0x04090100RemoveFriend
0x040A0100UpdatePlayingGame
0x040B00C0UpdatePreference
0x040C0800UpdateMii
0x040D0100UpdateFavoriteGame
0x040E0040SetNcPrincipalId
0x040F0240UpdateComment
0x04100000Currently unknown. Increments a u32 value in the savegame.

HTTPS Requests #

Trusted RootCAs #

No RootCertChain(s) are used. For the nasc site, friends-module uses HTTPC:AddDefaultCert with the following certIDs: 0x1, 0x2, and 0x3.

Types #

FriendKey #

OffsetSizeDescription
0x00x4Principal ID
0x40x4padding
0x80x8Friend Code

GameKey #

OffsetSizeDescription
0x00x8u64, Title ID
0x80x2u16, Title Version
0xA0x6Unused padding.

Presence #

OffsetSizeDescription
0x00x4u32 JoinAvailabilityFlag
0x40x4u32 MatchmakeSystemType
0x80x4u32 JoinGameID
0xC0x4u32 JoinGameMode
0x100x4u32 OwnerPrincipalID
0x140x4u32 JoinGroupID
0x180x14u8 ApplicationArg[20]

Mii Data #

OffsetSizeDescription
0x00x1bool, ProfanityFlag
0x10x1Mii character set
0x20x1bool, DirtyFlag
0x30x1padding
0x40x5CMii data

Profile #

OffsetSizeDescription
0x00x1u8, Region
0x10x1u8, Country
0x20x1u8, Area
0x30x1u8, Language
0x40x1u8, Platform, always 2 (PLATFORM_CTR)
0x50x3padding

FriendProfile #

OffsetSizeDescription
0x00x8Profile
0x80x10GameKey of favorite game
0x180x4u32, NcPrincipalID
0x1C0x2216-Character UTF-16 Personal Message (16 characters + null termination)
0x3E0x2padding
0x400x8NEX Timestamp when this friend was last seen online

FriendInfo #

OffsetSizeDescription
0x00x10FriendKey of this friend
0x100x8NEX Timestamp when this friend was added to the friends list
0x180x1The relationship with this friend
0x190x7padding
0x200x48FriendProfile of this friend
0x680x1610-Character UTF-16 Screen Name (10 characters + null termination)
0x7E0x1u8, Mii character set
0x7F0x1padding
0x800x60This friend’s Mii

GameAuthenticationData #

OffsetSizeDescription
0x00x4NASC Login Result
0x40x4HTTP Status Code
0x80x20Server Address (string)
0x280x2Server Port
0x2A0x6padding
0x300x100Token for game server authentication (string)
0x1300x8NEX Timestamp for server time

ServiceLocatorData #

OffsetSizeDescription
0x00x4NASC SVCLOC Result
0x40x4HTTP Status Code
0x80x80Service Host (string)
0x880x100Service Token (string)
0x1880x1statusdata from NASC response
0x1890x7padding
0x1900x8NEX Timestamp for server time

Approach Contexts #

The approach context (in the form of an encrypted payload) of the console can be retrieved using FRDU:GetMyApproachContext.

Encrypted payloads can be decrypted using FRDU:DecryptApproachContext.

It is possible to add a friend using an encrypted payload using FRDU:AddFriendWithApproach.

ApproachContext #

OffsetSizeDescription
0x00x48Friend Profile of the console that created this approach context
0x480x1bool, Has Mii
0x490x1bool, Profanity Flag
0x4A0x1u8, Mii Character Set
0x4B0x70Friend Mii Data wrapped using APT:Wrap (Unwrapped size: 0x60)
0xBB0x1610-Character UTF-16 Screen Name (10 characters + null termination)
0xD10x10Funused

Encrypted ApproachContext Payload #

OffsetSizeDescription
0x00x1(u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned
0x10x1(u8) unknown, always set to 0
0x20x1(u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned
0x30x1(u8) unknown, always set to 0
0x40x4u32, Principal ID (part of nonce)
0x80x8u64, Friend Code (part of nonce)
0x100x1E0ApproachContext
0x1F00x10AES-CCM MAC over the encrypted payload at 0x10 thru 0x1F0

Decrypted ApproachContext Payload #

OffsetSizeDescription
0x00x1(u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned
0x10x1(u8) unknown, always set to 0
0x20x1(u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned
0x30x1(u8) unknown, always set to 0
0x40x1bool, Has Mii
0x50x1bool, Profanity Flag
0x60x1u8, Mii Character Set
0x70x1padding
0x80x10FriendKey of the console that created this approach context
0x180x48FriendProfile of the console that created this approach context
0x600x60Friend Mii Data of the console that created this approach context
0xC00x1610-Character UTF-16 Screen Name (10 characters + null termination)
0xD60x12Aunused

Notification Events #

The friends module exposes a “Notification Events” system that allows client sessions to be notified of various related events.

A client sets its per-session notification event signaling handle using FRDU:AttachToEventNotification.

The client can then customize for which Notification Event Types it shall receive notifications using FRDU:SetNotificationMask.

Once the handle has been signaled by the friends module, the client can use FRDU:GetEventNotification to receive the notifications.

Notification Event Types #

ValueDescription
1The console went online.
2The console went offline.
3A friend is now present (went online).
5A friend changed their Mii.
6A friend changed their Profile.
7A friend is no longer present (went offline).
8A friend has added you back as a friend (if you had added them before as a “provisionally registered” friend).
9A friend sent you a joinable game invitation(?) (only signaled when the console’s JoinGameID matches that of the friend).
146A friend changed their favorite game.
147A friend changed their personal message.
149A friend sent you an invitation. (signaled regardless of whether or not the console’s JoinGameID matches that of the friend)

EventNotification #

OffsetSizeDescription
0x00x1u8, Event Type
0x10x7padding
0x80x10FriendKey of the friend who caused this notification to be sent

Relationship Types #

Every valid entry in the internal friends list contains a relationship field.

ValueDescription
0The target has been added locally and on the server, but is only “provisionally registered.” The target has not added you as a friend.
1The target has been added locally and on the server and is fully registered: the target has also added you as a friend.
2No relationship between you and the target has been found: neither you nor the target have added each other.
3The relationship has been deleted: the target has deleted your friend card.
4The target has been added locally: you were not online when you added the target. (presumably only happens when the “Local” method of adding a friend is used. When the system connects to the internet, a background task runs to register this relationship on the friends server.)

Attribute Flags #

FlagDescription
0x1Unknown (something like “target ever registered you”?), set when relationship type is 1, 3 or 4
0x2Unknown, set only when relationship type is 1

NASC Result #

ValueDescription
001Success.
101Game server is under maintenance.
102Device is banned.
107Invalid product code.
109Invalid/missing request parameter.
110Game server is no longer available.
112Invalid SVC.
119Invalid FPD version.
120Invalid title version.
121Invalid device certificate.
122Invalid PID HMAC.
123ROM ID is banned.
125Invalid Game ID.
127Invalid key hash.

Server Types #

The server type is stored internally as a combination of two values, the first value represents the server type letter and the second value is the number that follows it. For example, the production server type is “L1”, so the first value is 0 and the second value is 1.

🔗 Official servers only support the letters L, C, S, D, I, T, J or U.

ValueServer Type Letter
0L
1C
2S
3D
4I
5T
6U (fallback to default value)
7J
8X
9A
10B
11C
12D
13E
14F
15G
16H
17I
18J
19K
20L
21M
22N
23O
24P
25Q
>=26U

Category:Services