@originator-profile/opvc 0.6.1 → 0.7.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # opvc - Originator Profile Verifiable Credential command line tool
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@originator-profile/opvc)](https://www.npmjs.com/package/@originator-profile/opvc) [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@originator-profile/opvc)
4
+
3
5
  Originator Profile (OP) 仕様に準拠した Verifiable Credential (VC) を作成・管理するためのツールです。
4
6
 
5
7
  <!-- prettier-ignore-start -->
@@ -135,7 +137,7 @@ FLAG DESCRIPTIONS
135
137
  }
136
138
  ```
137
139
 
138
- _See code: [src/commands/ca/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.1/packages/opvc/src/commands/ca/sign.ts)_
140
+ _See code: [src/commands/ca/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.7.0-beta.2/packages/opvc/src/commands/ca/sign.ts)_
139
141
 
140
142
  ## `opvc ca:unsigned`
141
143
 
@@ -220,7 +222,7 @@ FLAG DESCRIPTIONS
220
222
  }
221
223
  ```
222
224
 
223
- _See code: [src/commands/ca/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.1/packages/opvc/src/commands/ca/unsigned.ts)_
225
+ _See code: [src/commands/ca/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.7.0-beta.2/packages/opvc/src/commands/ca/unsigned.ts)_
224
226
 
225
227
  ## `opvc help [COMMAND]`
226
228
 
@@ -240,7 +242,7 @@ DESCRIPTION
240
242
  Display help for opvc.
241
243
  ```
242
244
 
243
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.48/src/commands/help.ts)_
245
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.55/src/commands/help.ts)_
244
246
 
245
247
  ## `opvc key-gen`
246
248
 
@@ -258,7 +260,7 @@ DESCRIPTION
258
260
  鍵ペアの生成
259
261
  ```
260
262
 
261
- _See code: [src/commands/key-gen/index.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.1/packages/opvc/src/commands/key-gen/index.ts)_
263
+ _See code: [src/commands/key-gen/index.ts](https://github.com/originator-profile/originator-profile/blob/v0.7.0-beta.2/packages/opvc/src/commands/key-gen/index.ts)_
262
264
 
263
265
  ## `opvc sign`
264
266
 
@@ -425,7 +427,7 @@ FLAG DESCRIPTIONS
425
427
  }
426
428
  ```
427
429
 
428
- _See code: [src/commands/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.1/packages/opvc/src/commands/sign.ts)_
430
+ _See code: [src/commands/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.7.0-beta.2/packages/opvc/src/commands/sign.ts)_
429
431
 
430
432
  ## `opvc wsp:sign`
431
433
 
@@ -563,7 +565,7 @@ FLAG DESCRIPTIONS
563
565
  ]
564
566
  ```
565
567
 
566
- _See code: [src/commands/wsp/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.1/packages/opvc/src/commands/wsp/sign.ts)_
568
+ _See code: [src/commands/wsp/sign.ts](https://github.com/originator-profile/originator-profile/blob/v0.7.0-beta.2/packages/opvc/src/commands/wsp/sign.ts)_
567
569
 
568
570
  ## `opvc wsp:unsigned`
569
571
 
@@ -693,7 +695,7 @@ FLAG DESCRIPTIONS
693
695
  ]
