New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@opacity-labs/capacitor-opacity

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opacity-labs/capacitor-opacity

Opacity SDK for CapacitorJS

  • 5.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
0
Weekly downloads
 
Created
Source

capacitor-opacity

Opacity SDK for CapacitorJS. Only works on iOS and Android.

Install

npm install capacitor-opacity
npx cap sync

Android

You need to modify your project root gradle to include jitpack.io and mozilla's maven repos:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        mavenCentral()
        maven { url "https://maven.mozilla.org/maven2/" } // ADD THIS
        maven { url 'https://jitpack.io' } // ADD THIS
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.7.2'
        classpath 'com.google.gms:google-services:4.4.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: "variables.gradle"

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://maven.mozilla.org/maven2/" } // ADD THIS
        maven { url 'https://jitpack.io' } // ADD THIS
    }
}

Bump the minSdk version to 25, in variables.gradle:

ext {
    minSdkVersion = 25
    ...
}

Usage

You need to initialize the SDK first before calling the get function to get the requested resource:

import { Opacity, OpacityEnvironment } from 'capacitor-opacity';

const apiKey = import.meta.env.VITE_OPACITY_API_KEY;

window.initializeSDK = async () => {
  try {
    await Opacity.initialize({ apiKey, dryRun: false, environment: OpacityEnvironment.Production });
    console.log('SDK Initialized');
  } catch (e) {
    console.error(`SDK Not Initialized: ${e}`);
  }
};

window.getGithubProfile = async () => {
  try {
    const res = await Opacity.get({ name: 'flow:github:profile' });
    console.log('GOT GITHUB PROFILE! 🟦🟩🟩');
    console.log(JSON.stringify(res));
  } catch (e) {
    console.error(`Error: ${e}`);
  }
};

window.getUberRiderProfile = async () => {
  try {
    const res = await Opacity.get({ name: 'flow:uber_rider:profile' });
    console.log('GOT UBER RIDER PROFILE! 🟦🟩🟩');
    console.log(JSON.stringify(res));
  } catch (e) {
    console.error(`Error: ${e}`);
  }
};

Keywords

FAQs

Package last updated on 10 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc