Skip to content

Commit 2088cec

Browse files
feat: add in Falcon24 support (#1)
1 parent 062ed1b commit 2088cec

57 files changed

Lines changed: 4808 additions & 2942 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/package-release.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish Package
22
on:
3-
push:
4-
branches: ['main', 'release/*']
3+
workflow_dispatch:
4+
55
jobs:
66
npm-publish:
77
runs-on: ubuntu-latest
@@ -29,11 +29,3 @@ jobs:
2929
env:
3030
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3131
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
32-
- name: Merge Release -> Trunk
33-
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f
34-
if: github.ref == 'refs/heads/release/1.x'
35-
with:
36-
type: now
37-
from_branch: release/1.x
38-
target_branch: main
39-
github_token: ${{ steps.app-token.outputs.token }}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ docker-compose.override.yml
33
swagger-codegen-cli.jar
44
ngrok.yml
55
.data
6-
lib
6+
#lib
77
docs
88

99
# Logs
@@ -137,3 +137,6 @@ dist
137137
.yarn/build-state.yml
138138
.yarn/install-state.gz
139139
.pnp.*
140+
141+
.idea/*
142+
pnpm-lock.yaml

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @algorandfoundation/liquid-client
1+
# @algorandecosystem/liquid-client
22

33
[![CI](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/CI.yml/badge.svg)](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/CI.yml)[![Publish Package](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/package-release.yml/badge.svg)](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/package-release.yml)[![codecov](https://codecov.io/gh/algorandfoundation/liquid-auth-js/graph/badge.svg?token=AKN7VATWTO)](https://codecov.io/gh/algorandfoundation/liquid-auth-js)[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
44

@@ -15,7 +15,7 @@ npm install algorandfoundation/liquid-auth-js --save
1515
# 📝 Usage
1616

1717
```typescript
18-
import {SignalClient} from '@algorandfoundation/liquid-client';
18+
import {SignalClient} from '@algorandecosystem/liquid-client';
1919
const client = new SignalClient(window.origin);
2020
```
2121

lib/assertion.d.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
export * as fetch from './assertion.fetch.js';
2+
export * as encoder from './assertion.encoder.js';
3+
/**
4+
* Represents the options for an assertion used during authentication.
5+
*/
6+
export type AssertionOptions = {
7+
/**
8+
* Represents the origin service to which a request should be sent.
9+
*/
10+
origin: string;
11+
/**
12+
* Represents the unique identifier for a credential.
13+
* This variable identifies a specific credential within the authenticator.
14+
*/
15+
credId: string;
16+
/**
17+
* An optional configuration object that specifies options for a PublicKeyCredential request.
18+
*
19+
* This object is used during the process of requesting a credential from the user's device
20+
* for Web Authentication (WebAuthn). It allows customization of the request to match
21+
* the application's authentication requirements.
22+
*
23+
* Property details of `PublicKeyCredentialRequestOptions` typically include:
24+
* - `timeout`: The time, in milliseconds, that the user agent is expected to wait for a response.
25+
* - `userVerification`: Specifies the level of user verification required (e.g., "required", "preferred", "discouraged").
26+
*
27+
* This parameter is optional when calling authentication-related functions. If omitted,
28+
* the request may rely on default or previously established options.
29+
*/
30+
options?: PublicKeyCredentialRequestOptions;
31+
/**
32+
* A boolean flag to enable or disable debug mode.
33+
* If set to `true`, the application may output additional
34+
* logging or diagnostic information useful for debugging.
35+
* Defaults to `false` if not specified.
36+
*/
37+
debug?: boolean;
38+
};
39+
/**
40+
* Assert a known credential
41+
*
42+
* Handles both {@link fetch.postOptions} and {@link fetch.postResponse} for the caller.
43+
* This includes encoding/decoding the payloads from the service and navigator api.
44+
*
45+
* #### Quick Start:
46+
* {@includeCode ./assertion.spec.ts#assertionImport,quickStart}
47+
*
48+
*
49+
* @param {AssertionOptions} params
50+
*/
51+
export declare function assertion(params: AssertionOptions): Promise<any>;

lib/assertion.encoder.d.ts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
* Represents an encoded authenticator assertion response typically used in WebAuthn authentication.
3+
* This type defines the structure of the response and ensures all required fields are provided in string format.
4+
*
5+
* EncodedAuthenticatorAssertionResponse includes:
6+
* - A map of additional string properties if needed.
7+
* - Fields such as `clientDataJSON`, `authenticatorData`, `signature`, and `userHandle`.
8+
*
9+
* The primary purpose of this type is to encapsulate the components originating from the authenticator
10+
* required to validate the authentication assertion.
11+
*
12+
* @protected
13+
*/
14+
export type EncodedAuthenticatorAssertionResponse = {
15+
[k: string]: string;
16+
clientDataJSON: string;
17+
authenticatorData: string;
18+
signature: string;
19+
userHandle: string;
20+
};
21+
/**
22+
*
23+
* @param response
24+
* @protected
25+
*/
26+
export declare function encodeResponse(response: AuthenticatorAssertionResponse & Record<string, ArrayBuffer>): EncodedAuthenticatorAssertionResponse;
27+
/**
28+
* EncodedPublicKeyCredentialDescriptor represents a type that extends the PublicKeyCredentialDescriptor interface
29+
* with an additional requirement for the 'id' property to be of type string.
30+
*
31+
* This type is used to encapsulate the properties of a public key credential, including its unique identifier,
32+
* in a form where the 'id' is explicitly defined as a string rather than an ArrayBuffer.
33+
*
34+
* It is typically utilized in contexts where serialized or encoded values of public key credentials are required.
35+
*
36+
* Properties:
37+
* - id: A string representation of the unique identifier for the public key credential.
38+
*
39+
* This type is a combination of PublicKeyCredentialDescriptor properties and overrides for specific use cases
40+
* requiring encoded identifiers.
41+
* @protected
42+
*/
43+
export type EncodedPublicKeyCredentialDescriptor = PublicKeyCredentialDescriptor & {
44+
id: string;
45+
};
46+
/**
47+
* EncodedPublicKeyCredentialRequestOptions is a composite type that extends
48+
* the PublicKeyCredentialRequestOptions interface. This type is designed
49+
* to represent request options for a WebAuthn authentication process,
50+
* with specific adjustments to handle encoded data formats.
51+
*
52+
* The primary purpose of this type is to ensure compatibility with encoded
53+
* challenges and allow credentials that are represented in an encoded format.
54+
*
55+
* Properties:
56+
* - Includes all properties from PublicKeyCredentialRequestOptions.
57+
* - `allowCredentials` (optional): An array of encoded credential descriptors
58+
* that specify which credentials may be used for the assertion.
59+
* - `challenge`: A cryptographic random challenge provided in encoded format,
60+
* used in the WebAuthn assertion process.
61+
*
62+
* This type is intended to support workflows where cryptographic data must
63+
* be encoded for transport or storage.
64+
*
65+
* @protected
66+
*/
67+
export type EncodedPublicKeyCredentialRequestOptions = PublicKeyCredentialRequestOptions & {
68+
allowCredentials?: EncodedPublicKeyCredentialDescriptor[];
69+
challenge: string;
70+
};
71+
/**
72+
* Decodes the given assertion request options by converting base64URL-encoded fields
73+
* into their corresponding ArrayBuffer representations and returns the decoded options.
74+
*
75+
* @param {EncodedPublicKeyCredentialRequestOptions} options - The encoded credential options to decode, containing properties such as `challenge` and `allowCredentials`.
76+
* @return {PublicKeyCredentialRequestOptions} The decoded credential request options with binary data fields properly converted.
77+
*/
78+
export declare function decodeOptions(options: EncodedPublicKeyCredentialRequestOptions): PublicKeyCredentialRequestOptions;
79+
/**
80+
* @protected
81+
*/
82+
export type EncodedCredential = {
83+
[k: string]: string | EncodedAuthenticatorAssertionResponse;
84+
id: string;
85+
type: string;
86+
response: EncodedAuthenticatorAssertionResponse;
87+
rawId: string;
88+
};
89+
/**
90+
* Encodes the provided PublicKeyCredential into an EncodedCredential object.
91+
*
92+
* @param {PublicKeyCredential} credential - The PublicKeyCredential to be encoded.
93+
* @return {EncodedCredential} A new object containing the encoded properties of the credential.
94+
* @throws {Error} Throws an error if the input credential is invalid or cannot be processed.
95+
*/
96+
export declare function encodeCredential(credential: Credential | null): EncodedCredential;

lib/assertion.encoder.js

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/assertion.encoder.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/assertion.fetch.d.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { EncodedPublicKeyCredentialRequestOptions, EncodedCredential } from './assertion.encoder.js';
2+
/**
3+
* Fetch Assertion Options
4+
*
5+
* POST Authenticator Selector to the REST API
6+
* to receive the PublicKeyCredentialRequestOptions
7+
*
8+
* @param origin
9+
* @param credId
10+
* @todo: Generate Typed JSON-RPC clients from Swagger/OpenAPI
11+
* @module fetch
12+
*/
13+
export declare function postOptions(origin: string, credId: string): Promise<EncodedPublicKeyCredentialRequestOptions>;
14+
/**
15+
* Fetch Assertion Response
16+
*
17+
* POST an Authenticator Assertion Response to the REST API
18+
*
19+
* @param origin
20+
* @param credential
21+
* @todo: Generate Typed JSON-RPC clients from Swagger/OpenAPI
22+
*/
23+
export declare function postResponse(origin: string, credential: EncodedCredential): Promise<any>;

lib/assertion.fetch.js

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)