@agenticprimitives/key-custody 0.1.0-alpha.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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/dist/aad.d.ts +2 -0
  4. package/dist/aad.d.ts.map +1 -0
  5. package/dist/aad.js +19 -0
  6. package/dist/aad.js.map +1 -0
  7. package/dist/account.d.ts +23 -0
  8. package/dist/account.d.ts.map +1 -0
  9. package/dist/account.js +54 -0
  10. package/dist/account.js.map +1 -0
  11. package/dist/derive-subject.d.ts +38 -0
  12. package/dist/derive-subject.d.ts.map +1 -0
  13. package/dist/derive-subject.js +137 -0
  14. package/dist/derive-subject.js.map +1 -0
  15. package/dist/factories.d.ts +30 -0
  16. package/dist/factories.d.ts.map +1 -0
  17. package/dist/factories.js +149 -0
  18. package/dist/factories.js.map +1 -0
  19. package/dist/index.d.ts +13 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +17 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/kms-viem-account.d.ts +4 -0
  24. package/dist/kms-viem-account.d.ts.map +1 -0
  25. package/dist/kms-viem-account.js +72 -0
  26. package/dist/kms-viem-account.js.map +1 -0
  27. package/dist/providers/aws.d.ts +13 -0
  28. package/dist/providers/aws.d.ts.map +1 -0
  29. package/dist/providers/aws.js +14 -0
  30. package/dist/providers/aws.js.map +1 -0
  31. package/dist/providers/gcp.d.ts +103 -0
  32. package/dist/providers/gcp.d.ts.map +1 -0
  33. package/dist/providers/gcp.js +490 -0
  34. package/dist/providers/gcp.js.map +1 -0
  35. package/dist/providers/local.d.ts +60 -0
  36. package/dist/providers/local.d.ts.map +1 -0
  37. package/dist/providers/local.js +246 -0
  38. package/dist/providers/local.js.map +1 -0
  39. package/dist/relay-only.d.ts +3 -0
  40. package/dist/relay-only.d.ts.map +1 -0
  41. package/dist/relay-only.js +19 -0
  42. package/dist/relay-only.js.map +1 -0
  43. package/dist/types.d.ts +134 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +70 -0
  46. package/dist/types.js.map +1 -0
  47. package/package.json +84 -0
  48. package/spec.md +6 -0