694
696
  ```
695
697
 
696
- _See code: [src/commands/wsp/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.6.1/packages/opvc/src/commands/wsp/unsigned.ts)_
698
+ _See code: [src/commands/wsp/unsigned.ts](https://github.com/originator-profile/originator-profile/blob/v0.7.0-beta.2/packages/opvc/src/commands/wsp/unsigned.ts)_
697
699
  <!-- commandsstop -->
698
700
  <!-- prettier-ignore-end -->
699
701
 
@@ -1,4 +1,4 @@
1
- import { n as sign } from "../../content-attestation-Dd-YcVIv.js";
1
+ import { n as sign } from "../../content-attestation-BydW0zgM.js";
2
2
  import { r as privateKey, t as expirationDate } from "../../flags-BSM3ANoc.js";
3
3
  import { Command, Flags } from "@oclif/core";
4
4
  import fs from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { r as unsignedCa } from "../../content-attestation-Dd-YcVIv.js";
1
+ import { r as unsignedCa } from "../../content-attestation-BydW0zgM.js";
2
2
  import { t as expirationDate } from "../../flags-BSM3ANoc.js";
3
3
  import { Command, Flags } from "@oclif/core";
4
4
  import fs from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { t as sign } from "../../website-profile-Brt0iuRN.js";
1
+ import { t as sign } from "../../website-profile-B_7x7iSY.js";
2
2
  import { r as privateKey, t as expirationDate } from "../../flags-BSM3ANoc.js";
3
3
  import { Command, Flags } from "@oclif/core";
4
4
  import fs from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { n as unsignedWsp } from "../../website-profile-Brt0iuRN.js";
1
+ import { n as unsignedWsp } from "../../website-profile-B_7x7iSY.js";
2
2
  import { t as expirationDate } from "../../flags-BSM3ANoc.js";
3
3
  import { Command, Flags } from "@oclif/core";
4
4
  import fs from "node:fs/promises";
@@ -34,9 +34,9 @@ var content_attestation_exports = /* @__PURE__ */ __exportAll({
34
34
  * @throws {BadRequestError} 入力が UnsignedContentAttestation スキーマに適合しない場合/検証対象のコンテンツが存在しない/コンテンツにアクセスできない/Integrityの計算に失敗
35
35
  * @return 未署名 Content Attestation オブジェクト
36
36
  */
37
- async function unsignedCa(uca, { integrityAlg = "sha256", documentProvider: documentProvider$1 = documentProvider, ...timingOptions }) {
37
+ async function unsignedCa(uca, { integrityAlg = "sha256", documentProvider: documentProvider$1 = documentProvider, assignId = true, ...timingOptions }) {
38
38
  const { issuedAt, expiredAt } = parseDates(timingOptions);
39
- uca.credentialSubject.id ??= `urn:uuid:${crypto.randomUUID()}`;
39
+ if (assignId) uca.credentialSubject.id ??= `urn:uuid:${crypto.randomUUID()}`;
40
40
  try {
41
41
  UnsignedContentAttestation.parse(uca);
42
42
  await Promise.all([fetchAndSetDigestSri(integrityAlg, uca.credentialSubject.image), fetchAndSetTargetIntegrity(integrityAlg, uca, documentProvider$1)]);
@@ -54,16 +54,16 @@ async function unsignedCa(uca, { integrityAlg = "sha256", documentProvider: docu
54
54
  /**
55
55
  * Content Attestation への署名
56
56
  * @param uca 未署名 Content Attestation オブジェクト
57
- * @param privateKey プライベート鍵
57
+ * @param signer プライベート鍵、または HSM・KMS・WebAuthn等の外部署名者 (JwtSigner)
58
58
  * @throws {BadRequestError} 入力が UnsignedContentAttestation スキーマに適合しない場合/検証対象のコンテンツが存在しない/コンテンツにアクセスできない/Integrityの計算に失敗
59
59
  * @return Content Attestation
60
60
  */
61
- async function sign(uca, privateKey, options = {}) {
61
+ async function sign(uca, signer, options = {}) {
62
62
  const { issuedAt, expiredAt } = parseDates(options);
63
63
  return await signCa(await unsignedCa(uca, {
64
64
  issuedAt,
65
65
  expiredAt
66
- }), privateKey, {
66
+ }), signer, {
67
67
  issuedAt,
68
68
  expiredAt,
69
69
  documentProvider
@@ -82,7 +82,8 @@ async function signByServer(uca, { endpoint, accessToken, ...options }) {
82
82
  const payload = await unsignedCa(uca, {
83
83
  ...options,
84
84
  issuedAt,
85
- expiredAt
85
+ expiredAt,
86
+ assignId: false
86
87
  });
87
88
  const response = await fetch(endpoint, {
88
89
  method: "POST",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { Jwk, RawTarget, UnsignedContentAttestation, UnsignedWebsiteProfile, UnsignedWebsiteProfileSet } from "@originator-profile/model";
1
+ import { RawTarget, UnsignedContentAttestation, UnsignedWebsiteProfile, UnsignedWebsiteProfileSet } from "@originator-profile/model";
2
2
  import { DocumentProvider, UnsignedWebsiteProfileInput } from "@originator-profile/sign";
3
+ import { JwtSigner, KeyMaterial } from "@originator-profile/securing-mechanism";
3
4
 
4
5
  //#region src/document-provider.d.ts
5
6
  declare function documentProvider$1({
@@ -30,6 +31,11 @@ declare namespace content_attestation_d_exports {
30
31
  type UnsignedCaOptions = TimingOptions & {
31
32
  integrityAlg?: HashAlgorithm;
32
33
  documentProvider?: DocumentProvider;
34
+ /**
35
+ * 入力に credentialSubject.id が無い場合に urn:uuid を採番するか。
36
+ * @default true
37
+ */
38
+ assignId?: boolean;
33
39
  };
34
40
  /**
35
41
  * 未署名 Content Attestation の取得
@@ -40,16 +46,17 @@ type UnsignedCaOptions = TimingOptions & {
40
46
  declare function unsignedCa(uca: UnsignedContentAttestation, {
41
47
  integrityAlg,
42
48
  documentProvider,
49
+ assignId,
43
50
  ...timingOptions
44
51
  }: UnsignedCaOptions): Promise<UnsignedContentAttestation>;
45
52
  /**
46
53
  * Content Attestation への署名
47
54
  * @param uca 未署名 Content Attestation オブジェクト
48
- * @param privateKey プライベート鍵
55
+ * @param signer プライベート鍵、または HSM・KMS・WebAuthn等の外部署名者 (JwtSigner)
49
56
  * @throws {BadRequestError} 入力が UnsignedContentAttestation スキーマに適合しない場合/検証対象のコンテンツが存在しない/コンテンツにアクセスできない/Integrityの計算に失敗
50
57
  * @return Content Attestation
51
58
  */
52
- declare function sign$1(uca: UnsignedContentAttestation, privateKey: Jwk, options?: TimingOptions): Promise<string>;
59
+ declare function sign$1(uca: UnsignedContentAttestation, signer: KeyMaterial | JwtSigner, options?: TimingOptions): Promise<string>;
53
60
  /**
54
61
  * CA server 経由で Content Attestation を作成
55
62
  * @param uca 未署名 Content Attestation オブジェクト
@@ -86,10 +93,10 @@ declare function unsignedWsp<U extends UnsignedWebsiteProfileInput>(uwsp: U, opt
86
93
  * 配列を渡した場合、各要素を個別に署名して JWT 文字列の配列を返します。
87
94
  *
88
95
  * @param uwsp 未署名 Website Profile (単一または配列)
89
- * @param privateKey プライベート鍵
96
+ * @param signer プライベート鍵、または HSM・KMS・WebAuthn等の外部署名者 (JwtSigner)
90
97
  * @throws {BadRequestError} 配列入力の整合性違反や入力が UnsignedWebsiteProfile スキーマに適合しない場合
91
98
  * @return 単一入力時は JWT 文字列、配列入力時は JWT 文字列の配列
92
99
  */
93
- declare function sign<U extends UnsignedWebsiteProfileInput>(uwsp: U, privateKey: Jwk, options?: TimingOptions): Promise<U extends unknown[] ? string[] : string>;
100
+ declare function sign<U extends UnsignedWebsiteProfileInput>(uwsp: U, signer: KeyMaterial | JwtSigner, options?: TimingOptions): Promise<U extends unknown[] ? string[] : string>;
94
101
  //#endregion
95
102
  export { content_attestation_d_exports as ContentAttestation, website_profile_d_exports as WebsiteProfile, documentProvider$1 as documentProvider };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { i as documentProvider, t as content_attestation_exports } from "./content-attestation-Dd-YcVIv.js";
2
- import { r as website_profile_exports } from "./website-profile-Brt0iuRN.js";
1
+ import { i as documentProvider, t as content_attestation_exports } from "./content-attestation-BydW0zgM.js";
2
+ import { r as website_profile_exports } from "./website-profile-B_7x7iSY.js";
3
3
  export { content_attestation_exports as ContentAttestation, website_profile_exports as WebsiteProfile, documentProvider };
@@ -44,14 +44,14 @@ async function unsignedWsp(uwsp, options) {
44
44
  * 配列を渡した場合、各要素を個別に署名して JWT 文字列の配列を返します。
45
45
  *
46
46
  * @param uwsp 未署名 Website Profile (単一または配列)
47
- * @param privateKey プライベート鍵
47
+ * @param signer プライベート鍵、または HSM・KMS・WebAuthn等の外部署名者 (JwtSigner)
48
48
  * @throws {BadRequestError} 配列入力の整合性違反や入力が UnsignedWebsiteProfile スキーマに適合しない場合
49
49
  * @return 単一入力時は JWT 文字列、配列入力時は JWT 文字列の配列
50
50
  */
51
- async function sign(uwsp, privateKey, options = {}) {
51
+ async function sign(uwsp, signer, options = {}) {
52
52
  const timing = parseDates(options);
53
53
  try {
54
- return await signWsp(uwsp, privateKey, timing);
54
+ return await signWsp(uwsp, signer, timing);
55
55
  } catch (e) {
56
56
  throw new BadRequestError(e.message, { cause: e });
57
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@originator-profile/opvc",
3
- "version": "0.6.1",
3
+ "version": "0.7.0-beta.2",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://docs.originator-profile.org",
6
6
  "repository": {
@@ -40,26 +40,25 @@
40
40
  "jose": "^6.2.2",
41
41
  "jsdom": "^29.0.1",
42
42
  "wrap-ansi": "^9.0.2",
43
- "@originator-profile/core": "0.6.1",
44
- "@originator-profile/model": "0.6.1",
45
- "@originator-profile/cryptography": "0.6.1",
46
- "@originator-profile/securing-mechanism": "0.6.1",
47
- "@originator-profile/sign": "0.6.1"
43
+ "@originator-profile/cryptography": "0.7.0-beta.2",
44
+ "@originator-profile/core": "0.7.0-beta.2",
45
+ "@originator-profile/model": "0.7.0-beta.2",
46
+ "@originator-profile/securing-mechanism": "0.7.0-beta.2",
47
+ "@originator-profile/sign": "0.7.0-beta.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "25.6.0",
51
- "eslint": "10.2.0",
52
51
  "oclif": "4.23.0",
52
+ "oxlint": "^1.73.0",
53
+ "oxlint-tsgolint": "^0.24.0",
53
54
  "tsdown": "0.21.7",
54
55
  "typescript": "6.0.2",
55
56
  "websri": "1.0.1",
56
- "@originator-profile/tsconfig": "0.6.1",
57
- "eslint-config-originator-profile": "0.6.1"
57
+ "@originator-profile/tsconfig": "0.7.0-beta.2"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsdown && oclif manifest && oclif readme",
61
- "lint": "eslint --fix .",
62
- "type-check": "tsc",
61
+ "lint": "oxlint --fix .",
63
62
  "test": "node --test"
64
63
  },
65
64
  "bin": {