JS library for cross-domain communication solution to share data and many more functionalities with simple as just calling a method
Installations
npm install bifrost-cors
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.16.3
NPM Version
6.9.0
Score
71.1
Supply Chain
98.8
Quality
75.2
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
GitHub Statistics
23 Stars
48 Commits
3 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
1.0.4
Package Id
bifrost-cors@1.0.4
Unpacked Size
112.76 kB
Size
62.63 kB
File Count
6
NPM Version
6.9.0
Node Version
10.16.3
Total Downloads
Cumulative downloads
Total Downloads
0
Last day
0%
0
Compared to previous day
Last week
0%
0
Compared to previous week
Last month
0%
0
Compared to previous month
Last year
0%
0
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
Bifrost-CORS
A cross-domain communication solution to share data and many more functionalities with simple as just calling a method.
Get Started
NPM Install
npm install bifrost-cors
CDN Link (6.39KB)
https://cdn.jsdelivr.net/gh/spurushottam13/bifrost-cors/index.min.js
GZIP version of File (1.7KB)
https://cdn.jsdelivr.net/gh/spurushottam13/bifrost-cors/index.min.gz
Functionalities can be performed on CROS Domain
-
Get, Set Cookie
-
Get, Set & Delete Local Stroage
-
Bi-directional message thread
-
Run JS expression from one domain to other
-
DOM Manipulation from one domain to other domain ( Iframe )
All above methods are wrapped in a promise.
Initialize Bifrost-CORS You have to Initialize Bifrost-CORS in both domain
1var bifrostCors = new bifrostCors(address, iframeBoolean,iframeId)
Parameter | Required | Value |
---|---|---|
address | YES | Exact Address of the other domain |
iframeBoolean | No | true :- If you already rendering the other domain in iframe false If you are not rendering the other domain in iframe Default false |
iframeId | No | if iframeBoolean is set to true then you need to pass the ID for your Iframe in which you loading the other domain |
Implementation of methods and how to handle promise
1var bifrostCors = new bifrostCors("http://example.com/",false) 2 3//Calling Methods without promise 4var result = bifrostCors.getLocalStorage(key) 5 6//Hanlde Promise 7 8//1. Using .then() 9bifrostCors.getLocalStorage(key).then((data) => { 10 console.log(data) 11 }) 12 13//2. Using async function 14async function grabLocalStorage(){ 15 let result = await bifrostCors.getLocalStorage(key) 16}
Functionalities
-
Cookies
- Get Cookies
1// return type Object, return all cookies 2bifrostCors.getCookie() 3 4// return type string 5bifrostCors.getCookie("key")
- Set Cookies
1bifrostCors.setCookie(name,value,days)
- Parameter
- name String, name for cookie
- value String, value for cookie
- days int, expiration days for cookie
- return type Boolean
-
LocalStorage
- Get local Storage
1// return type stirng 2bifrostCors.getgetLocalStorage("key") 3 4// return type array 5bifrostCors.getLocalStorage(["key1","key2"])
- Set local Storage
1// return type Boolean 2bifrostCors.setLocalStorage({key: "user", value: "user-1"})
- Delete local Storage
1// return type Boolean 2bifrostCors.deleteLocalStorage("key") 3 4// return type Boolean 5bifrostCors.deleteLocalStorage(["key1","key2"])
-
Bi-directional message thread
- Request Message Thread
1// return type Boolean, parameter type funtion 2bifrostCors.requestMessageThread(Listner)
Listner is your custom function which will be invoked every time new message recivied, and it should expect a new message as a parameter
Here's exapmle
1function myCustomListner(newMessage){ 2 cosnole.log("Hurray I got new message ",newMessage) 3 } 4 5 bifrostCors.requestMessageThread(myCustomListner)
- Send Message
1// return type Boolean, parameter type string|int|array|object 2bifrostCors.send(message)
-
Run JS expression
1// return type Boolean, parameter type string 2bifrostCors.runExpression(expression)
-
DOM Manipulation
- DOM Manipulation by ID
1// return type Boolean, parameter type string 2bifrostCors.domManipulationById("yourElementID")
- DOM Manipulation by class name
1// return type Boolean, parameter type string,int,Objet 2bifrostCors.domManipulationById(class,index,style)
- Parameter
- class String your element class name
- index int index no of that element in class array
- style Object Style object
- Example:a
if you can access element by
document.getElementsByClassName("myElementClass)[4]
so parameter will be
- class "myElementClass"
- index 4
- style {background:"red"}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More