@kubun/credential-types 0.17.0 → 0.17.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/lib/index.d.ts +38 -0
- package/lib/index.js +5 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export type ProviderAccount = {
|
|
2
|
+
/** OpenID issuer, e.g. `https://accounts.google.com`. */
|
|
3
|
+
iss: string;
|
|
4
|
+
/** Stable, opaque provider subject id. Never projected to the graph. */
|
|
5
|
+
sub: string;
|
|
6
|
+
};
|
|
1
7
|
export type Credential = {
|
|
2
8
|
accessToken: string;
|
|
3
9
|
refreshToken?: string;
|
|
@@ -5,6 +11,12 @@ export type Credential = {
|
|
|
5
11
|
scopes: Array<string>;
|
|
6
12
|
accountLabel?: string;
|
|
7
13
|
metadata?: Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Verified stable provider-account identity captured at OAuth completion.
|
|
16
|
+
* Lives only in the encrypted credential body; the graph sees only a derived
|
|
17
|
+
* non-reversible key. Preserved verbatim across token refresh.
|
|
18
|
+
*/
|
|
19
|
+
providerAccount?: ProviderAccount;
|
|
8
20
|
};
|
|
9
21
|
export type CredentialProvider = {
|
|
10
22
|
get(providerName: string, ownerDID: string): Promise<Credential | null>;
|
|
@@ -28,3 +40,29 @@ export type CredentialProvider = {
|
|
|
28
40
|
}): Promise<void>;
|
|
29
41
|
delete(providerName: string, ownerDID: string): Promise<void>;
|
|
30
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Opt-in capability: point `(providerName, ownerDID)` at an entry the
|
|
45
|
+
* provider already holds, without minting anything. A `CredentialProvider`
|
|
46
|
+
* that also implements this can bind an alias to an entry created out of
|
|
47
|
+
* band (e.g. a device-to-device credential handoff).
|
|
48
|
+
*/
|
|
49
|
+
export type AliasBindingCredentialProvider = {
|
|
50
|
+
bindAlias(providerName: string, ownerDID: string, entryID: string): Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Opt-in capability: read and write a credential together with the entryID
|
|
54
|
+
* it resolves to, so a caller can target that entry directly on a
|
|
55
|
+
* subsequent write without re-resolving the alias.
|
|
56
|
+
*/
|
|
57
|
+
export type EntryPairedCredentialProvider = {
|
|
58
|
+
getCredentialRef(providerName: string, ownerDID: string): Promise<{
|
|
59
|
+
credential: Credential;
|
|
60
|
+
entryID: string;
|
|
61
|
+
} | null>;
|
|
62
|
+
setCredentialForEntry(params: {
|
|
63
|
+
providerName: string;
|
|
64
|
+
ownerDID: string;
|
|
65
|
+
entryID: string;
|
|
66
|
+
credential: Credential;
|
|
67
|
+
}): Promise<'updated' | 'absent'>;
|
|
68
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -2,4 +2,8 @@
|
|
|
2
2
|
// that stores/refreshes it. Kept in this leaf package so both the low-level
|
|
3
3
|
// `@kubun/connector` (which consumes the port) and `@kubun/credential` (which
|
|
4
4
|
// implements it) can depend on the types without depending on each other.
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Opt-in capability: read and write a credential together with the entryID
|
|
7
|
+
* it resolves to, so a caller can target that entry directly on a
|
|
8
|
+
* subsequent write without re-resolving the alias.
|
|
9
|
+
*/ export { };
|