Skip to content

Commit

Permalink
Merge pull request #9 from animo/chore/prepare-for-migration
Browse files Browse the repository at this point in the history
chore: prepare for migration
TimoGlastra authored Jan 9, 2025
2 parents bcbcf4b + fb3ab75 commit 546a1c7
Showing 18 changed files with 1,989 additions and 359 deletions.
12 changes: 12 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"privatePackages": false,
"fixed": [["@openid-federation/*"]],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"snapshot": {
"useCalculatedVersion": true
}
}
5 changes: 5 additions & 0 deletions .changeset/kind-wolves-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openid-federation/core": patch
---

chore: prepare for release at openwallet foundation
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
validate:
runs-on: ubuntu-20.04
name: Validate
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check Style
run: pnpm style:check

- name: Check Types
run: pnpm types:check

- name: Compile
run: pnpm build

tests:
runs-on: ubuntu-20.04
name: Tests

strategy:
fail-fast: false
matrix:
node-version: [18, 20]

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Setup NodeJS
id: setup-node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686
- name: pnpm cache path
id: pnpm-cache-path
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }}
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test
93 changes: 0 additions & 93 deletions .github/workflows/pipeline.yaml

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release-stable:
runs-on: ubuntu-20.04
name: Release Stable
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
title: "chore(release): new version"
commit: "chore(release): new version"
publish: pnpm release
version: pnpm changeset-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get current package version
id: get_version
run: echo "CURRENT_PACKAGE_VERSION=$(node -p "require('./packages/core/package.json').version")" >> $GITHUB_ENV

- name: Create Github Release
if: "startsWith(github.event.head_commit.message, 'chore(release): new version')"
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.CURRENT_PACKAGE_VERSION }}

release-unstable:
runs-on: ubuntu-20.04
name: Release Unstable
if: "always() && github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release): new version')"
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Creating .npmrc
run: |
cat << EOF > ".npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create unstable release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# this ensures there's always a patch release created
cat << 'EOF' > .changeset/snapshot-template-changeset.md
---
'@openid-federation/core': patch
---
snapshot release
EOF
pnpm changeset version --snapshot alpha
pnpm style:fix
pnpm build
pnpm changeset publish --tag alpha
CURRENT_PACKAGE_VERSION=$(node -p "require('./packages/core/package.json').version")
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag v$CURRENT_PACKAGE_VERSION
git push origin v$CURRENT_PACKAGE_VERSION --no-verify
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/node_modules
.DS_Store
**/build
**/dist
*.tgz
47 changes: 15 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://res.cloudinary.com/animo-solutions/image/upload/v1656578320/animo-logo-light-no-text_ok9auy.svg">
<source media="(prefers-color-scheme: dark)" srcset="https://res.cloudinary.com/animo-solutions/image/upload/v1656578320/animo-logo-dark-no-text_fqqdq9.svg">
<img alt="Animo Logo" height="250px" />
</picture>
</p>

<h1 align="center" ><b>OpenID Federation</b></h1>

<h4 align="center">Powered by &nbsp;
<picture>
<source media="(prefers-color-scheme: light)" srcset="https://res.cloudinary.com/animo-solutions/image/upload/v1656579715/animo-logo-light-text_cma2yo.svg">
<source media="(prefers-color-scheme: dark)" srcset="https://res.cloudinary.com/animo-solutions/image/upload/v1656579715/animo-logo-dark-text_uccvqa.svg">
<img alt="Animo Logo" height="12px" />
</picture>
</h4><br>

<!-- TODO: Add relevant badges, like CI/CD, license, codecov, etc. -->

<p align="center">
<a href="https://typescriptlang.org">
<img src="https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg" />
</a>
<a href="https://yarnpkg.com">
<img src="https://img.shields.io/badge/yarn-workspaces-2188b6" />
</a>
</p>

<p align="center">
@@ -37,6 +16,8 @@
<a href="#contributing">Contributing</a>
&nbsp;|&nbsp;
<a href="#contributing">License</a>
&nbsp;|&nbsp;
<a href="#credits">Credits</a>
</p>

---
@@ -45,23 +26,17 @@

All packages are placed in the [`packages/`](./packages) directory.

