This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
// ############# | |
// Reads data from tag and tries to call Sonos API with spotify URI from tag | |
// ############# | |
import { NFC, CONNECT_MODE_DIRECT } from '../src/index'; | |
import pretty from './pretty-logger'; | |
const request = require('request'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// blake2b(n || seed, dkLen = 32) | |
fun deriveKeyFromSeed(seed: String, index: Int) : String { | |
val param = Blake2b.Param().setDigestLength(32) | |
val blake2b = Blake2b.Digest.newInstance(param) | |
val indexBytes = hexStringToByteArray(String.format("%08x", index)) | |
blake2b.update(hexStringToByteArray(seed)) | |
blake2b.update(indexBytes) | |
val output = blake2b.digest() |