@@ -0,0 +1,72 @@
1
+ // createKmsViemAccount — wrap a KmsAccountBackend as a viem LocalAccount
2
+ // so it can be plugged into viem's writeContract / sendTransaction / etc.
3
+ // anywhere a privateKeyToAccount(...) account would go.
4
+ //
5
+ // Why a separate file from src/account.ts (createKmsAccount):
6
+ // - createKmsAccount produces an connect-auth `Signer` shape
7
+ // (signMessage / signTypedData only) for the identity layer.
8
+ // - createKmsViemAccount produces a viem `LocalAccount` (adds
9
+ // signTransaction) for the wallet/broadcast layer.
10
+ // - Different consumers, different layers — separating them keeps
11
+ // each surface minimal.
12
+ //
13
+ // Signing flow (all routes funnel into backend.signA2AAction):
14
+ // - signMessage: EIP-191 hash via viem.hashMessage → 32-byte digest → KMS sign
15
+ // - signTransaction: viem.serializeTransaction (unsigned) → keccak256 → KMS sign,
16
+ // then viem.serializeTransaction with the signature
17
+ // - signTypedData: viem.hashTypedData → 32-byte digest → KMS sign
18
+ //
19
+ // The private key never leaves Cloud KMS / AWS KMS / etc. — the HSM signs
20
+ // the digest; viem assembles the signed RLP / serialized signature locally.
21
+ import { hashMessage, hashTypedData, keccak256, serializeTransaction, serializeSignature, bytesToHex, hexToBytes, } from 'viem';
22
+ async function signDigestViaBackend(backend, digest) {
23
+ const { signature } = await backend.signA2AAction({ digest: hexToBytes(digest) });
24
+ if (signature.length !== 65) {
25
+ throw new Error(`KMS signer returned ${signature.length}-byte signature; expected 65 (r||s||v)`);
26
+ }
27
+ const r = bytesToHex(signature.slice(0, 32));
28
+ const s = bytesToHex(signature.slice(32, 64));
29
+ const vByte = signature[64];
30
+ if (vByte !== 27 && vByte !== 28) {
31
+ throw new Error(`KMS signer returned non-canonical v=${vByte}; expected 27 or 28`);
32
+ }
33
+ return { r, s, v: vByte, yParity: (vByte - 27) };
34
+ }
35
+ export async function createKmsViemAccount(backend) {
36
+ const address = await backend.getSignerAddress();
37
+ return {
38
+ address,
39
+ type: 'local',
40
+ source: 'kms',
41
+ // publicKey is optional on LocalAccount; we'd need the uncompressed
42
+ // secp256k1 point to populate it. Skipping — viem only needs it for
43
+ // a few utility paths that don't apply to our use case.
44
+ publicKey: '0x',
45
+ async signMessage({ message }) {
46
+ const digest = hashMessage(message);
47
+ const { r, s, v } = await signDigestViaBackend(backend, digest);
48
+ return serializeSignature({ r, s, v: BigInt(v) });
49
+ },
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ async signTransaction(transaction, options) {
52
+ // Match viem's privateKeyToAccount pattern: serialize unsigned →
53
+ // keccak256 → sign → re-serialize with signature. viem dispatches
54
+ // legacy/EIP-1559/EIP-4844 internally based on transaction shape.
55
+ const serializer = options?.serializer ?? serializeTransaction;
56
+ const unsigned = serializer(transaction);
57
+ const digest = keccak256(unsigned);
58
+ const { r, s, v, yParity } = await signDigestViaBackend(backend, digest);
59
+ // Pass both v (legacy) and yParity (EIP-1559+).
60
+ return serializer(transaction, { r, s, v: BigInt(v), yParity });
61
+ },
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ async signTypedData(args) {
64
+ // viem's TypedDataDefinition is heavily generic; we accept whatever
65
+ // viem's hashTypedData accepts and forward it verbatim.
66
+ const digest = hashTypedData(args);
67
+ const { r, s, v } = await signDigestViaBackend(backend, digest);
68
+ return serializeSignature({ r, s, v: BigInt(v) });
69
+ },
70
+ };
71
+ }
72
+ //# sourceMappingURL=kms-viem-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kms-viem-account.js","sourceRoot":"","sources":["../src/kms-viem-account.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,wDAAwD;AACxD,EAAE;AACF,8DAA8D;AAC9D,+DAA+D;AAC/D,iEAAiE;AACjE,gEAAgE;AAChE,uDAAuD;AACvD,oEAAoE;AACpE,4BAA4B;AAC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AAE,MAAM,CAAC,CAAC;YAChE,OAAO,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpD,CAAC;KACqB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { A2AKeyProvider, KmsAccountBackend } from '../types';
2
+ import type { Address } from '@agenticprimitives/types';
3
+ export declare class AwsKmsProvider implements A2AKeyProvider {
4
+ readonly keyVersion = "aws-kms:not-implemented";
5
+ generateSessionDataKey(): Promise<never>;
6
+ decryptSessionDataKey(): Promise<never>;
7
+ }
8
+ export declare class AwsKmsSigner implements KmsAccountBackend {
9
+ readonly provider: "aws-kms";
10
+ signA2AAction(): Promise<never>;
11
+ getSignerAddress(): Promise<Address>;
12
+ }
13
+ //# sourceMappingURL=aws.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws.d.ts","sourceRoot":"","sources":["../../src/providers/aws.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAIxD,qBAAa,cAAe,YAAW,cAAc;IACnD,QAAQ,CAAC,UAAU,6BAA6B;IAC1C,sBAAsB,IAAI,OAAO,CAAC,KAAK,CAAC;IACxC,qBAAqB,IAAI,OAAO,CAAC,KAAK,CAAC;CAC9C;AAED,qBAAa,YAAa,YAAW,iBAAiB;IACpD,QAAQ,CAAC,QAAQ,EAAG,SAAS,CAAU;IACjC,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC;IAC/B,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;CAC3C"}
@@ -0,0 +1,14 @@
1
+ // AwsKmsProvider / AwsKmsSigner — production AWS KMS backends.
2
+ // Stubs in v0 demo; full implementation lands in v0.1.
3
+ const NOT_IMPLEMENTED = 'AwsKmsProvider / AwsKmsSigner not yet implemented in v0; use LocalAesProvider for the demo.';
4
+ export class AwsKmsProvider {
5
+ keyVersion = 'aws-kms:not-implemented';
6
+ async generateSessionDataKey() { throw new Error(NOT_IMPLEMENTED); }
7
+ async decryptSessionDataKey() { throw new Error(NOT_IMPLEMENTED); }
8
+ }
9
+ export class AwsKmsSigner {
10
+ provider = 'aws-kms';
11
+ async signA2AAction() { throw new Error(NOT_IMPLEMENTED); }
12
+ async getSignerAddress() { throw new Error(NOT_IMPLEMENTED); }
13
+ }
14
+ //# sourceMappingURL=aws.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws.js","sourceRoot":"","sources":["../../src/providers/aws.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,uDAAuD;AAKvD,MAAM,eAAe,GAAG,6FAA6F,CAAC;AAEtH,MAAM,OAAO,cAAc;IAChB,UAAU,GAAG,yBAAyB,CAAC;IAChD,KAAK,CAAC,sBAAsB,KAAqB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACpF,KAAK,CAAC,qBAAqB,KAAqB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CACpF;AAED,MAAM,OAAO,YAAY;IACd,QAAQ,GAAG,SAAkB,CAAC;IACvC,KAAK,CAAC,aAAa,KAAqB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC3E,KAAK,CAAC,gBAAgB,KAAuB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CACjF"}
@@ -0,0 +1,103 @@
1
+ import { type Address } from 'viem';
2
+ import { type AuditSink } from '@agenticprimitives/audit';
3
+ import type { A2AKeyProvider, KmsAccountBackend } from '../types';
4
+ interface ServiceAccount {
5
+ client_email: string;
6
+ /** PEM-encoded PKCS#8 RSA private key. */
7
+ private_key: string;
8
+ project_id?: string;
9
+ }
10
+ interface CachedToken {
11
+ accessToken: string;
12
+ /** Unix seconds at which the token must be refreshed (already minus buffer). */
13
+ expiresAt: number;
14
+ }
15
+ export interface GcpKmsSignerOpts {
16
+ /**
17
+ * Full Cloud KMS resource name of the key version to sign with, e.g.
18
+ * `projects/<P>/locations/<L>/keyRings/<R>/cryptoKeys/<K>/cryptoKeyVersions/<V>`.
19
+ * Algorithm must be `EC_SIGN_SECP256K1_SHA256`.
20
+ */
21
+ cryptoKeyVersionName: string;
22
+ /** Raw JSON string of the service-account key file. */
23
+ serviceAccountJson: string;
24
+ }
25
+ export declare function base64UrlEncode(bytes: Uint8Array): string;
26
+ export declare function pemToDer(pem: string): Uint8Array;
27
+ export declare function signJwt(serviceAccount: ServiceAccount, scope: string): Promise<string>;
28
+ export declare function fetchAccessToken(serviceAccount: ServiceAccount): Promise<CachedToken>;
29
+ export declare function parseSpkiUncompressedSecp256k1PubKey(spkiDer: Uint8Array): Uint8Array;
30
+ export declare function publicKeyToAddress(pubKey65: Uint8Array): Address;
31
+ export declare function parseDerEcdsa(der: Uint8Array): {
32
+ r: bigint;
33
+ s: bigint;
34
+ };
35
+ export declare function bigIntTo32Bytes(n: bigint): Uint8Array;
36
+ export declare function normalizeLowS(s: bigint): bigint;
37
+ export declare function findRecoveryByte(r: bigint, s: bigint, digest: Uint8Array, knownPubKey65: Uint8Array): number;
38
+ export declare class GcpKmsSigner implements KmsAccountBackend {
39
+ readonly provider: "gcp-kms";
40
+ private readonly keyName;
41
+ private readonly serviceAccount;
42
+ private readonly auditSink?;
43
+ private cachedToken?;
44
+ private cachedPubKey65?;
45
+ private cachedAddress?;
46
+ constructor(opts?: Partial<GcpKmsSignerOpts> & {
47
+ auditSink?: AuditSink;
48
+ });
49
+ private getAccessToken;
50
+ private getPublicKeyBytes;
51
+ getSignerAddress(): Promise<Address>;
52
+ signA2AAction(input: {
53
+ digest: Uint8Array;
54
+ auditContext?: {
55
+ toolId?: string;
56
+ sessionId?: string;
57
+ actionId?: string;
58
+ };
59
+ }): Promise<{
60
+ signature: Uint8Array;
61
+ keyId: string;
62
+ signerAddress: Address;
63
+ }>;
64
+ }
65
+ export interface GcpKmsProviderOpts {
66
+ /**
67
+ * Full Cloud KMS resource name of the symmetric encrypt-decrypt key, e.g.
68
+ * `projects/<P>/locations/<L>/keyRings/<R>/cryptoKeys/<K>`. Note: NO
69
+ * `/cryptoKeyVersions/N` suffix — GCP picks the active version.
70
+ */
71
+ cryptoKeyName: string;
72
+ /** Raw JSON string of the service-account key file. */
73
+ serviceAccountJson: string;
74
+ }
75
+ export declare class GcpKmsProvider implements A2AKeyProvider {
76
+ /**
77
+ * H7-F.4: this default is now ONLY used when the GCP encrypt response
78
+ * doesn't carry a `name` field (test fixtures + offline mocks). Real
79
+ * runs derive `keyVersion` from the response per call.
80
+ */
81
+ readonly keyVersion = "gcp-kms:unknown";
82
+ private readonly keyName;
83
+ private readonly serviceAccount;
84
+ private cachedToken?;
85
+ constructor(opts?: Partial<GcpKmsProviderOpts>);
86
+ private getAccessToken;
87
+ generateSessionDataKey(input: {
88
+ aadContext: Record<string, string>;
89
+ }): Promise<{
90
+ plaintextDataKey: Uint8Array;
91
+ encryptedDataKey: Uint8Array;
92
+ keyId: string;
93
+ keyVersion: string;
94
+ }>;
95
+ decryptSessionDataKey(input: {
96
+ encryptedDataKey: Uint8Array;
97
+ aadContext: Record<string, string>;
98
+ keyId: string;
99
+ keyVersion: string;
100
+ }): Promise<Uint8Array>;
101
+ }
102
+ export {};
103
+ //# sourceMappingURL=gcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcp.d.ts","sourceRoot":"","sources":["../../src/providers/gcp.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAkBlE,UAAU,cAAc;IACtB,YAAY,EAAE,MAAM,CAA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