-
Notifications
You must be signed in to change notification settings - Fork 7
upgrade to ucan 0.9 #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
4a7bbe9
8639961
5a0b238
a5b30e6
ff9c434
15abcb5
28f67dd
2edba5e
b7a42d8
55c5427
fc1d659
3f58a66
2f3a606
8d0ff3d
7152354
3cc3549
4bc09a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { SigningPrincipal } from '@ucanto/principal' | ||
import * as ed25519 from '@ucanto/principal/ed25519' | ||
|
||
/** did:key:z6Mkqa4oY9Z5Pf5tUcjLHLUsDjKwMC95HGXdE1j22jkbhz6r */ | ||
export const alice = SigningPrincipal.parse( | ||
export const alice = ed25519.parse( | ||
'MgCZT5vOnYZoVAeyjnzuJIVY9J4LNtJ+f8Js0cTPuKUpFne0BVEDJjEu6quFIU8yp91/TY/+MYK8GvlKoTDnqOCovCVM=' | ||
) | ||
/** did:key:z6MkffDZCkCTWreg8868fG1FGFogcJj5X6PY93pPcWDn9bob */ | ||
export const bob = SigningPrincipal.parse( | ||
export const bob = ed25519.parse( | ||
'MgCYbj5AJfVvdrjkjNCxB3iAUwx7RQHVQ7H1sKyHy46Iose0BEevXgL1V73PD9snOCIoONgb+yQ9sycYchQC8kygR4qY=' | ||
) | ||
/** did:key:z6MktafZTREjJkvV5mfJxcLpNBoVPwDLhTuMg9ng7dY4zMAL */ | ||
export const mallory = SigningPrincipal.parse( | ||
export const mallory = ed25519.parse( | ||
'MgCYtH0AvYxiQwBG6+ZXcwlXywq9tI50G2mCAUJbwrrahkO0B0elFYkl3Ulf3Q3A/EvcVY0utb4etiSE8e6pi4H0FEmU=' | ||
) | ||
|
||
export const service = SigningPrincipal.parse( | ||
export const service = ed25519.parse( | ||
'MgCYKXoHVy7Vk4/QjcEGi+MCqjntUiasxXJ8uJKY0qh11e+0Bs8WsdqGK7xothgrDzzWD0ME7ynPjz2okXDh8537lId8=' | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { SigningPrincipal } from '@ucanto/principal' | ||
import * as ed25519 from '@ucanto/principal/ed25519' | ||
|
||
/** did:key:z6Mkqa4oY9Z5Pf5tUcjLHLUsDjKwMC95HGXdE1j22jkbhz6r */ | ||
export const alice = SigningPrincipal.parse( | ||
export const alice = ed25519.parse( | ||
'MgCZT5vOnYZoVAeyjnzuJIVY9J4LNtJ+f8Js0cTPuKUpFne0BVEDJjEu6quFIU8yp91/TY/+MYK8GvlKoTDnqOCovCVM=' | ||
) | ||
/** did:key:z6MkffDZCkCTWreg8868fG1FGFogcJj5X6PY93pPcWDn9bob */ | ||
export const bob = SigningPrincipal.parse( | ||
export const bob = ed25519.parse( | ||
'MgCYbj5AJfVvdrjkjNCxB3iAUwx7RQHVQ7H1sKyHy46Iose0BEevXgL1V73PD9snOCIoONgb+yQ9sycYchQC8kygR4qY=' | ||
) | ||
/** did:key:z6MktafZTREjJkvV5mfJxcLpNBoVPwDLhTuMg9ng7dY4zMAL */ | ||
export const mallory = SigningPrincipal.parse( | ||
export const mallory = ed25519.parse( | ||
'MgCYtH0AvYxiQwBG6+ZXcwlXywq9tI50G2mCAUJbwrrahkO0B0elFYkl3Ulf3Q3A/EvcVY0utb4etiSE8e6pi4H0FEmU=' | ||
) | ||
|
||
export const service = SigningPrincipal.parse( | ||
export const service = ed25519.parse( | ||
'MgCYKXoHVy7Vk4/QjcEGi+MCqjntUiasxXJ8uJKY0qh11e+0Bs8WsdqGK7xothgrDzzWD0ME7ynPjz2okXDh8537lId8=' | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,7 +23,7 @@ | |||||
"build": "tsc --build" | ||||||
}, | ||||||
"dependencies": { | ||||||
"@ipld/dag-ucan": "3.0.0-beta", | ||||||
"@ipld/dag-ucan": "link:/Users/gozala/Projects/js-dag-ucan", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
"multiformats": "^9.8.1" | ||||||
}, | ||||||
"devDependencies": { | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,13 +13,11 @@ import { | |||||
Phantom, | ||||||
Resource, | ||||||
Signature, | ||||||
Principal, | ||||||
Verifier, | ||||||
Signer, | ||||||
} from '@ipld/dag-ucan' | ||||||
import * as UCAN from '@ipld/dag-ucan' | ||||||
import type { | ||||||
Principal, | ||||||
PrincipalParser, | ||||||
SigningPrincipal, | ||||||
} from './principal.js' | ||||||
import { | ||||||
CanIssue, | ||||||
InvalidAudience, | ||||||
|
@@ -33,14 +31,13 @@ export type { | |||||
MultibaseDecoder, | ||||||
MultibaseEncoder, | ||||||
} from 'multiformats/bases/interface' | ||||||
export * from './principal.js' | ||||||
export * from './capability.js' | ||||||
export * from './transport.js' | ||||||
export type { | ||||||
Transport, | ||||||
Principal, | ||||||
PrincipalParser, | ||||||
SigningPrincipal, | ||||||
Verifier, | ||||||
Signer, | ||||||
Phantom, | ||||||
Tuple, | ||||||
DID, | ||||||
|
@@ -80,11 +77,8 @@ export interface UCANOptions { | |||||
proofs?: Proof[] | ||||||
} | ||||||
|
||||||
export interface DelegationOptions< | ||||||
C extends Capabilities, | ||||||
A extends number = number | ||||||
> extends UCANOptions { | ||||||
issuer: SigningPrincipal<A> | ||||||
export interface DelegationOptions<C extends Capabilities> extends UCANOptions { | ||||||
issuer: Signer | ||||||
audience: Principal | ||||||
capabilities: C | ||||||
proofs?: Proof[] | ||||||
|
@@ -93,17 +87,17 @@ export interface DelegationOptions< | |||||
export interface Delegation<C extends Capabilities = Capabilities> { | ||||||
readonly root: UCANBlock<C> | ||||||
/** | ||||||
* Map of all the IPLD blocks that where included with this delegation DAG. | ||||||
* Usually this would be blocks corresponding to proofs, however it may | ||||||
* also contain other blocks e.g. things that `capabilities` or `facts` may | ||||||
* link. | ||||||
* It is not guaranteed to include all the blocks of this DAG, as it represents | ||||||
* a partial DAG of the delegation desired for transporting. | ||||||
* | ||||||
* Also note that map may contain blocks that are not part of this | ||||||
* delegation DAG. That is because `Delegation` is usually constructed as | ||||||
* view / selection over the CAR which may contain bunch of other blocks. | ||||||
*/ | ||||||
* Map of all the IPLD blocks that where included with this delegation DAG. | ||||||
* Usually this would be blocks corresponding to proofs, however it may | ||||||
* also contain other blocks e.g. things that `capabilities` or `facts` may | ||||||
* link. | ||||||
* It is not guaranteed to include all the blocks of this DAG, as it represents | ||||||
* a partial DAG of the delegation desired for transporting. | ||||||
* | ||||||
* Also note that map may contain blocks that are not part of this | ||||||
* delegation DAG. That is because `Delegation` is usually constructed as | ||||||
* view / selection over the CAR which may contain bunch of other blocks. | ||||||
*/ | ||||||
readonly blocks: Map<string, Block> | ||||||
|
||||||
readonly cid: UCANLink<C> | ||||||
|
@@ -132,13 +126,13 @@ export interface Invocation<C extends Capability = Capability> | |||||
|
||||||
export interface InvocationOptions<C extends Capability = Capability> | ||||||
extends UCANOptions { | ||||||
issuer: SigningPrincipal | ||||||
issuer: Signer | ||||||
capability: C | ||||||
} | ||||||
|
||||||
export interface IssuedInvocation<C extends Capability = Capability> | ||||||
extends DelegationOptions<[C]> { | ||||||
readonly issuer: SigningPrincipal | ||||||
readonly issuer: Signer | ||||||
readonly audience: Principal | ||||||
readonly capabilities: [C] | ||||||
|
||||||
|
@@ -390,3 +384,7 @@ export interface URI<P extends Protocol = Protocol> extends URL { | |||||
export type URIString<P extends URI> = `${URI['protocol']}${string}` & { | ||||||
protocol?: Protocol | ||||||
} | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. export interface Verifier {
verify(did: UCAN.DID, signature: Signature): Await<boolean>
} |
||||||
export interface PrincipalParser { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
parse(did: UCAN.DID): UCAN.Verifier | ||||||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.