Skip to content

Commit 27e65ea

Browse files
committed
feat: implement TS SDK @ldclabs/ic-auth
1 parent 346ac1c commit 27e65ea

File tree

16 files changed

+3893
-1
lines changed

16 files changed

+3893
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ Cargo.lock
2424
.dfx
2525
.env
2626
.cargo
27-
.vscode
27+
.vscode
28+
node_modules

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"htmlWhitespaceSensitivity": "strict",
3+
"quoteProps": "preserve",
4+
"semi": false,
5+
"trailingComma": "none",
6+
"singleQuote": true
7+
}

ts/ic-auth/.eslintrc.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/** @type {import('eslint').Linter.Config} */
2+
module.exports = {
3+
root: true,
4+
env: {
5+
browser: true,
6+
esnext: true,
7+
node: true
8+
},
9+
extends: [
10+
'eslint:recommended',
11+
'standard',
12+
'prettier/@typescript-eslint',
13+
'plugin:@typescript-eslint/recommended',
14+
'plugin:import/recommended',
15+
'plugin:prettier/recommended',
16+
'prettier'
17+
],
18+
parser: '@typescript-eslint/parser',
19+
parserOptions: {
20+
ecmaVersion: 'latest',
21+
sourceType: 'module',
22+
project: 'tsconfig.json',
23+
extraFileExtensions: []
24+
},
25+
plugins: ['@typescript-eslint', 'import', 'prettier'],
26+
rules: {
27+
'@typescript-eslint/consistent-type-exports': [
28+
'error',
29+
{ fixMixedExportsWithInlineTypeSpecifier: true }
30+
],
31+
'@typescript-eslint/consistent-type-imports': [
32+
'error',
33+
{ fixStyle: 'inline-type-imports' }
34+
],
35+
'@typescript-eslint/no-empty-function': 'off',
36+
'@typescript-eslint/no-empty-interface': 'off',
37+
'@typescript-eslint/no-unused-vars': 'off',
38+
'import/named': 'off',
39+
'import/newline-after-import': 'error',
40+
'import/no-unresolved': 'off',
41+
'import/order': [
42+
'error',
43+
{
44+
groups: [
45+
['builtin', 'external', 'internal'],
46+
'parent',
47+
['sibling', 'index']
48+
],
49+
'newlines-between': 'never',
50+
alphabetize: { order: 'ignore' }
51+
}
52+
],
53+
'no-console': 'warn',
54+
'no-restricted-imports': [
55+
'error',
56+
{
57+
'paths': []
58+
}
59+
],
60+
'no-useless-rename': 'error',
61+
'object-shorthand': ['error', 'always']
62+
},
63+
settings: {
64+
'import/internal-regex': '^#'
65+
},
66+
ignorePatterns: ['dist', 'node_modules', 'examples', 'scripts']
67+
}

ts/ic-auth/.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"htmlWhitespaceSensitivity": "strict",
3+
"quoteProps": "preserve",
4+
"semi": false,
5+
"trailingComma": "none",
6+
"singleQuote": true
7+
}

ts/ic-auth/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 LDC Labs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

ts/ic-auth/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# `@ldclabs/ic-auth`
2+
![License](https://img.shields.io/crates/l/ic-auth.svg)
3+
[![Test](https://github.com/ldclabs/ic-auth/actions/workflows/test.yml/badge.svg)](https://github.com/ldclabs/ic-auth/actions/workflows/test.yml)
4+
[![NPM version](http://img.shields.io/npm/v/@ldclabs/ic-auth.svg)](https://www.npmjs.com/package/@ldclabs/ic-auth)
5+
6+
[IC-Auth](https://github.com/ldclabs/ic-auth) is a comprehensive web authentication system based on the Internet Computer (ICP) identity.
7+
8+
`@ldclabs/ic-auth` is the Typescript version of the client SDK for the ic-auth.
9+
10+
## License
11+
12+
Copyright © 2024-2025 [LDC Labs](https://github.com/ldclabs).
13+
14+
Licensed under the MIT License. See [LICENSE](../../LICENSE-MIT) for details.

ts/ic-auth/eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import eslintConfigPrettier from "eslint-config-prettier"
2+
3+
export default [
4+
eslintConfigPrettier,
5+
]

ts/ic-auth/package.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "@ldclabs/ic-auth",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"description": "The Typescript version of the client SDK for the IC Auth.",
6+
"license": "MIT",
7+
"homepage": "https://github.com/ldclabs/ic-auth/tree/main/ts/ic-auth",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/ldclabs/ic-auth.git"
11+
},
12+
"engines": {
13+
"node": ">=20.0.0"
14+
},
15+
"browser": {
16+
"node:fs/promises": false,
17+
"node:path": false,
18+
"mime/lite": false
19+
},
20+
"files": [
21+
"dist",
22+
"package.json",
23+
"LICENSE",
24+
"README.md"
25+
],
26+
"main": "./dist/index.js",
27+
"typings": "./dist/index.d.ts",
28+
"scripts": {
29+
"build": "rm -rf dist && tsc -p tsconfig.json",
30+
"format": "prettier --write \"src/**/*.{json,js,jsx,ts,tsx,css,scss}\"",
31+
"test": "vitest run",
32+
"ncu": "npx npm-check-updates -u"
33+
},
34+
"peerDependencies": {
35+
"@dfinity/candid": ">=3.2.0",
36+
"@dfinity/agent": ">=3.2.0",
37+
"@dfinity/identity": ">=3.2.0",
38+
"@dfinity/principal": ">=3.2.0",
39+
"@noble/hashes": ">=1.8.0",
40+
"cborg": ">=4.2.0"
41+
},
42+
"devDependencies": {
43+
"@dfinity/agent": ">=3.2.0",
44+
"@dfinity/identity": ">=3.2.0",
45+
"@dfinity/principal": ">=3.2.0",
46+
"@noble/hashes": "^1.8.0",
47+
"cborg": ">=4.2.0",
48+
"@types/eslint": "^9.6.1",
49+
"@types/node": "24.3.0",
50+
"@typescript-eslint/eslint-plugin": "^8.42.0",
51+
"@typescript-eslint/parser": "^8.42.0",
52+
"eslint": "^9.34.0",
53+
"eslint-config-prettier": "^10.1.8",
54+
"eslint-plugin-import": "^2.32.0",
55+
"eslint-plugin-prettier": "^5.5.4",
56+
"prettier": "^3.6.2",
57+
"typescript": "^5.9.2",
58+
"vitest": "^3.2.4"
59+
}
60+
}

0 commit comments

Comments
 (0)