"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.auth = auth;
var _reactNative = require("react-native");
var _result = require("@synonymdev/result");
const LINKING_ERROR = `The package 'react-native-pubky' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
  ios: "- You have run 'pod install'\n",
  default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
const Pubky = _reactNative.NativeModules.Pubky ? _reactNative.NativeModules.Pubky : new Proxy({}, {
  get() {
    throw new Error(LINKING_ERROR);
  }
});
async function auth(url, secretKey) {
  const res = await Pubky.auth(url, secretKey);
  if (res[0] === 'error') {
    return (0, _result.err)(res[1]);
  }
  return (0, _result.ok)(res[1]);
}
//# sourceMappingURL=index.js.map