-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/blockchain-lab-um/ssi-snap
- Loading branch information
Showing
14 changed files
with
298 additions
and
190 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.15.1 | ||
- run: yarn install | ||
- run: yarn build | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16.15.1 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: yarn install | ||
- run: yarn build | ||
- run: yarn publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { Response } from "./../interfaces"; | ||
import { | ||
_changeInfuraToken, | ||
_togglePopups, | ||
_addFriendlyDapp, | ||
_getFriendlyDapps, | ||
_removeFriendlyDapp, | ||
} from "./../utils/snap_utils"; | ||
import { getConfig } from "./../utils/state_utils"; | ||
|
||
export async function togglePopups(): Promise<Response> { | ||
const config = await getConfig(); | ||
|
||
const result = | ||
config.dApp.disablePopups || | ||
(await wallet.request({ | ||
method: "snap_confirm", | ||
params: [ | ||
{ | ||
prompt: `Toggle Popups`, | ||
description: "Would you like to toggle the popups to following?", | ||
textAreaContent: | ||
"Current setting: " + | ||
config.dApp.disablePopups + | ||
"\n" + | ||
"New setting: " + | ||
!config.dApp.disablePopups, | ||
}, | ||
], | ||
})); | ||
if (result) { | ||
await await _togglePopups(); | ||
return { data: true }; | ||
} else { | ||
return { data: false, error: "Request declined" }; | ||
} | ||
} | ||
|
||
export async function changeInfuraToken(token?: string): Promise<Response> { | ||
if (token != null && token != "") { | ||
const config = await getConfig(); | ||
const result = await wallet.request({ | ||
method: "snap_confirm", | ||
params: [ | ||
{ | ||
prompt: `Change Infura Token`, | ||
description: | ||
"Would you like to change the infura token to following?", | ||
textAreaContent: | ||
"Current token: " + | ||
config.veramo.infuraToken + | ||
"\n" + | ||
"New token: " + | ||
token, | ||
}, | ||
], | ||
}); | ||
if (result) { | ||
await _changeInfuraToken(token); | ||
return { data: true }; | ||
} else { | ||
return { data: false, error: "Request declined" }; | ||
} | ||
} else { | ||
return { error: "Missing parameter: infuraToken" }; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { list_vcs } from "../utils/veramo_utils"; | ||
import { Response } from "../interfaces"; | ||
import { getConfig } from "../utils/state_utils"; | ||
|
||
export async function getVCs(querry?: any): Promise<Response> { | ||
console.log("querry", querry); | ||
let vcs = await list_vcs(querry); | ||
const config = await getConfig(); | ||
console.log("VCs: ", vcs); | ||
|
||
const result = | ||
config.dApp.disablePopups || | ||
(await wallet.request({ | ||
method: "snap_confirm", | ||
params: [ | ||
{ | ||
prompt: `Send VCs`, | ||
description: "Are you sure you want to send VCs to the dApp?", | ||
textAreaContent: | ||
"Some dApps are less secure than others and could save data from VCs against your will. Be careful where you send your private VCs! Number of VCs submitted is " + | ||
vcs.length, | ||
}, | ||
], | ||
})); | ||
if (result) { | ||
return { data: { vcs: vcs } }; | ||
} else { | ||
return { error: "User rejected" }; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { create_vp } from "../utils/veramo_utils"; | ||
|
||
export async function getVP(vc_id: string, domain: string, challenge: string) { | ||
if (vc_id) { | ||
let vp = await create_vp(vc_id, challenge, domain); | ||
return { data: vp }; | ||
} else { | ||
console.log("Missing parameters: vc_id"); | ||
return { error: "Missing parameter: vc_id" }; | ||
} | ||
} |
Oops, something went wrong.