Table of Contents

Class NdefDataReader

Namespace
Yubico.YubiKey.Otp
Assembly
Yubico.YubiKey.dll

Reads NDEF Record data types supported by the YubiKey.

public class NdefDataReader
Inheritance
object
NdefDataReader

Remarks

This class is used to interpret the byte array returned by the ReadNdefDataResponse class. Note that this class does not interpret the Configuration Container data that can also be returned through the same API. That data is not technically an NDEF message or record.

Constructors

NdefDataReader(ReadOnlySpan<byte>)

Constructs a new instance of the NdefDataReader class.

public NdefDataReader(ReadOnlySpan<byte> responseData)

Parameters

responseData ReadOnlySpan<byte>

The NDEF message data returned by the YubiKey.

Properties

Data

Returns the uninterpreted data inside of the NDEF record.

public IReadOnlyList<byte> Data { get; }

Property Value

IReadOnlyList<byte>

Type

Indicates the type of NDEF record that was read.

public NdefDataType Type { get; }

Property Value

NdefDataType

Remarks

The YubiKey supports the following NDEF record types:

  • 'T' Text
  • 'U' URI

Methods

ToText()

Interprets the NDEF data as a text record.

public NdefText ToText()

Returns

NdefText

The text of the message, and the language information specified in the record.

Exceptions

InvalidOperationException

Thrown if Type is not Text.

ToUri()

Interprets the NDEF data as a URI record.

public Uri ToUri()

Returns

Uri

The message as a Uniform Resource Identifier (URI).

Exceptions

InvalidOperationException

Throw if Type is not Uri.