as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート
アクセスいただきありがとうございます。こちらのページは現在英語のみのご用意となっております。順次日本語化を進めてまいりますので、ご理解のほどよろしくお願いいたします。

@amazon-devices/kepler-identifiers

The Kepler Identifiers API provides functionality for generating, retrieving, and managing identifiers such as UUIds, device name, and user agent as well as tracking and ad identifiers.

Getting started

Setup

  1. Add the following library dependency to the dependencies section of your package.json file.

    Copied to clipboard.

     "@amazon-devices/kepler-identifiers": "~0.1.0"
    
  2. In your manifest.toml, add the following privileges required to access the device friendly name.

    Copied to clipboard.

     [[needs.privilege]]
     id = "com.amazon.devconf.privilege.identifiers.device-friendly-name"
    

Usage

Generate UUID v4

This example demonstrates how to generate a UUID v4. The code shows a simple handler function that wraps the generateUuidV4() method with basic error handling. You can use this pattern to integrate into your app's event handlers or utility functions.

Copied to clipboard.

import {KeplerIdentifiers as Identifiers} from '@amazon-devices/kepler-identifiers';

const handleGenerateUuidV4 = () => {
  try {
    let result = Identifiers.generateUuidV4();
    return result;
  } catch (error) {
    console.error(error);
  }
};

Get Friendly Device Name

The getFriendlyDeviceName() method returns the friendly name of the device for the current persona.

Returns one of the following:

  • The user-customized device name if it exists and the caller has the com.amazon.devconf.privilege.identifiers.device-friendly-name run-time privilege
  • The device model name in the following cases:
    • No user-customized name is set
    • The caller lacks the required privilege

Copied to clipboard.

import {KeplerIdentifiers as Identifiers} from '@amazon-devices/kepler-identifiers';

const handleGetFriendlyDeviceName = async () => {
  try {
    let result = await Identifiers.getFriendlyDeviceName();
    return result;
  } catch (error) {
    console.error(error);
  }
};

Request run-time privileges

To acquire run-time privileges get the consent of the user. You can open the user consent dialogue by requesting run-time the "com.amazon.devconf.privilege.identifiers.device-friendly-name" privilege using the Security Manager API.

Copied to clipboard.

import {SecurityManager, PrivilegeState} from '@amazon-devices/security-manager-lib';
import { KeplerIdentifiers as Identifiers } from '@amazon-devices/kepler-identifiers';

const DEVICE_NAME_PRIVILEGE = 'com.amazon.devconf.privilege.identifiers.device-friendly-name';
SecurityManager.getPrivilegeState(DEVICE_NAME_PRIVILEGE).then(
      function(state: PrivilegeState) {
        if (state == PrivilegeState.ALLOW) {
          // User had consented.
          return Identifiers.getFriendlyDeviceName();
        } else {
          // Request for user consent
          // This call blocks, each app will integrate this call into their threading model or event loop
          SecurityManager.requestPrivilege(DEVICE_NAME_PRIVILEGE).then(
            function(state: PrivilegeState) {
              if (state == PrivilegeState.ALLOW) {
                // User has consented now.
                return Identifiers.getFriendlyDeviceName();
              } else {
                // User didn't consent.
              }
            },
            function(error: Object) { KPLOG().error("Failed to request privilege: {}", error["message"]); }
          )
        }
      },
      function(error: Object) { KPLOG().error("Failed to get privilege state: {}", error["message"]); }
    )

Modules


Last updated: Oct 02, 2025