| Package | Version | Description |
| ------------------------------------------------------------------- | ------- | ---------------------------------- |
| [`@openid-federation/fetch`](./packages/openid-federation-fetch) | 0.1.0 | Fetch implementation which is used to fetch the OpenID Federation. |
| [`@openid-federation/policies`](./packages/openid-federation-policies) | 0.1.0 | Policies for OpenID Federation shared. |
| [`@openid-federation/registry`](./packages/openid-federation-registry) | 0.1.0 | Implementation of the registry for OpenID Federation. |
| [`@openid-federation/registry-policies`](./packages/openid-federation-registry-policies) | 0.1.0 | Policies for the registry for OpenID Federation. |
| [`@openid-federation/resolver`](./packages/openid-federation-resolver) | 0.1.0 | Resolver implementation for OpenID Federation. |
| [`@openid-federation/resolver-policies`](./packages/openid-federation-resolver-policies) | 0.1.0 | Policies for the resolver for OpenID Federation. |


| Package | Version | Description |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| [`@openid-federation/core`](./packages/core) | [![OpenID Federation Core version on NPM](https://img.shields.io/npm/v/@openid-federation/core)](https://npmjs.com/package/@openid-federation/core) | Core implementation of OpenID Federation. |

## Getting Started

<details>
<summary>pnpm</summary>

Install dependencies:

```sh
$ pnpm install
```
@@ -70,7 +45,12 @@ $ pnpm install

## Usage

<!-- TODO: Add usage guide here -->
```sh
# npm install @openid-federation/core
# yarn install @openid-federation/core

pnpm install @openid-federation/core
```

## Contributing

@@ -81,3 +61,6 @@ contributions! To get involved, please follow our [contribution guidelines](./CO

This project is licensed under the Apache License Version 2.0 (Apache-2.0).

## Credits

This library was initially created by [Animo](https://github.com) as part of the [SPRIN-D EUDI Wallet Prototypes Funke](https://www.sprind.org/en/impulses/challenges/eudi-wallet-prototypes).
21 changes: 16 additions & 5 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"maxSize": 10000000,
"ignore": ["lerna.json"]
"maxSize": 10000000
},
"formatter": {
"lineWidth": 120,
@@ -35,7 +34,6 @@
},
"linter": {
"enabled": true,
"ignore": ["__tests__/*.ts"],
"rules": {
"recommended": true,
"performance": {
@@ -46,5 +44,18 @@
"useNodejsImportProtocol": { "level": "off" }
}
}
}
},
"overrides": [
{
"include": ["__tests__/*.ts"],
"linter": {
"rules": {
"style": {
"useNodejsImportProtocol": "error",
"noNonNullAssertion": "off"
}
}
}
}
]
}
6 changes: 0 additions & 6 deletions lerna.json

This file was deleted.

37 changes: 17 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
{
"name": "openid-federation-ts",
"private": true,
"version": "0.0.0",
"description": "Openid Federation implementation",
"author": "Animo Solutions",
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rimraf **/build",
"clean:deps ": "pnpm clean && rimraf node_modules",
"build": "pnpm -r build",
"style:check": "pnpm biome check .",
"style:fix": "pnpm style:check --write --unsafe",
"types:check": "pnpm build --noEmit",
"test": "pnpm -r test",
"release": "lerna publish",
"validate": "pnpm types:check && pnpm style:check"
"style:check": "biome check . --unsafe",
"style:fix": "pnpm style:check --write",
"types:check": "tsc --noEmit",
"test": "node --import tsx --test packages/core/__tests__/*.test.ts",
"release": "pnpm build && pnpm changeset publish --no-git-tag",
"changeset-version": "pnpm changeset version && pnpm style:fix"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"rimraf": "^6.0.0",
"tsx": "^4.19.2"
"@biomejs/biome": "catalog:",
"@changesets/cli": "catalog:",
"@types/node": "catalog:",
"rimraf": "catalog:",
"tsup": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:"
},
"engines": {
"node": ">=18"
},
"pnpm": {
"overrides": {
"typescript": "~5.5.3",
"@types/node": "^20.14.10",
"ts-node": "^10.9.2"
}
}
"packageManager": "pnpm@9.15.3+sha256.c1da43727ccbc1ed42aff4fd6bdb4b1e91e65a818e6efff5b240fbf070ba4eaf"
}
9 changes: 9 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h1 align="center" ><b>OpenID Federation - Core</b></h1>

<p align="center">
<a href="https://typescriptlang.org">
<img src="https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg" />
</a>
</p>

