Documentation
¶
Index ¶
- Constants
- Variables
- func NewDataHmac(dataKey *DerivedKey, amiibo Amiidump, tagHmac []byte) []byte
- func NewTagHmac(tagKey *DerivedKey, amiibo Amiidump) []byte
- func Seed(key *MasterKey, amiibo Amiidump) []byte
- func Verify(amiibo Amiidump, tagKey, dataKey *DerivedKey) bool
- type Amiibo
- func (a *Amiibo) DataHMAC() []byte
- func (a *Amiibo) GeneratePassword()
- func (a *Amiibo) ModelInfo() *ModelInfo
- func (a *Amiibo) ModelInfoRaw() []byte
- func (a *Amiibo) RegisterInfo() *RegisterInfo
- func (a *Amiibo) RegisterInfoRaw() []byte
- func (a *Amiibo) Salt() []byte
- func (a *Amiibo) SetDataHMAC(dHmac []byte)
- func (a *Amiibo) SetRegisterInfo(enc []byte)
- func (a *Amiibo) SetSettings(enc []byte)
- func (a *Amiibo) SetTagHMAC(tHmac []byte)
- func (a *Amiibo) Settings() *Settings
- func (a *Amiibo) SettingsRaw() []byte
- func (a *Amiibo) TagHMAC() []byte
- func (a *Amiibo) Type() DumpType
- func (a *Amiibo) Unknown1() byte
- func (a *Amiibo) Unknown2() byte
- func (a *Amiibo) WriteCounter() []byte
- type Amiidump
- type Amiitool
- func (a *Amiitool) BCC0() byte
- func (a *Amiitool) BCC1() byte
- func (a *Amiitool) CapabilityContainer() []byte
- func (a *Amiitool) DataHMAC() []byte
- func (a *Amiitool) FullUID() []byte
- func (a *Amiitool) GeneratePassword()
- func (a *Amiitool) Int() byte
- func (a *Amiitool) Lock0() byte
- func (a *Amiitool) Lock1() byte
- func (a *Amiitool) ModelInfo() *ModelInfo
- func (a *Amiitool) ModelInfoRaw() []byte
- func (a *Amiitool) Password() []byte
- func (a *Amiitool) PasswordAcknowledge() []byte
- func (a *Amiitool) Raw() []byte
- func (a *Amiitool) RegisterInfo() *RegisterInfo
- func (a *Amiitool) RegisterInfoRaw() []byte
- func (a *Amiitool) ResetSecurity()
- func (a *Amiitool) Salt() []byte
- func (a *Amiitool) SetDataHMAC(dHmac []byte)
- func (a *Amiitool) SetPassword(pwd [4]byte)
- func (a *Amiitool) SetPasswordAcknowledge(pack [2]byte)
- func (a *Amiitool) SetRegisterInfo(enc []byte)
- func (a *Amiitool) SetSettings(enc []byte)
- func (a *Amiitool) SetTagHMAC(tHmac []byte)
- func (a *Amiitool) Settings() *Settings
- func (a *Amiitool) SettingsRaw() []byte
- func (a *Amiitool) StaticLockBytes() []byte
- func (a *Amiitool) TagHMAC() []byte
- func (a *Amiitool) Type() DumpType
- func (a *Amiitool) UID() []byte
- func (a *Amiitool) UID0() byte
- func (a *Amiitool) UID1() byte
- func (a *Amiitool) UID2() byte
- func (a *Amiitool) UID3() byte
- func (a *Amiitool) UID4() byte
- func (a *Amiitool) UID5() byte
- func (a *Amiitool) UID6() byte
- func (a *Amiitool) Unknown1() byte
- func (a *Amiitool) Unknown2() byte
- func (a *Amiitool) WriteCounter() []byte
- type Charset
- type DerivedKey
- type DeviceType
- type DumpType
- type FavouriteColour
- type FigureType
- type MasterKey
- type Mii
- func (m *Mii) Author() string
- func (m *Mii) BeardColour() int
- func (m *Mii) BeardStyle() int
- func (m *Mii) BirthdayDay() int
- func (m *Mii) BirthdayMonth() int
- func (m *Mii) CanCopy() bool
- func (m *Mii) Charset() Charset
- func (m *Mii) CreatedOn() time.Time
- func (m *Mii) CreatorMac() []byte
- func (m *Mii) Device() DeviceType
- func (m *Mii) EyeColour() int
- func (m *Mii) EyeRotation() int
- func (m *Mii) EyeScale() int
- func (m *Mii) EyeStyle() int
- func (m *Mii) EyeXSpacing() int
- func (m *Mii) EyeYPosition() int
- func (m *Mii) EyeYScale() int
- func (m *Mii) Eyebrow() uint32
- func (m *Mii) EyebrowColour() int
- func (m *Mii) EyebrowRotation() int
- func (m *Mii) EyebrowScale() int
- func (m *Mii) EyebrowStyle() int
- func (m *Mii) EyebrowXSpacing() int
- func (m *Mii) EyebrowYScale() int
- func (m *Mii) EyebrowYSpacing() int
- func (m *Mii) Eyes() uint32
- func (m *Mii) Face() int
- func (m *Mii) FavouriteColour() FavouriteColour
- func (m *Mii) Glasses() uint16
- func (m *Mii) GlassesColour() int
- func (m *Mii) GlassesScale() int
- func (m *Mii) GlassesStyle() int
- func (m *Mii) GlassesYPosition() int
- func (m *Mii) HairColour() int
- func (m *Mii) HairStyle() int
- func (m *Mii) HasMole() bool
- func (m *Mii) Head() int
- func (m *Mii) HeadShape() int
- func (m *Mii) Height() int
- func (m *Mii) ID() uint32
- func (m *Mii) IsFavourite() bool
- func (m *Mii) Makeup() int
- func (m *Mii) MayShare() bool
- func (m *Mii) Mole() uint16
- func (m *Mii) MoleScale() int
- func (m *Mii) MoleXPosition() int
- func (m *Mii) MoleYPosition() int
- func (m *Mii) Moustache() int
- func (m *Mii) MoustacheScale() int
- func (m *Mii) MoustacheYPosition() int
- func (m *Mii) Mouth1() uint16
- func (m *Mii) Mouth2() uint16
- func (m *Mii) Mouth3() uint16
- func (m *Mii) MouthColour() int
- func (m *Mii) MouthScale() int
- func (m *Mii) MouthStyle() int
- func (m *Mii) MouthYPosition() int
- func (m *Mii) MouthYScale() int
- func (m *Mii) Name() string
- func (m *Mii) Nose() uint16
- func (m *Mii) NoseScale() int
- func (m *Mii) NoseStyle() int
- func (m *Mii) NoseYPosition() int
- func (m *Mii) Padding1() []byte
- func (m *Mii) Padding2() []byte
- func (m *Mii) Personal() uint16
- func (m *Mii) Position() int
- func (m *Mii) Profanity() bool
- func (m *Mii) Raw() []byte
- func (m *Mii) Region() int
- func (m *Mii) RegionLock() Region
- func (m *Mii) Sex() MiiSex
- func (m *Mii) SkinTone() SkinTone
- func (m *Mii) SystemID() []byte
- func (m *Mii) Version() int
- func (m *Mii) Width() int
- func (m *Mii) Wrinkles() int
- type MiiSex
- type ModelInfo
- func (mi *ModelInfo) CharacterID() int
- func (mi *ModelInfo) CharacterVariant() int
- func (mi *ModelInfo) FigureType() FigureType
- func (mi *ModelInfo) GameID() int
- func (mi *ModelInfo) ID() []byte
- func (mi *ModelInfo) ModelNumber() int
- func (mi *ModelInfo) Series() Series
- func (mi *ModelInfo) Unknown() int
- type NTAG215
- func (n *NTAG215) BCC0() byte
- func (n *NTAG215) BCC1() byte
- func (n *NTAG215) CFG0() []byte
- func (n *NTAG215) CFG1() []byte
- func (n *NTAG215) CapabilityContainer() []byte
- func (n *NTAG215) DLock0() byte
- func (n *NTAG215) DLock1() byte
- func (n *NTAG215) DLock2() byte
- func (n *NTAG215) DynamicLockBytes() []byte
- func (n *NTAG215) FullUID() []byte
- func (n *NTAG215) Int() byte
- func (n *NTAG215) Lock0() byte
- func (n *NTAG215) Lock1() byte
- func (n *NTAG215) Password() []byte
- func (n *NTAG215) PasswordAcknowledge() []byte
- func (n *NTAG215) RFUI() []byte
- func (n *NTAG215) RandomiseUid(uid0 byte) error
- func (n *NTAG215) Raw() []byte
- func (n *NTAG215) ResetSecurity()
- func (n *NTAG215) SetPassword(pwd [4]byte)
- func (n *NTAG215) SetPasswordAcknowledge(pack [2]byte)
- func (n *NTAG215) SetUID(uid [9]byte) error
- func (n *NTAG215) SetUserData(d [504]byte)
- func (n *NTAG215) StaticLockBytes() []byte
- func (n *NTAG215) UID() []byte
- func (n *NTAG215) UID0() byte
- func (n *NTAG215) UID1() byte
- func (n *NTAG215) UID2() byte
- func (n *NTAG215) UID3() byte
- func (n *NTAG215) UID4() byte
- func (n *NTAG215) UID5() byte
- func (n *NTAG215) UID6() byte
- func (n *NTAG215) UserData() []byte
- func (n *NTAG215) ValidateUID() bool
- type Region
- type RegisterInfo
- func (ri *RegisterInfo) CRC() []byte
- func (ri *RegisterInfo) CRCCounter() uint16
- func (ri *RegisterInfo) CountryCode() int
- func (ri *RegisterInfo) Flags() int
- func (ri *RegisterInfo) LastWriteDate() uint16
- func (ri *RegisterInfo) LastWriteDateAsString() string
- func (ri *RegisterInfo) Nickname() string
- func (ri *RegisterInfo) SetupDate() uint16
- func (ri *RegisterInfo) SetupDateAsString() string
- type RetailKey
- type Series
- type Settings
- type SkinTone
Constants ¶
const ( KeyFileSize = 160 KeyFileMD5 = "45fd53569f5765eef9c337bd5172f937" KeyFileSha1 = "bbdbb49a917d14f7a997d327ba40d40c39e606ce" MaxMagicByteSize = 16 MaxSeedSize = 480 )
const ( DeviceWii DeviceType = 0x10 DeviceDS DeviceType = 0x20 Device3DS DeviceType = 0x30 DeviceWiiUSwitch DeviceType = 0x40 MiiMale MiiSex = 0 MiiFemale MiiSex = 1 RegionNoLock Region = 0 RegionJapan Region = 1 RegionUSA Region = 2 RegionEurope Region = 3 CharsetJapanUsaEurope Charset = 0 CharsetChina Charset = 1 CharsetKorea Charset = 2 CharsetTaiwan Charset = 3 FavColRed FavouriteColour = 0 FavColOrange FavouriteColour = 1 FavColYellow FavouriteColour = 2 FavColLightGreen FavouriteColour = 3 FavColDarkGreen FavouriteColour = 4 FavColDarkBlue FavouriteColour = 5 FavColLightBlue FavouriteColour = 6 FavColPink FavouriteColour = 7 FavColPurple FavouriteColour = 8 FavColBrown FavouriteColour = 9 FavColWhite FavouriteColour = 10 FavColBlack FavouriteColour = 11 SkinLightApricot SkinTone = 0 SkinChardonnay SkinTone = 1 SkinApricot SkinTone = 2 SkinSienna SkinTone = 3 SkinEspresso SkinTone = 4 SkinLightPink SkinTone = 5 SkinMediumPink SkinTone = 6 SkinRawSienna SkinTone = 7 SkinBurntUmber SkinTone = 8 SkinBistre SkinTone = 9 )
const ( TypeFigure FigureType = 0x00 TypeCard FigureType = 0x01 TypeYarn FigureType = 0x02 SeriesSuperSmashBros Series = 0x00 SeriesSuperMario Series = 0x01 SeriesChibiRobo Series = 0x02 SeriesYoshisWoollyWorld Series = 0x03 SeriesSplatoon Series = 0x04 SeriesAnimalCrossing Series = 0x05 SeriesEightBitMario Series = 0x06 SeriesSkylanders Series = 0x07 SeriesUnknown1 Series = 0x08 SeriesTheLegendOfZelda Series = 0x09 SeriesShovelKnight Series = 0x0A SeriesUnknown2 Series = 0x0B SeriesKirby Series = 0x0C SeriesPokemon Series = 0x0D SeriesMarioSportsSuperstars Series = 0x0E SeriesMonsterHunter Series = 0x0F SeriesBoxBoy Series = 0x10 SeriesPikmin Series = 0x11 SeriesFireEmblem Series = 0x12 SeriesMetroid Series = 0x13 SeriesOthers Series = 0x14 SeriesMegaMan Series = 0x15 SeriesDiablo Series = 0x16 )
const ( // CT stands for Cascade Tag and has a fixed value of 0x88 as defined in ISO/IEC 14443-3 Type A. CT = 0x88 // NTAG215Size defines the maximum amount of bytes for an NTAG215 dump. NTAG215Size = 540 )
Variables ¶
var ErrInvalidSize = fmt.Errorf("amiibo: data must be >= %d and <= %d", AmiiboSize, NTAG215Size)
ErrInvalidSize is the error returned when the data provided is too long or too short.
Functions ¶
func NewDataHmac ¶
func NewDataHmac(dataKey *DerivedKey, amiibo Amiidump, tagHmac []byte) []byte
NewDataHmac generates a new data HMAC from the data DerivedKey using unencrypted data AND the tag HMAC generated by NewTagHmac.
func NewTagHmac ¶
func NewTagHmac(tagKey *DerivedKey, amiibo Amiidump) []byte
NewTagHmac generates a new tag HMAC from the tag DerivedKey using unencrypted data.
func Seed ¶
Seed generates the Seed needed to calculate a DerivedKey using the given MasterKey and data.
func Verify ¶
func Verify(amiibo Amiidump, tagKey, dataKey *DerivedKey) bool
Verify checks if the decrypted data signature matches.
Types ¶
type Amiibo ¶
type Amiibo struct{ NTAG215 }
Amiibo embeds NTAG215 which in turn contains binary amiibo data. Amiibo allows easy amiibo manipulation.
func AmiitoolToAmiibo ¶
AmiitoolToAmiibo converts the internal amiitool format to a NTAG215 dump.
func NewAmiibo ¶
NewAmiibo builds a new Amiibo structure based on the given raw NTAG215 data or by converting it from a given Amiitool struct.
func (*Amiibo) GeneratePassword ¶
func (a *Amiibo) GeneratePassword()
GeneratePassword generates the password based on the tag UID where uid byte 0 is skipped as it's always set to 0x04 on an amiibo tag.
func (*Amiibo) ModelInfoRaw ¶
func (*Amiibo) RegisterInfo ¶
func (a *Amiibo) RegisterInfo() *RegisterInfo
func (*Amiibo) RegisterInfoRaw ¶
func (*Amiibo) SetDataHMAC ¶
func (*Amiibo) SetRegisterInfo ¶
func (*Amiibo) SetSettings ¶
func (*Amiibo) SetTagHMAC ¶
func (*Amiibo) SettingsRaw ¶
func (*Amiibo) Unknown1 ¶
Unknown1 is obviously unknown but always seems to be set to 0xa5 which is done when writing to the amiibo.
func (*Amiibo) WriteCounter ¶
type Amiidump ¶
type Amiidump interface {
// DataHMAC returns the HMAC to be verified using a 'data' DerivedKey (using master key
// unfixed-info.bin).
DataHMAC() []byte
// FullUID returns the full UUID including check bytes. All bytes except the last check byte
// are used in the seed and HMAC calculations.
FullUID() []byte
// ModelInfo returns a ModelInfo struct which can be used to extract detailed amiibo info. Since
// this data is not encrypted, it can be accessed at any time.
ModelInfo() *ModelInfo
// ModelInfoRaw returns the raw amiibo model info.
// The model info is also used in the calculation of the 'tag' HMAC concatenated with the Salt.
ModelInfoRaw() []byte
// Raw returns the raw tag data.
Raw() []byte
// RegisterInfo returns a RegisterInfo struct which can be used to extract detailed amiibo info.
// This data is encrypted, so decrypt the amiibo first!
RegisterInfo() *RegisterInfo
// RegisterInfoRaw returns the first part of the data needed to generate the 'data' HMAC using the
// DerivedKey generated from the 'data' master key (usually in a file named unfixed-info.bin).
RegisterInfoRaw() []byte
// Salt returns the 32 bytes used as salt in the Seed.
Salt() []byte
// SetDataHMAC sets the HMAC to sign the 'data' data.
SetDataHMAC(dHmac []byte)
// SetRegisterInfo overwrites the register info with the given data.
SetRegisterInfo(enc []byte)
// SetSettings overwrites the settings data with the given data.
SetSettings(enc []byte)
// SetTagHMAC sets the HMAC to sign the 'tag' data.
SetTagHMAC(tHmac []byte)
// Settings returns the application specific settings and Mii when stored on the amiibo.
Settings() *Settings
// SettingsRaw returns the second block of crypto data. En/decryption must be done by
// prepending RegisterInfoRaw and en/decrypting the entire block in one go.
// This data is encrypted, so decrypt the amiibo first!
SettingsRaw() []byte
// TagHMAC returns the HMAC to be verified using a 'tag' DerivedKey (master key locked-secret.bin).
TagHMAC() []byte
// Type returns the dump type: TypeAmiibo or TypeAmiitool.
Type() DumpType
// Unknown2 is obviously unknown but is used to generate the data HMAC.
Unknown2() byte
// WriteCounter returns the amiibo write counter. This counter is also used as magic bytes to
// create the crypto Seed.
WriteCounter() []byte
}
Amiidump defines the interface necessary to encrypt and convert Amiibo and Amiitool structs.
func Crypt ¶
func Crypt(key *DerivedKey, amiibo Amiidump) Amiidump
Crypt encrypts or decrypts the given data using the provided DerivedKey.
func Decrypt ¶
Decrypt decrypts the given amiibo. It returns a NEW amiibo struct. The original struct remains unaltered. An error is returned if verification after decryption fails. You WILL receive a decrypted Amiibo struct even if an error occured but beware that it might not contain valid amiibo data.
type Amiitool ¶
type Amiitool struct {
// contains filtered or unexported fields
}
Amiitool contains binary amiibo data as structured by the amiitool command (c) 2015-2017 Marcos Del Sol Vives.
func AmiiboToAmiitool ¶
AmiiboToAmiitool converts a full 540 byte NTAG215 dump to internal amiitool format.
func NewAmiitool ¶
NewAmiitool builds a new Amiitool structure based on the given raw amiitool formatted data or by converting it from a given Amiibo struct.
func (*Amiitool) BCC0 ¶
BCC0 returns the first check byte of the serial number. In accordance with ISO/IEC 14443-3 it is calculated as follows: BCC0 = CT ^ UID0 ^ UID1 ^ UID2
func (*Amiitool) BCC1 ¶
BCC1 returns the second check byte of the serial number. In accordance with ISO/IEC 14443-3 it is calculated as follows: BCC1 = UID3 ^ UID4 ^ UID5 ^ UID6
func (*Amiitool) CapabilityContainer ¶
CapabilityContainer returns the capability container which is programmed during the IC production according to the NFC Forum Type 2 Tag specification. Byte 2 in the capability container defines the available memory size for NDEF (NFC Data Exchange Format) messages which is 496 bytes for NTAG215.
func (*Amiitool) FullUID ¶
FullUID returns the 9 byte UID where byte 3 and 8 (the last one) are the check bits.
func (*Amiitool) GeneratePassword ¶
func (a *Amiitool) GeneratePassword()
GeneratePassword generates the password based on the tag UID where uid byte 0 is skipped as it's always set to 0x04 on an amiibo tag.
func (*Amiitool) Lock0 ¶
Lock0 returns the first part of the field programmable read-only locking mechanism also referred to as static lock bytes.
func (*Amiitool) Lock1 ¶
Lock1 returns the second part of the field programmable read-only locking mechanism also referred to as static lock bytes.
func (*Amiitool) ModelInfoRaw ¶
func (*Amiitool) PasswordAcknowledge ¶
PasswordAcknowledge returns the 16bit password acknowledge used during password verification.
func (*Amiitool) RegisterInfo ¶
func (a *Amiitool) RegisterInfo() *RegisterInfo
func (*Amiitool) RegisterInfoRaw ¶
func (*Amiitool) ResetSecurity ¶
func (a *Amiitool) ResetSecurity()
ResetSecurity writes the default amiibo security to the tag. Existing data will be lost beyond recovery.
func (*Amiitool) SetDataHMAC ¶
func (*Amiitool) SetPassword ¶
SetPassword writes the given password to the NFC tag.
func (*Amiitool) SetPasswordAcknowledge ¶
SetPasswordAcknowledge writes the given password acknowledge to the NFC tag.
func (*Amiitool) SetRegisterInfo ¶
func (*Amiitool) SetSettings ¶
func (*Amiitool) SetTagHMAC ¶
func (*Amiitool) SettingsRaw ¶
func (*Amiitool) StaticLockBytes ¶
StaticLockBytes returns the static lock bytes. The three least significant bits of lock byte 0 are the block-locking bits. Bit 2 is for pages 0x0a to 0x0f, bit 1 for pages 0x04 to 0x09 and bit 0 deals with page 0x03 which is the capacity container. A bit value of 1 represents a lock.
func (*Amiitool) Unknown1 ¶
Unknown1 is obviously unknown but always seems to be set to 0xa5 which is done when writing to the amiibo.
func (*Amiitool) WriteCounter ¶
type DerivedKey ¶
DerivedKey holds a derived key for a given amiibo figure.
func NewDerivedKey ¶
func NewDerivedKey(key *MasterKey, amiibo Amiidump) *DerivedKey
NewDerivedKey is in essence a Deterministic Random Bit Generator that will generate a derived key from the given data.
type DeviceType ¶
type DeviceType int
type FavouriteColour ¶
type FavouriteColour int
type FigureType ¶
type FigureType int
type MasterKey ¶
type MasterKey struct {
HmacKey [16]byte
Type [14]byte
Rfu byte
MagicBytesSize byte
MagicBytes [MaxMagicByteSize]byte
XorPad [32]byte
}
MasterKey describes the structure of the info and secret keyfiles needed for amiibo crypto actions.
func (*MasterKey) TypeAsString ¶
TypeAsString returns the master key type as null terminated string.
type Mii ¶
type Mii struct {
// contains filtered or unexported fields
}
Mii represents the mii data structure in the amiibo dump. Note that not all settings are supported by the Switch! The data is primarily little endian.
func (*Mii) BeardColour ¶
func (*Mii) BeardStyle ¶
func (*Mii) BirthdayDay ¶
func (*Mii) BirthdayMonth ¶
func (*Mii) CreatedOn ¶
TODO: fix this conversion, it's off by several years so what's wrong? Switch has a different
offset? Or Switch doesn't store it like birthday day and month?
func (*Mii) CreatorMac ¶
func (*Mii) Device ¶
func (m *Mii) Device() DeviceType
func (*Mii) EyeRotation ¶
func (*Mii) EyeXSpacing ¶
func (*Mii) EyeYPosition ¶
func (*Mii) Eyebrow ¶
Eyebrow data holds:
bit 0-4: eyebrow style bit 5-7: eyebrow colour bit 8-11: eyebrow scale bit 12-14: eyebrow y scale bit 16-19: eyebrow rotation bit 21-24: eyebrow x spacing bit 25-29: eyebrow y position
func (*Mii) EyebrowColour ¶
func (*Mii) EyebrowRotation ¶
func (*Mii) EyebrowScale ¶
func (*Mii) EyebrowStyle ¶
func (*Mii) EyebrowXSpacing ¶
func (*Mii) EyebrowYScale ¶
func (*Mii) EyebrowYSpacing ¶
func (*Mii) Eyes ¶
Eyes data holds:
bit 0-5: eye style bit 6-8: eye colour bit 9-12: eye scale bit 13-15: eye y scale bit 16-20: eye rotation bit 21-24: eye x spacing bit 25-29: eye y position
func (*Mii) FavouriteColour ¶
func (m *Mii) FavouriteColour() FavouriteColour
func (*Mii) Glasses ¶
Glasses data holds:
bit 0-3: glasses style bit 4-6: glasses colour bit 7-10: glasses scale bit 11-15: glasses y position
func (*Mii) GlassesColour ¶
func (*Mii) GlassesScale ¶
func (*Mii) GlassesStyle ¶
func (*Mii) GlassesYPosition ¶
func (*Mii) HairColour ¶
func (*Mii) IsFavourite ¶
func (*Mii) Mole ¶
Mole data holds:
bit 0: enable mole bit 1-4: mole scale bit 5-9: mole x position bit 10-14: mole y position
func (*Mii) MoleXPosition ¶
func (*Mii) MoleYPosition ¶
func (*Mii) MoustacheScale ¶
func (*Mii) MoustacheYPosition ¶
func (*Mii) Mouth1 ¶
Mouth1 data holds:
bit 0-5: mouth style bit 6-8: mouth colour bit 9-12: mouth scale bit 13-15: mouth yscale
func (*Mii) Mouth3 ¶
Mouth3 data holds:
bit 0-2: beard style bit 3-5: beard colour bit 6-9: mustache scale bit 10-14:mustache y position
func (*Mii) MouthColour ¶
func (*Mii) MouthScale ¶
func (*Mii) MouthStyle ¶
func (*Mii) MouthYPosition ¶
func (*Mii) MouthYScale ¶
func (*Mii) Nose ¶
Nose data holds:
bit 0-4: nose style bit 5-8: nose scale bit 9-13: nose y position
func (*Mii) NoseYPosition ¶
func (*Mii) Personal ¶
Personal data holds:
bit 0: sex (0 if male, 1 if female) bit 1-4: birthday month bit 5-9: birthday day bit 10-13: favorite colour bit 14: is favourite (1 is true)
func (*Mii) Region ¶
Region holds:
bit 0: allow copying bit 1: profanity flag (whether in Mii name or creator name does not matter) bit 2-3: region lock (0=no lock, 1=JPN, 2=USA, 3=EUR) bit 4-5:character set(0=JPN+USA+EUR, 1=CHN, 2=KOR, 3=TWN)
func (*Mii) RegionLock ¶
type ModelInfo ¶
type ModelInfo struct {
// contains filtered or unexported fields
}
func (*ModelInfo) CharacterID ¶
CharacterID returns the amiibo character ID which is extracted from the full ID: the last 6 bits of the first two bytes of the full amiibo ID.
func (*ModelInfo) CharacterVariant ¶
CharacterVariant returns the amiibo character variant.
func (*ModelInfo) FigureType ¶
func (mi *ModelInfo) FigureType() FigureType
FigureType returns the type of figure: TypeFigure, TypeCard or TypeYarn.
func (*ModelInfo) GameID ¶
GameID returns the amiibo game ID which is extracted from the full ID: the first 10 bits of the first two bytes of the full amiibo ID.
func (*ModelInfo) ModelNumber ¶
ModelNumber returns the amiibo model number.
type NTAG215 ¶
type NTAG215 struct {
// contains filtered or unexported fields
}
NTAG215 implements the NTAG215 part of the NXP Semiconductors NTAG213/215/216 specification publicly available on the NXP website: https://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf
func NewNTAG215 ¶
func (*NTAG215) BCC0 ¶
BCC0 returns the first check byte of the serial number. In accordance with ISO/IEC 14443-3 it is calculated as follows: BCC0 = CT ^ UID0 ^ UID1 ^ UID2
func (*NTAG215) BCC1 ¶
BCC1 returns the second check byte of the serial number. In accordance with ISO/IEC 14443-3 it is calculated as follows: BCC1 = UID3 ^ UID4 ^ UID5 ^ UID6
func (*NTAG215) CFG0 ¶
CFG0 returns the NTAG215 first configuration page. This page is used to set the ASCII mirror feature. For an Amiibo this should always match 0x00 0x00 0x00 0x04.
func (*NTAG215) CFG1 ¶
CFG1 returns the NTAG215 second configuration page. This page is used to configute memory access restrictions. For an Amiibo this should always match 0x5f 0x00 0x00 0x00.
func (*NTAG215) CapabilityContainer ¶
CapabilityContainer returns the capability container which is programmed during the IC production according to the NFC Forum Type 2 Tag specification. Byte 2 in the capability container defines the available memory size for NDEF (NFC Data Exchange Format) messages which is 496 bytes for NTAG215.
func (*NTAG215) DynamicLockBytes ¶
DynamicLockBytes returns the dynamic lock bytes used for locking pages starting at page 0x10 and upwards which spans a memory area of 456 bytes. For an Amiibo figure, this should always be 0x01 0x00 0x0f.
func (*NTAG215) FullUID ¶
FullUID returns the 9 byte UID where byte 3 and 8 (the last one) are the check bits.
func (*NTAG215) Lock0 ¶
Lock0 returns the first part of the field programmable read-only locking mechanism also referred to as static lock bytes.
func (*NTAG215) Lock1 ¶
Lock1 returns the second part of the field programmable read-only locking mechanism also referred to as static lock bytes.
func (*NTAG215) PasswordAcknowledge ¶
PasswordAcknowledge returns the 16bit password acknowledge used during password verification.
func (*NTAG215) RFUI ¶
RFUI stands for Reserved for future use - implemented. These should all be set to 0x00.
func (*NTAG215) RandomiseUid ¶
RandomiseUid randomises the tag's UID or serial number so that it adheres to ISO/IEC 14443-3 standards. uid0 can be passed in to set byte 0 of the uid. All amiibo seem to have 0x04 set as byte 0 of the UID.
func (*NTAG215) ResetSecurity ¶
func (n *NTAG215) ResetSecurity()
ResetSecurity writes the default amiibo security to the tag. Existing data will be lost beyond recovery.
func (*NTAG215) SetPassword ¶
SetPassword writes the given password to the NFC tag.
func (*NTAG215) SetPasswordAcknowledge ¶
SetPasswordAcknowledge writes the given password acknowledge to the NFC tag.
func (*NTAG215) SetUserData ¶
SetUserData updates the entire user memory to the given byte array.
func (*NTAG215) StaticLockBytes ¶
StaticLockBytes returns the static lock bytes. The three least significant bits of lock byte 0 are the block-locking bits. Bit 2 is for pages 0x0a to 0x0f, bit 1 for pages 0x04 to 0x09 and bit 0 deals with page 0x03 which is the capacity container. A bit value of 1 represents a lock.
func (*NTAG215) ValidateUID ¶
ValidateUID validates the tag's UID or serial number in accordance with ISO/IEC 14443-3.
type RegisterInfo ¶
type RegisterInfo struct {
// contains filtered or unexported fields
}
func (*RegisterInfo) CRC ¶
func (ri *RegisterInfo) CRC() []byte
func (*RegisterInfo) CRCCounter ¶
func (ri *RegisterInfo) CRCCounter() uint16
func (*RegisterInfo) CountryCode ¶
func (ri *RegisterInfo) CountryCode() int
func (*RegisterInfo) Flags ¶
func (ri *RegisterInfo) Flags() int
func (*RegisterInfo) LastWriteDate ¶
func (ri *RegisterInfo) LastWriteDate() uint16
func (*RegisterInfo) LastWriteDateAsString ¶
func (ri *RegisterInfo) LastWriteDateAsString() string
func (*RegisterInfo) Nickname ¶
func (ri *RegisterInfo) Nickname() string
Nickname returns the nickname as configured for the amiibo. When an empty nickname is returned this could mean the nickname could not be read!
func (*RegisterInfo) SetupDate ¶
func (ri *RegisterInfo) SetupDate() uint16
func (*RegisterInfo) SetupDateAsString ¶
func (ri *RegisterInfo) SetupDateAsString() string
type RetailKey ¶
type RetailKey struct {
// Data holds the key usually named unfixed-info.bin
Data MasterKey
// Tag holds the key usually named locked-secret.bin
Tag MasterKey
}
RetailKey describes the structure of the concatenated info and secret files.
func NewRetailKey ¶
NewRetailKey loads the key data from the given file and returns a new populated RetailKey struct.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
func (*Settings) ApplicationData ¶
func (*Settings) ApplicationID ¶
func (*Settings) Mii ¶
Mii returns the Mii struct allowing you to explore the Mii data stored in the amiibo.