Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seed Vault React Native v0.1 #207

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 18 additions & 43 deletions js/packages/seed-vault/package.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,44 @@
{
"name": "@solana-mobile/seed-vault-lib",
"description": "A React Native wrapper of the Solana Mobile, Seed Vault SDK. Apps can use this to interact with seed vault implementations on Android",
"version": "0.0.1",
"version": "0.1.0",
"author": "Marco Martinez <marco.martinez@solanamobile.com>",
"repository": "https://github.com/solana-mobile/sed-vault-sdk",
"repository": "https://github.com/solana-mobile/seed-vault-sdk",
"license": "Apache-2.0",
"type": "module",
"sideEffects": false,
"react-native": "lib/commonjs/index",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/index.d.ts",
"main": "lib/esm/index.native.js",
"react-native": "lib/esm/index.native.js",
"module": "lib/esm/index.native.js",
"types": "lib/types/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./lib/esm/index.native.js"
}
},
"files": [
"android",
"!android/build",
"lib",
"src",
"LICENSE"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"prepack": "bob build",
"release": "release-it",
"example": "yarn --cwd example",
"bootstrap": "yarn example && yarn install && yarn example pods",
"clean": "shx rm -rf lib/*"
"clean": "shx rm -rf lib/*",
"build": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
"build:watch": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
"postbuild": "cross-env echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json"
},
"devDependencies": {
"@release-it/conventional-changelog": "^5.0.0",
"@solana/web3.js": "^1.58.0",
"@types/react-native": "^0.69.3",
"react-native-builder-bob": "^0.20.4",
"release-it": "^15.0.0"
"cross-env": "^7.0.3",
"shx": "^0.3.4"
},
"peerDependencies": {
"react-native": ">0.69"
},
"release-it": {
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}"
},
"npm": {
"publish": true
},
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular"
}
}
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
30 changes: 16 additions & 14 deletions js/packages/seed-vault/src/seedVaultEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ export type ActionFailedError = SeedVaultError;
export type NotModifiedError = SeedVaultError;

// EVENTS
export enum SeedVaultEventType {
AuthorizeSeedAccess = "SeedAuthorized",
CreateNewSeed = "NewSeedCreated",
ImportExistingSeed = "ExistingSeedImported",
PayloadsSigned = "PayloadsSigned",
GetPublicKeys = "PublicKeysEvent",
ContentChange = "SeedVaultContentChange"
}
// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
export const SeedVaultEventType = {
AuthorizeSeedAccess: "SeedAuthorized",
CreateNewSeed: "NewSeedCreated",
ImportExistingSeed: "ExistingSeedImported",
PayloadsSigned: "PayloadsSigned",
GetPublicKeys: "PublicKeysEvent",
ContentChange: "SeedVaultContentChange"
} as const;
export type SeedVaultEventType = typeof SeedVaultEventType[keyof typeof SeedVaultEventType]

export interface ISeedVaultEvent {
__type: SeedVaultEventType;
}

// Authorize Seed Access
export type SeedAccessAuthorizedEvent = Readonly<{
__type: SeedVaultEventType.AuthorizeSeedAccess;
__type: typeof SeedVaultEventType.AuthorizeSeedAccess;
authToken: string
}> &
ISeedVaultEvent;
Expand All @@ -32,7 +34,7 @@ export type AuthorizeSeedAccessEvent = SeedAccessAuthorizedEvent | ActionFailedE

// Create New Seed
export type NewSeedCreatedEvent = Readonly<{
__type: SeedVaultEventType.CreateNewSeed;
__type: typeof SeedVaultEventType.CreateNewSeed;
authToken: string
}> &
ISeedVaultEvent;
Expand All @@ -41,7 +43,7 @@ export type CreateNewSeedEvent = NewSeedCreatedEvent | ActionFailedError

// Import Existing Seed
export type ExistingSeedImportedEvent = Readonly<{
__type: SeedVaultEventType.ImportExistingSeed;
__type: typeof SeedVaultEventType.ImportExistingSeed;
authToken: string
}> &
ISeedVaultEvent;
Expand All @@ -60,7 +62,7 @@ export type SigningResponse = Readonly<{
}>

export type PayloadsSignedEvent = Readonly<{
__type: SeedVaultEventType.PayloadsSigned;
__type: typeof SeedVaultEventType.PayloadsSigned;
result: SigningResponse[]
}> &
ISeedVaultEvent;
Expand All @@ -75,7 +77,7 @@ export type PublicKeyResponse = Readonly<{
}>

export type GotPublicKeyEvent = Readonly<{
__type: SeedVaultEventType.GetPublicKeys;
__type: typeof SeedVaultEventType.GetPublicKeys;
result: PublicKeyResponse[]
}> &
ISeedVaultEvent;
Expand All @@ -84,7 +86,7 @@ export type PublicKeyEvent = GotPublicKeyEvent | ActionFailedError

// Content Change
export type SeedVaultContentChangeNotification = Readonly<{
__type: SeedVaultEventType.ContentChange;
__type: typeof SeedVaultEventType.ContentChange;
uris: string[]
}> &
ISeedVaultEvent;
Expand Down
30 changes: 5 additions & 25 deletions js/packages/seed-vault/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
{
"extends": "../../tsconfig.json",
"include": ["src"],
"compilerOptions": {
"baseUrl": "./",
"paths": {
"react-native-test-library": ["./src/index"]
},
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noStrictGenericChecks": false,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
"declarationDir": "./lib/types",
"outDir": "lib/esm"
}
}
}
Loading