Giter Club home page Giter Club logo

Comments (3)

samuelthomas2774 avatar samuelthomas2774 commented on May 18, 2024

Sharing friend code:

  • Calls /v3/Friend/CreateFriendCodeUrl with an empty parameter object
  • Returns a response with this result object:
    {
        // 0000-0000-0000 is the user's friend code
        // hash is 10 characters matching A-Za-z0-9?
        // hash is the same every time this endpoint is called
        "url": "https://lounge.nintendo.com/friendcode/0000-0000-0000/hash",
        "friendCode": "0000-0000-0000"
    }

When sharing as a QR code, the app appends ?via=qr to the URL before creating a QR code.

I'm not sure what the friendCodeHash is a hash of/how it's calculated, or if it's even a hash of anything. (It's very short, and it seems to be possible for it to use any alphanumeric characters, so it's not base64-encoded.) I don't know what purpose it serves either, as the URL includes the user's friend code anyway, it just seems to restrict generating this link to the API (the app doesn't appear to be able to generate it).


Sending a friend request by entering a friend code:

  • Calls /v3/Friend/GetUserByFriendCode with this parameter object:
    {
        "friendCode": "0000-0000-0000"
    }
  • Returns a response with this result object:
    {
        "id": 0,
        "nsaId": "0123456789abcdef",
        "imageUrl": "https://cdn-image-e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com/1/0123456789abcdef",
        "name": "...",
        "extras": {}
    }

The app then shows a modal with the target user's name, image and friend code and a send friend request button.

Pressing the send friend request button:

  • Calls /v3/FriendRequest/Create with this parameter object:
    {
        "nsaId": "0123456789abcdef"
    }
  • Returns a response with an empty result object

The app stores recently sent friend requests locally (requestedAt, userName, friendCode, userImageUrl), on Android using the FriendRequestHistory shared preference key.

Friends requests sent using Coral appear as "sent via your friend code"/"by exchanging friend codes" on a Nintendo Switch console, although it's possible to send a friend request using Coral without the recipient's friend code, as it's only used to retrieve their network account ID.


Sending a friend request using a link:

  • Calls /v3/Friend/GetUserByFriendCodeHash with this parameter object:
    {
        // From the https://lounge.nintendo.com/friendcode/.../... or com.nintendo.znca://znca/friendcode/.../... URL
        "friendCode": "0000-0000-0000",
        "friendCodeHash": "0123456789"
    }
  • Returns a response with this result object (same as /v3/Friend/GetUserByFriendCode):
    {
        "id": 0,
        "nsaId": "0123456789abcdef",
        "imageUrl": "https://cdn-image-e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com/1/0123456789abcdef",
        "name": "...",
        "extras": {}
    }

The app shows the target user and sends friend requests the same as if the friend code was entered manually.

from nxapi.

samuelthomas2774 avatar samuelthomas2774 commented on May 18, 2024

New web service JavaScript APIs:

/**
 * Unknown.
 * I guess it just opens the QR code reader? But it doesn't appear to have any new options,
 * and must just use the same close function as the other openQRCodeReader* functions.
 * A new `window.onQRCodeReadForCheckin` function is called, I assume on completion of
 * this action.
 */
function openQRCodeReaderForCheckin(/** JSON.stringify(data: QRCheckinOption) */ data: string): void;

interface QRCheckinOption {
    source: 'Camera' | 'PhotoLibrary';
}

/**
 * Download images and save the image to the photo library.
 */
function downloadImages(/** JSON.stringify(data: DownloadImageParam) */ imagesJson: string): void;

interface DownloadImageParam {
    image_urls: string[];
}

/**
 * Report the web service is ready to show and hide the loading screen.
 * Web services with the `fullScreen` attribute set to `"true"` must call this function.
 */
function completeLoading(): void;

/**
 * Close the web view.
 * Web services with the `fullScreen` attribute set to `"true"` must have an option that calls
 * this function somewhere to allow the user to exit the web service. (This is also available
 * to non-fullscreen web services.)
 */
function closeWebView(): void;

/**
 * Unknown.
 * SplatNet 3 has unused translation strings for widgets. This function may be used to
 * ask any native app extensions to look for new data (where?).
 */
function reloadExtension(): void;

from nxapi.

samuelthomas2774 avatar samuelthomas2774 commented on May 18, 2024

As of 29/07/2022 v2.2.0 is required for /v3/Account/Login.

from nxapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.