Check out the documentation in the [Github repository](https://github.com/openwallet-foundation-labs/openid-federation-ts).
32 changes: 16 additions & 16 deletions packages/core/__tests__/fetchEntityConfigurationChains.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import nock from 'nock'
import { EntityConfigurationClaimsOptions, fetchEntityConfigurationChains } from '../src/entityConfiguration'
import { type EntityConfigurationClaimsOptions, fetchEntityConfigurationChains } from '../src/entityConfiguration'
import type { SignCallback, VerifyCallback } from '../src/utils'
import { setupConfigurationChain } from './utils/setupConfigurationChain'

@@ -37,10 +37,10 @@ describe('fetch entity configuration chains', () => {
})

assert.strictEqual(trustChains.length, 1)
assert.strictEqual(trustChains[0]!.length, 2)
assert.strictEqual(trustChains[0]?.length, 2)

assert.deepStrictEqual(trustChains[0]![0], claims[0])
assert.deepStrictEqual(trustChains[0]![1], claims[1])
assert.deepStrictEqual(trustChains[0]?.[0], claims[0])
assert.deepStrictEqual(trustChains[0]?.[1], claims[1])

for (const scope of scopes) {
scope.done()
@@ -83,11 +83,11 @@ describe('fetch entity configuration chains', () => {
})

assert.strictEqual(trustChains.length, 1)
assert.strictEqual(trustChains[0]!.length, 3)
assert.strictEqual(trustChains[0]?.length, 3)

assert.deepStrictEqual(trustChains[0]![0], claims[0])
assert.deepStrictEqual(trustChains[0]![1], claims[1])
assert.deepStrictEqual(trustChains[0]![2], claims[2])
assert.deepStrictEqual(trustChains[0]?.[0], claims[0])
assert.deepStrictEqual(trustChains[0]?.[1], claims[1])
assert.deepStrictEqual(trustChains[0]?.[2], claims[2])

for (const scope of scopes) {
scope.done()
@@ -130,10 +130,10 @@ describe('fetch entity configuration chains', () => {
})

assert.strictEqual(trustChains.length, 1)
assert.strictEqual(trustChains[0]!.length, 2)
assert.strictEqual(trustChains[0]?.length, 2)

assert.deepStrictEqual(trustChains[0]![0], claims[0])
assert.deepStrictEqual(trustChains[0]![1], claims[1])
assert.deepStrictEqual(trustChains[0]?.[0], claims[0])
assert.deepStrictEqual(trustChains[0]?.[1], claims[1])

for (const scope of scopes) {
scope.done()
@@ -186,8 +186,8 @@ describe('fetch entity configuration chains', () => {
})

assert.strictEqual(trustChains.length, 2)
assert.strictEqual(trustChains[0]!.length, 3)
assert.strictEqual(trustChains[1]!.length, 3)
assert.strictEqual(trustChains[0]?.length, 3)
assert.strictEqual(trustChains[1]?.length, 3)

for (const scope of scopes) {
scope.done()
@@ -240,7 +240,7 @@ describe('fetch entity configuration chains', () => {
})

assert.strictEqual(trustChains.length, 1)
assert.strictEqual(trustChains[0]!.length, 3)
assert.strictEqual(trustChains[0]?.length, 3)

for (const scope of scopes) {
scope.done()
@@ -262,7 +262,7 @@ describe('fetch entity configuration chains', () => {

const trustChains = await fetchEntityConfigurationChains({
verifyJwtCallback,
leafEntityId: configurations[0]!.entityId,
leafEntityId: configurations[0]?.entityId,
trustAnchorEntityIds: ['https://trust.example.org'],
})

@@ -306,7 +306,7 @@ describe('fetch entity configuration chains', () => {

const trustChains = await fetchEntityConfigurationChains({
verifyJwtCallback,
leafEntityId: configurations[0]!.entityId,
leafEntityId: configurations[0]?.entityId,
trustAnchorEntityIds: [trustAnchorEntityId],
})

40 changes: 20 additions & 20 deletions packages/core/__tests__/fetchEntityStatementChain.test.ts
Original file line number Diff line number Diff line change
@@ -47,10 +47,10 @@ describe('fetch entity statement chain', () => {
})

assert.strictEqual(chains.length, 1)
assert.strictEqual(chains[0]!.length, 2)
assert.strictEqual(chains[0]?.length, 2)

assert.deepStrictEqual(chains[0]![0], claims[0])
assert.deepStrictEqual(chains[0]![1], claims[1])
assert.deepStrictEqual(chains[0]?.[0], claims[0])
assert.deepStrictEqual(chains[0]?.[1], claims[1])

const statements = await fetchEntityStatementChain({
verifyJwtCallback,
@@ -59,11 +59,11 @@ describe('fetch entity statement chain', () => {

assert.strictEqual(statements.length, 2)

assert.deepStrictEqual(statements[0]!.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[0]!.sub, leafEntityId)
assert.deepStrictEqual(statements[0]?.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[0]?.sub, leafEntityId)

assert.deepStrictEqual(statements[1]!.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[1]!.sub, trustAnchorEntityId)
assert.deepStrictEqual(statements[1]?.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[1]?.sub, trustAnchorEntityId)

for (const scope of scopes) {
scope.done()
@@ -113,11 +113,11 @@ describe('fetch entity statement chain', () => {
})

assert.strictEqual(chains.length, 1)
assert.strictEqual(chains[0]!.length, 3)
assert.strictEqual(chains[0]?.length, 3)

assert.deepStrictEqual(chains[0]![0], claims[0])
assert.deepStrictEqual(chains[0]![1], claims[1])
assert.deepStrictEqual(chains[0]![2], claims[2])
assert.deepStrictEqual(chains[0]?.[0], claims[0])
assert.deepStrictEqual(chains[0]?.[1], claims[1])
assert.deepStrictEqual(chains[0]?.[2], claims[2])

const statements = await fetchEntityStatementChain({
verifyJwtCallback,
@@ -126,14 +126,14 @@ describe('fetch entity statement chain', () => {

assert.strictEqual(statements.length, 3)

assert.deepStrictEqual(statements[0]!.iss, intermediateEntityId)
assert.deepStrictEqual(statements[0]!.sub, leafEntityId)
assert.deepStrictEqual(statements[0]?.iss, intermediateEntityId)
assert.deepStrictEqual(statements[0]?.sub, leafEntityId)

assert.deepStrictEqual(statements[1]!.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[1]!.sub, intermediateEntityId)
assert.deepStrictEqual(statements[1]?.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[1]?.sub, intermediateEntityId)

assert.deepStrictEqual(statements[2]!.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[2]!.sub, trustAnchorEntityId)
assert.deepStrictEqual(statements[2]?.iss, trustAnchorEntityId)
assert.deepStrictEqual(statements[2]?.sub, trustAnchorEntityId)

for (const scope of scopes) {
scope.done()
@@ -175,10 +175,10 @@ describe('fetch entity statement chain', () => {
})

assert.strictEqual(chains.length, 1)
assert.strictEqual(chains[0]!.length, 2)
assert.strictEqual(chains[0]?.length, 2)

assert.deepStrictEqual(chains[0]![0], claims[0])
assert.deepStrictEqual(chains[0]![1], claims[1])
assert.deepStrictEqual(chains[0]?.[0], claims[0])
assert.deepStrictEqual(chains[0]?.[1], claims[1])

await assert.rejects(
fetchEntityStatementChain({
35 changes: 24 additions & 11 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -3,24 +3,37 @@
"version": "0.1.1-alpha.19",
"description": "Core types and functionality of openid federation",
"license": "Apache-2.0",
"exports": "./src/index.ts",
"files": ["dist"],
"publishConfig": {
"access": "public"
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./package.json": "./package.json"
}
},
"homepage": "https://github.com/openwallet-foundation-labs/openid-federation-ts/tree/main/packages/core",
"repository": {
"type": "git",
"url": "https://github.com/openwallet-foundation-labs/openid-federation-ts",
"directory": "packages/core"
},
"main": "build/index.js",
"keywords": [],
"author": "Animo Solutions",
"scripts": {
"build": "tsc",
"test": "node --require ts-node/register --test __tests__/*.test.ts"
"build": "tsup src/index.ts --format cjs,esm --dts --clean --sourcemap"
},
"dependencies": {
"buffer": "^6.0.3",
"zod": "^3.23.8"
"buffer": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
"@types/node": "*",
"nock": "14.0.0-beta.7",
"ts-node": "*",
"typescript": "*"
"nock": "catalog:",
"tsup": "catalog:"
}
}
1 change: 0 additions & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./build"
}
}
1,800 changes: 1,656 additions & 144 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
packages:
- 'packages/*'
- "packages/*"

catalog:
typescript: ~5.6.3
"@types/node": ^20.14.10
nock: 14.0.0-beta.7
buffer: ^6.0.3
zod: ^3.23.8
rimraf: ^6.0.0
"@biomejs/biome": ^1.9.4
"@changesets/cli": ^2.27.9
tsup: ^8.3.5
tsx: ^4.19.2
19 changes: 10 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"outDir": "build",
"target": "es2016",
"lib": ["ES2021"],
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"module": "Node16",
"target": "ES2020",
"declaration": true,
"sourceMap": true,
"noUncheckedIndexedAccess": true
"strict": true,
"skipLibCheck": true,
"noEmitOnError": true,
"lib": ["ES2020"],
"types": ["node"],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"exclude": ["**/__tests__", "**/build"]
"exclude": ["**/build", "__tests__"]
}

0 comments on commit 546a1c7

Please sign in to comment.