-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d39acdf
commit e618416
Showing
22 changed files
with
391 additions
and
57 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,56 @@ | ||
name: "@narval/authz-shared CI" | ||
|
||
on: | ||
push: | ||
paths: | ||
- packages/authz-shared/** | ||
- .github/workflows/authz_shared_ci.yml | ||
- Makefile | ||
- jest.config.ts | ||
- jest.preset.js | ||
- .eslintrc.json | ||
- .prettierrc | ||
- package.json | ||
- package-lock.json | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build and test | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.4.0' | ||
|
||
- name: Install dependencies | ||
run: | | ||
make install/ci | ||
- name: Code format | ||
shell: bash | ||
run: | | ||
make format/check | ||
make lint/check | ||
- name: Test unit | ||
shell: bash | ||
run: | | ||
make authz-shared/test/unit | ||
- name: Send Slack notification on failure | ||
if: failure() | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
username: GitHub | ||
author_name: "@narval/authz-shared CI failed" | ||
status: ${{ job.status }} | ||
fields: message,commit,author | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
|
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
17 changes: 13 additions & 4 deletions
17
apps/orchestration/src/policy-engine/http/rest/dto/signature.dto.ts
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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import { ApiProperty } from '@nestjs/swagger' | ||
import { IsDefined, IsString } from 'class-validator' | ||
import { IsDefined, IsOptional, IsString } from 'class-validator' | ||
|
||
export class SignatureDto { | ||
@IsString() | ||
@IsDefined() | ||
@ApiProperty() | ||
sig: string | ||
|
||
@IsString() | ||
@IsDefined() | ||
@ApiProperty() | ||
hash: string | ||
pubKey: string | ||
|
||
@IsString() | ||
@IsOptional() | ||
@ApiProperty({ | ||
enum: ['ECDSA'] | ||
default: 'ES256K', | ||
enum: ['ES256K'], | ||
required: false | ||
}) | ||
type?: string = 'ECDSA' | ||
alg?: string = 'ES256K' | ||
} |
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,3 @@ | ||
{ | ||
"presets": [["@nrwl/js/babel", { "useBuiltIns": "usage" }]] | ||
} |
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,18 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,7 @@ | ||
AUTHZ_SHARED_PROJECT_NAME := authz-shared | ||
|
||
authz-shared/test/unit: | ||
npx nx test:unit ${AUTHZ_SHARED_PROJECT_NAME} -- ${ARGS} | ||
|
||
authz-shared/test/unit/watch: | ||
make authz-shared/test/unit ARGS=--watch |
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 @@ | ||
# AuthZ Shared | ||
|
||
This library contains the shared kernel like types and utility functions of the | ||
AuthZ application. | ||
|
||
## Testing | ||
|
||
```bash | ||
make authz-shared/test/unit | ||
make authz-shared/test/unit/watch | ||
``` |
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,16 @@ | ||
import type { Config } from 'jest' | ||
|
||
const config: Config = { | ||
displayName: 'authz-shared', | ||
preset: '../../jest.preset.js', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }] | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
moduleNameMapper: { | ||
'^@narval/authz-shared/(.*)$': '<rootDir>/src/$1' | ||
} | ||
} | ||
|
||
export default config |
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,9 @@ | ||
import type { Config } from 'jest' | ||
import sharedConfig from './jest.config' | ||
|
||
const config: Config = { | ||
...sharedConfig, | ||
testMatch: ['<rootDir>/**/__test__/unit/**/*.spec.ts'] | ||
} | ||
|
||
export default config |
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,24 @@ | ||
{ | ||
"name": "authz-shared", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/authz-shared/src", | ||
"projectType": "library", | ||
"targets": { | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["packages/authz-shared/**/*.ts"] | ||
} | ||
}, | ||
"test:unit": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], | ||
"options": { | ||
"jestConfig": "packages/authz-shared/jest.unit.ts", | ||
"verbose": true | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
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,2 @@ | ||
export * from './lib/type/domain.type' | ||
export * from './lib/util/json.util' |
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,56 @@ | ||
export enum Action { | ||
CREATE_USER = 'user:create', | ||
EDIT_USER = 'user:edit', | ||
DELETE_USER = 'user:delete', | ||
CHANGE_USER_ROLE = 'user:change-role', | ||
|
||
CREATE_WALLET = 'wallet:create', | ||
EDIT_WALLET = 'wallet:edit', | ||
ASSIGN_WALLET = 'wallet:assign', | ||
UNASSIGN_WALLET = 'wallet:unassign', | ||
|
||
CREATE_USER_GROUP = 'user-group:create', | ||
EDIT_USER_GROUP = 'user-group:edit', | ||
DELETE_USER_GROUP = 'user-group:delete', | ||
|
||
CREATE_WALLET_GROUP = 'wallet-group:create', | ||
EDIT_WALLET_GROUP = 'wallet-group:edit', | ||
DELETE_WALLET_GROUP = 'wallet-group:delete', | ||
|
||
SET_POLICY_RULES = 'setPolicyRules', | ||
|
||
SIGN_TRANSACTION = 'signTransaction', | ||
SIGN_RAW = 'signRaw', | ||
SIGN_MESSAGE = 'signMessage', | ||
SIGN_TYPED_DATA = 'signTypedData' | ||
} | ||
|
||
export type Hex = `0x${string}` | ||
|
||
export type Address = `0x${string}` | ||
|
||
export type AccessList = { | ||
address: Address | ||
storageKeys: Hex[] | ||
}[] | ||
|
||
/** | ||
* @see https://viem.sh/docs/glossary/types#transactiontype | ||
*/ | ||
export enum TransactionType { | ||
LEGACY = 'legacy', | ||
EIP2930 = 'eip2930', | ||
EIP1559 = 'eip1559' | ||
} | ||
|
||
export type TransactionRequest = { | ||
chainId: number | ||
from: Address | ||
nonce: number | ||
accessList?: AccessList | ||
data?: Hex | ||
gas?: bigint | ||
to?: Address | null | ||
type?: `${TransactionType}` | ||
value?: Hex | ||
} |
Oops, something went wrong.